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
/server_status
for your IP - so you can see what Apache is exactly doing - maybe someone is hammering your server with requestserror.log
andaccess.log
top
and type 'C' or 'M' to have a detailed insight on what your system is doingprobably 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.