High CPU usage with Apache2 and WordPress

Today I noticed that the performance of my blog was very bad, it took ages to load a page. Looking at the process list on my server I saw that the apache2 process ran with 99% cpu usage. With more requests coming in, multiple processes would exhaust the servers CPU resources. Restarting the webserver didn’t solve the problem, it went right back to full load with the first request that was coming in. Since I’ve updated some of the wordpress plugins, that I’m using, recently, I’ve started to disable them one by one –  a painful thing to do if you have to wait a long time for every page to load. Probabably I could have done this on the command line.

Eventually I disabled the WP Statistics plugin and instantly the performance went up again. Coincidentally, there was a update for this plugin waiting. After applying the update I re-enabled the plugin and everything was still fine. Unfortunatly I didn’t notice that right after the last update, so now you know why the site has been terribly slow recently.