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 have 2 frontend nginx servers going to 4 backend php-fpm servers which all run Wordpress. The php-fpm servers all connect to one MySQL server and I was checking some stats earlier each php-fpm server has 15 php-fpm processes which is fine, however the MySQL server has between 60 - 150 processes which are shown when I run show processlist; when the number reaches 160 processes on the MySQL server the php-fpm servers seem to crash and I get a nginx 504 error.

Is this due to the php process hanging while it is waiting for the MySQL query to finish, but because MySQL has too many processes it takes it's time and locks up. I am only guessing here but could this be the issue ?

Also could alot of open connections to MySQL from PHP-FPM be an issue and why I am getting a nginx 504 error, I am guessing that if I have 150 processes going to MySQL alot of them might still have open connections. I have checked and all the processes from running show processlist; don't have a time value over 1.

share|improve this question
2  
The scope for an answer of this question is far, far, far too broad. You've got multiple levels of optimisation that you need to approach here - and all are specific to your needs. From the TCP/IP stack to userland apps (MySQL/PHP). Short of people giving you generic advice - you're not going to get an accurate solution here. –  Sonassi Oct 5 '12 at 14:37
    
I agree with sonassi. Can you please give us more details about your setup? –  Sibin Grasic Oct 27 '13 at 23:25

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.