Ok I found this in the lighttpd optimization article.
Also, when configuring lighty to manage php-fcgi processes, it is better to have more processes and less children than less processes and more children. For example:
Code:
fastcgi.server = ( ".php" =>
(( "socket" => "/tmp/php-fastcgi.socket",
"bin-path" => "/usr/bin/php-cgi",
"max-procs" => 10,
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "10",
"PHP_FCGI_MAX_REQUESTS" => "500"
),
"broken-scriptfilename" => "enable"
))
)
Is better than:
Code:
fastcgi.server = ( ".php" =>
(( "socket" => "/tmp/php-fastcgi.socket",
"bin-path" => "/usr/bin/php-cgi",
"max-procs" => 2,
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "50",
"PHP_FCGI_MAX_REQUESTS" => "500"
),
"broken-scriptfilename" => "enable"
))
)
because,
when a backend "dies", all the children from that one FastCGI process become unavailable. Having many processes means that if one dies the rest can share the load. If you have 2 processes and both are loaded equally then if/when one dies the other one will suddenly become overloaded and die itself, causing lighty to throw 500 errors.
The red explains how the slowdown affects the entire site, we only had a single parent process.
Notice that both of those configurations above you end up with 101 total fast-cgi processes. 2x50+1 and 10x10+1. The number of parents is larger in the "better" example, and the number of childfren is smaller.
When Sim originally setup lighttpd, we had a single parent and 64 children, for a total of 65 cgi processes. I bumped the children to 128 when we added RAM last month. This is the wrong way to do it.
I just changed our setup to:
Code:
fastcgi.server = ( ".php" => ((
"socket" => "/var/run/lighttpd/php-fastcgi.socket",
"bin-path" => "/usr/bin/php-cgi",
"broken-scriptfilename" => "enable",
"min-procs" => 1,
"max-procs" => 10,
"allow-x-send-file" => "enable",
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "18",
"PHP_FCGI_MAX_REQUESTS" => "500"
So we now have 10 parents instead of 1, and 18 children, for a total of 181. We will see what that does.
Sorry if the lighttpd restart hosed anyone up, it needed to be done.