# High server load

**URL:** <https://www.ruby-forum.com/t/high-server-load/208264>\
**Category:** NGINX\
**Created:** [June 13, 2011, 6:54pm UTC](https://www.ruby-forum.com/t/high-server-load/208264 "2011-06-13T18:54:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [June 13, 2011, 6:54pm UTC](https://www.ruby-forum.com/t/high-server-load/208264/1 "2011-06-13T18:54:35Z")

</div>

Sometimes my website is down due to high server load.  
htop screenshot:  
[http://img703.imageshack.us/img703/4042/highcpupad.png](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:

> **[High server load](https://forum.nginx.org/read.php?2,206471,206471#msg-206471)**
>
> 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...

---

<div class="post-metadata">

**Author:** ![hlds](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/9fc348/32.png) [@hlds](https://www.ruby-forum.com/u/hlds)\
**Post date:** [June 13, 2011, 6:55pm UTC](https://www.ruby-forum.com/t/high-server-load/208264/2 "2011-06-13T18:55:49Z")

</div>

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:

> **[Re: High server load](https://forum.nginx.org/read.php?2,206471,206473#msg-206473)**
>
> 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...

---

<div class="post-metadata">

**Author:** ![hlds](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/9fc348/32.png) [@hlds](https://www.ruby-forum.com/u/hlds)\
**Post date:** [June 13, 2011, 7:03pm UTC](https://www.ruby-forum.com/t/high-server-load/208264/3 "2011-06-13T19:03:53Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![hlds](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/9fc348/32.png) [@hlds](https://www.ruby-forum.com/u/hlds)\
**Post date:** [June 13, 2011, 7:06pm UTC](https://www.ruby-forum.com/t/high-server-load/208264/4 "2011-06-13T19:06:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![hlds](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/9fc348/32.png) [@hlds](https://www.ruby-forum.com/u/hlds)\
**Post date:** [June 13, 2011, 9:31pm UTC](https://www.ruby-forum.com/t/high-server-load/208264/5 "2011-06-13T21:31:05Z")

</div>

dai kenapunda entha server close pani 3 month aguthu da
