Apache server consistently going unresponsive with CPU intensive webservices

I have several websites running on my linode (web-apps that are fairly high load on the CPU), and my server keeps becoming unresponsive and the interval between the unresponsiveness keeps getting smaller (this may be coincidental), in other words, it used to go unresponsive about every 1 month, but now its happening after about 2-3 days after I restart apache which seems like there is some kind of buildup happening that is causing this, and its getting progressively worse. I have identified that it is a problem with apache, because when I restart apache my sites go back up. When my server becomes unresponsive, I am still able to SSH into it, and ping it just fine. It don't believe it to be an issue of memory or lack of physical disk space, I doubled my server plan to see if it fixed the issue but it had no effect. I ran:````
ps -eo pmem,pcpu,rss,vsize,args --sort -pmem | less

and I can see there are many apache2 threads spawned. Here is what I saw before starting apache while my server was unresponsive still:

![](http://i.imgur.com/7492mLS.png)~~![](</s><URL url=)http://i.imgur.com/7492mLS.png<e>" /></e>

then I restarted apache, which fixed the problem, but I still see a ton of the apache2 threads

![](http://imgur.com/GyLRhT8.png)~~![](</s><URL url=)http://imgur.com/GyLRhT8.png<e>" /></e>

I suspect the issue must stem from my apache2.conf settings, which I set basically according to the recommendations of the linode docs. Here is a relevant part of my apache2.conf:

KeepAlive Off

StartServers 2 MinSpareServers 6 MaxSpareServers 12 MaxClients 30 MaxRequestsPerChild 3000
````

I am fairly new to managing the server myself, and I am unsure about the above configuration as I know it is dependent on the type of application being run on apache. I have cron jobs that are CPU intensive running every two hours, and I also have a web service on my server (built by me) that gets a lot of traffic and is also CPU intensive, given this information, can anyone point me in a right direction to try and get to the bottom of this? Thank you

Additional info about setup:

Was on linode 2GB RAM plan (had the issue) - now on 4GB RAM and problem still persists

Ubuntu 12.04 - 90 GB allocated to disk

LAMP stack~~~~

1 Reply

Try using Apache + PHP-FPM or nginx + PHP-FPM.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct