Fast CGI (spawn-fcgi / php-cgi) crashes/dies/hangs
Michael Shadle
mike503 at gmail.com
Wed Dec 9 15:39:02 MSK 2009
On Wed, Dec 9, 2009 at 4:24 AM, miradev <nginx-forum at nginx.us> wrote:
> The reason for not using Apache for WP is twofold. Firstly, apache has a higher memory footprint making it unsuitable for us to scaling down to, for example, a 256MB slice. Secondly, I don't want it sharing the large apache threads and I haven't found a way of reliably running a second apache configuration alongside.
Exactly. mod_php will make each Apache thread or process larger, even
if it's just serving up static files in that thread for a while.
> What I have learnt, from reading this thread, and some more web content, is that there is nothing wrong with my setup. I'm pretty happy with apache and fcgi in a stand-alone situation. So I am going to stick with ngnix+php-cgi. Which means I need to manage/admin things better.
You shouldn't need two webservers or even worry about it. nginx is
super fast and lean for static files and also probably the leanest
when it comes to processing PHP [passing the request off], assuming
your backend FastCGI process manager is not wasting resources and you
compile or use as little PHP built-in modules as you need. (My install
has a handful of built-ins, I tried to split off some into shared
modules though, but I also don't run things inside of a small VPS :))
It would be interesting to take a benchmark of memory used for
something like Apache+mod_php vs. nginx+PHP-FPM or nginx+spawn-fcgi
and set the number of processes for PHP the same in both and see
memory usage after hitting it with some load for a few minutes. As
close to an apples and apples comparison. Of course, Apache will
always be spawning more full threads/processes for additional load
whereas a standalone FCGI process in PHP will only be loading a PHP
process to service more load. So in theory, it should be more
lightweight off the bat, at least when it comes time to increase the #
of concurrent requests you can process.
> The advice I will take is to install supervisord on my dev box and learn how to manage my php-cgi processes properly. One crash in 6 months is not indicative of a systemic problem.
Everything breaks. Especially technology related. Once in 6 months
isn't bad at all IMHO :)
More information about the nginx
mailing list