Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is a question about the correct process for trouble shooting Apache performance problems.

Some context. I run an Ubuntu 8.04LTS Virtual Machine with 360MB RAM. This serves LAMP websites; mainly based on Wordpress.

It doesn't get a lot of traffic (15k visits/month, 200k hits/month). But occasionally Apache goes beserk, consumes 100% CPU, thrashes the disks and generally causes the machine to grind to a halt (== doesn't serve webpages, won't respond to SSH commands etc)

So, my question is, how do I prepare to collect the correct information that will allow me to debug this kind of problem?

I'm as interested in the process as in the tools.

For example; the mysql slow query log seems like a reasonable way to debug slow SQL queries. Is there something similar for Apache? Is there some kind of logging tool that will show me which requests are the slowest / use the most CPU/memory? Or is this the wrong approach?


share|improve this question
up vote 0 down vote accepted

share|improve this answer
This article suggests extra data that you could put into the Apache log to get more information about individual requests. With specific applicability to my question above was this titbit: "The %T and %D directives refer to the time it takes to handle the entire transaction, including the amount of time it takes for the client to transmit data. If you see wide variances in the amount of time it takes to serve the same file, it may be related to a web client network problem." Of course this still leaves you with the problem of how to monitor the log files and identify slow requests – David Laing Aug 5 '09 at 13:18
I would just tail -f log files in an ssh screen session. Justin does bring up a good point. This is more of a symptom of the problem than the problem itself, and this is often caused by apache consuming too much memory. See for more apache tuning tips. – Boohbah Aug 6 '09 at 14:34

Boohbah's answer will get you what you're asking for, but I think you might be asking for the wrong thing.

Slow requests via Apache isn't the problem, it's the effect. It sounds as though you've allowed Apache to consume too much memory, which then your box starts swapping, thrashing the disks. Tuning Apache is an art, not a science, so there's no copy/paste config that works for everyone, but here's a good article to get you started: Tuning LAMP @ O'Reilly.

Once you're done with that, look at setting up Munin to monitor your memory and CPU load.

share|improve this answer

Your Answer


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.