Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a small Rackspace-hosted Debian VPS running my personal web server. In the last few weeks, there have been several times where Apache (I'm running 2.2.16) appears to be just hanging indefinitely. Restarting Apache with /etc/init.d/apache2 restart solves the problem until it happens again. Because of this, I'm pretty sure it's not a problem with DNS or virtual directory configuration (none of which has changed since well before this started happening).

Sometimes, only dynamic pages involving PHP and MySQL are affected, and static HTML pages are just slow to load; other times, all pages hang indefinitely until I restart Apache. If I have a tab open in Chrome, after a while of hanging it might error out with ERR_CONNECTION_ABORTED; if I restart Apache, it stops loading with ERR_CONNECTION_RESET.

There is nothing in /var/log/apache2/error.log other than web crawlers looking for files that don't exist. At first I thought it was a RAM problem (256 MB, I'm cheap, but traffic is on the order of a few hundred hits per day, mostly web crawlers), but swap is nowhere near full, the Apache processes are idle, and while there is very little free memory it's roughly the same after loading a few pages after an Apache restart. Performance is acceptable when it's working, I just need to figure out what's causing it to hang after a few days of uptime.

I tried reducing MaxClients and increasing MaxRequestsPerChild, but that didn't help:

 <IfModule mpm_prefork_module>
     StartServers          2
-    MinSpareServers       2
-    MaxSpareServers       4
-    MaxClients           10
-    MaxRequestsPerChild 200
+    MinSpareServers       1
+    MaxSpareServers       2
+    MaxClients            4
+    MaxRequestsPerChild 2000
 </IfModule>

(These settings, both old and new, and based on googling about - there is a ton of conflicting information on what makes for a reasonable configuration.)

Any idea how I can figure out what's going on? Where are good places to look for a potential deadlock?

Side question: since the VPS itself is fine, is there some cronjob I can run locally that will alert me when Apache starts misbehaving? (I don't need a heavyweight offsite monitoring service like Pingdom.)

share|improve this question

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.