httpd─┬─httpd───10*[php-cgi───8*[php-cgi]]
└─23*[httpd]
└─23*[httpd]
I had expected at most 8 php-cgi children, having configured
PHP_FCGI_CHILDREN=8
in the wrapper script, but mod_fcgid was clearly starting multiple instances of the wrapper, so I was getting an absurd number of children.I discovered FcgidMaxProcesses and further benchmarks ensued:
MaxProc | CHILDREN | req/sec | MiB/sec |
---|---|---|---|
4 | 5 | 1279 | 4.0 |
4 | 2 | 1221 | 3.8 |
10 | 2 | 2488 | 7.8 |
The first two rows, in spite of the second only providing 40% of the available PHP children, are within error of each other in actual performance. The third line produces a total of 20 children again, but now 10 of them instead of 4 are visible in mod_fcgid for handling requests.
Clearly, there are too many cooks in the kitchen: both mod_fcgid and php-cgi (which, I should mention, was built with
--disable-fpm
) are trying to act as master, so PHP ends up wasting $PHP_FCGI_CHILDREN - 1
processes because mod_fcgid won't pass concurrent requests for them to handle.What happens if you don't configure
PHP_FCGI_CHILDREN
at all? php-cgi handles the request directly, as if it were a child to begin with, and pstree looks more like this:
httpd─┬─httpd───12*[php-cgi]
└─25*[httpd]
└─25*[httpd]
That looks rational. How does it perform?
MaxProc | CHILDREN | req/sec | MiB/sec |
---|---|---|---|
10 | unset | 2580 | 8.2 |
20 | unset | 2617 | 8.3 |
Concurrency was held the same at 16 throughout all tests today, so it looks like we've run into the limits of the 100 mbit network. (Serious benchmarking will happen once my gigabit gear arrives.) Still, the fact that performance keeps up with 10×2 children portends well; it means there's no penalty for unsetting
PHP_FCGI_CHILDREN
and mod_fcgid isn't broken without it.
No comments:
Post a Comment