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?