Load balancing FastCGI
Run this command on a worker
spawn-fcgi -p 8081 -a 192.168.2.100 -f /usr/bin/php-cgi -u lighttpd -g lighttpd -C 5 -P /var/run/spawn-fcgi-8081.pidDon't forget to open up the right port (8081 in the example) and monitor the processes (say restart when it dies)
Reference
http://www.cyberciti.biz/tips/lighttpd-mod_proxy-to-run-php-fastcgi-app-server.htmlBind to a socket
spawn-fcgi -s /tmp/php-fastcgi-ext.sock -f /usr/bin/php-cgi -u lighttpd -g lighttpd -C 5 -P /var/run/spawn-fcgi.pidBind to an IP:port
spawn-fcgi -p 8081 -a 192.168.2.100 -f /usr/bin/php-cgi -u lighttpd -g lighttpd -C 5 -P /var/run/spawn-fcgi-8081.pidReference
http://trac.lighttpd.net/trac/wiki/Docs%3AModFastCGI#load-balancing Need also to turn on lighttpd (service lighttpd start) so reporter can get status on this server directly (through port 80)Using an external fcgi in lighttpd.conf to load balance only a specific file
fastcgi.server = (
"/index.php"=>
(
("socket"=>"/tmp/php-fastcgi.socket",
"bin-path"=>"/usr/bin/php-cgi",
"min-procs"=>2,
"max-procs"=>4,
"bin-environment"=>("PHP_FCGI_CHILDREN"=>"10","PHP_FCGI_MAX_REQUESTS"=>"5000")
),
("host"=>"192.168.2.100",
"port"=>8081,
"check-local"=>"disable",
"disable-time"=>30
)
),
".php"=>
(
("socket"=>"/tmp/php-fastcgi.socket",
"bin-path"=>"/usr/bin/php-cgi",
"min-procs"=>1,
"max-procs"=>2,
"bin-environment"=>("PHP_FCGI_CHILDREN"=>"5","PHP_FCGI_MAX_REQUESTS"=>"1000")
)
)
)
Labels: sysadmin
0 Comments:
Post a Comment
<< Home