High server load

Sometimes my website is down due to high server load.
htop screenshot:
http://img703.imageshack.us/img703/4042/highcpupad.png

Sometimes there are php5-fpm processes that take 100% CPU. Why? It
slowes down everything. I also get mysql database errors (too many
connections).

How can I determine what causes this?
thanks

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,206471,206471#msg-206471

one more thing: If I have such a high server load I usually do a
php5-fpm and nginx restart. That helps for some hours or days until it
comes again…

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,206471,206473#msg-206473

it’s mostly php and mysql related not nginx.

try to debug the php code that is running (f.e. with xhprof to check
which part of the code consumes the cpu time) and search for slow
queries in mysql (you should enable logging slow queries in mysql’s
configuration). then you should optimize php code and sql queries
(first try with
http://dev.mysql.com/doc/refman/5.0/en/using-explain.html).

‘show processlist’ as an sql query can help you bring closer to the
solution quickly. adding indexes to tables can be a quick fix to most
of sql related performance issues if not already added and the queries
seem ok.

gl, kornel

try to spawn more php processes and set max requests per process (of
fast cgi) lower and not 0 which means never respawn.

max requests per process (php-fpm.ini) will quit php processes after
serving the given number of requests, so memory leaks are more
supressed.

dai kenapunda entha server close pani 3 month aguthu da

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs