Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am running apache2 (2.2) on Ubuntu on a VPS with 768MB of RAM. For some reason it takes several seconds to load any page (even static html). The only component I can blame is Apache. However, I have no idea why it is acting that way. I even installed NewRelic to see if maybe it would help me diagnose the problem in a more visual and friendly format. I see that apache2 is using about 400MB of RAM, which seems like a lot, but the total is still well under 100%. I am still confused as to what the real problem is or how to properly diagnose it.

Memory usage according to top (as asked by answerer):

Mem:    768848k total,   753380k used,    15468k free,    39792k buffers
Swap:   262140k total,    92696k used,   169444k free,   432888k cached

Results for "free -m":

             total       used       free     shared    buffers     cached
Mem:           750        733         17          0         35        414
-/+ buffers/cache:        282        467
Swap:          255         90        165
share|improve this question
    
It might be better if you run free -m next time. That way, we can see the free as well as cache memory. –  Rilindo Dec 26 '11 at 22:44
    
Updated to reflect your comment. –  bigmac Dec 26 '11 at 23:29
    
Okay, this means that you have 467 megs of free and cached memory. That is actually sufficient. BTW, is host lookups turned off in Apache? Usually it is turned off, though. –  Rilindo Dec 26 '11 at 23:34
    
HostnameLookups is off. –  bigmac Dec 26 '11 at 23:53
    
post your apache configuration file, what mpm are you using ? how many concurrent users do you have ? –  zertux Oct 21 '13 at 11:45

2 Answers 2

probably your apache is causing swapping - look on the top how much memory does it use.

if you serve just static content - skip diagnosing problems with apache all together and replace it with nginx, mathopd or lighttpd. they'll give you much better performance at smaller memory footprint.

if you serve both static and dynamic content - you can still run apache at other ip or other port and use nginx as reverse proxy to the dynamic parts while serving static assets directly from nginx.

share|improve this answer
    
I just used a static page for testing. Most content is dynamic unfortunately. I edited the original question to include memory usage. –  bigmac Dec 26 '11 at 22:19
  1. Install mod_status and grant access to the URL /server_status for your IP - so you can see what Apache is exactly doing - maybe someone is hammering your server with requests
  2. Look at pstree to make sure that the total count of apache processes is below 250 - 250 is a magic limit
  3. Review error.log and access.log
  4. Use top and type 'C' or 'M' to have a detailed insight on what your system is doing
share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.