4

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
5
  • 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, 2011 at 22:44
  • Updated to reflect your comment.
    – burger
    Dec 26, 2011 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, 2011 at 23:34
  • HostnameLookups is off.
    – burger
    Dec 26, 2011 at 23:53
  • post your apache configuration file, what mpm are you using ? how many concurrent users do you have ?
    – zertux
    Oct 21, 2013 at 11:45

2 Answers 2

1
  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
0

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.

1
  • I just used a static page for testing. Most content is dynamic unfortunately. I edited the original question to include memory usage.
    – burger
    Dec 26, 2011 at 22:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .