Squashing Wodrpess Performance Bugs

I think I’ve finally managed to trace down and smite all the things that were making my site so Gawd awfully slow. I had finally been annoyed enough by 30 sec loading times that I just had to do something about it.

Initially I thought it was with my host, and I did contact support about it via Email. They did check out the MySql slow logs and noticed some strange queries from BadBehaviour, but when this little plugin blocks around 1000 bots per week, it’s not worthwhile to disable it :).

In Dreamhosts’s opinion I should try and disable my plugins and then switch to another theme to check. Well, even though it was painful, I did it but it didn’t really make much of a difference. My site still seemed to be slow. However a test site I created had a quite normal speed. Perplexing

Initially I thought that it might just be the difference in DB size and indeed, my other WP sites, which have much less content that this, seemed to be loading faster (albeit slightly).

Fortunately a few google searches led me to some good content. Initally I discovered Firebug from a post explaining how it can help you diagnose WordPress performance issues. That was quite helpful to tell the truth. I managed to immediately spot that the WordPress Automatic Upgrade (WPAU) and the Popularity Contest were severely slowing down my Dashboard. I also found a few items in my theme that were just taking too long to load (like my FSF badge for some reason). Disabling them dropped the load time but I still had a problem.

You see, for some reason there is a 5-9 second loading time from the time I click on a link, to the time the page refreshes and starts to load. Firebug, unfortunately, will not give you any information on what is causing this, other than to tell you that the link is loading. It will not even take into account this initial loading time when giving you the total load time of the page (thus a page taking 13 secs will be reported as taking 4.5). Since this loading time dissapeared

This meant that I had no idea what was causing it, so back to the search I went. This time I managed to find a more interesting post on Improving WordPress performance which not only gave some great info, it linked to some other sources. Unfortunately, most of the tips given were to be used on a private server and were not really applicable to a shared hosting service like mine. Of course, this person was talking about receiving 500.000 hits a day, whereas I’m barely receiving 3000…a month. Still I applied the wp_config.php edit although it didn’t seem to make much of a difference.

My final hint came from wolfie who advised that I remove all widgets and links that point to other addresses as these may increase the loading time. I did that and I also took down the Popularity contest as well, just to see the results.

It seems it worked. The initial loading time has dropped to around 4-5 seconds. Although I don’t have as much bling in my site anymore, I am hoping that the increase in speed will make up for it. Unfortunately 4-5 secs is still quite bad and while I still don’t have any idea where to look in order to fix that, it’s at least better than 6-9 secs + 4 secs of extra stuff. With the WP-Cached page, the load seems to be instantanteous OTOH so at least that helps. Still for a ~100 hits per day, it certainly should not happen.

As an aftereffect, I decided to finally update this site to WP 2.5 as the functionality of Popularity contest was the only thing preventing it. At least I now have a snazzier Dashboard :)

After improving my performance I decided to also start a WordPress Performance page on the dreamhost service wiki. I would urge all of you, Dreamhost customers or not, to take a look and improve this page so that others that have similar issues can find a focal point to troubleshoot. I also hope to see tips specific for Dreamhost shared hosting customers eventually.

If there is a good WordPress improvement page or tips that I should check btw, feel free to let me know. Also, if you have any idea what causes these ~4 secs of initial loading delay, I would be really glad to hear it.