Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've got PHP working in fast-cgi configuration with nginx (0.7.65-2~bpo50+1), PHP 5.2.9, but I find that our busy website hangs when there is high load. The problem is immediately relieved by killing and restarting the php processes. I have 8 php worker processes, and 2 nginx workers.

I understand this is quite a common problem in this configuration, but have not been able to identify an elegant solution. Has anybody any suggestions?

Any help much appreciated! :-)

share|improve this question
    
what are the specs of the system this is running, what kind of load is "high load", is nginx only serving static files or dynamic as well etc etc can we have more information, off the top of my head id say you have nginx worker process set too low to handle 8 php processes with an unknown amount of children............. –  seanl Jul 13 '10 at 16:14
    
8 PHP workers for high load isn't very many, for a comparison I run 75 of them. –  Martin Fjordvald Jul 13 '10 at 23:00
    
What does the server load look like? Have you tried increasing the number of workers? –  Swish Jul 14 '10 at 0:02
    
seanl: we're serving around 100,000 page impressions a day, using drupal (which is fairly high overhead). Martin F: I've increased it to 75, let's see how that goes. How many nginx workers are you running? Swish: Server load is usually quite low, any heavy duty work comes from MySQL. –  chrism2671 Jul 14 '10 at 15:42
add comment

2 Answers

up vote 1 down vote accepted

I found having less PHP instances, or at most as many PHP instances as nginx instances, improved stability dramatically.

Unfortunately, and it pains me to say this, but after many months of running a high traffic website under this configuration, I found it better to redeploy it on EC2 running Apache + mod_php, which is rock-solid. Because it's on EC2, I can scale the amount of juice required (even if this is more than nginx). So although it may cost more, it substantially reduces the amount of maintenance effort involved in getting it to work.

It's a shame really because I honestly hate apache and love nginx but what can I say?

share|improve this answer
add comment

I have 5 nginx and 6 phpcgi working processes. It uses ~400MB RAM and serve a 30K/day Drupal website. Hope this helps.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.