How an uninstalled WordPress Plugin can cause performance problems

(Be sure to checkout the FREE SQLpassion Performance Tuning Training Plan - you get a weekly email packed with all the essential knowledge you need to know about performance tuning on SQL Server.)

Yes, it can happen sometimes: you install a WordPress plugin for your website, and after some testing period you don’t like it. Therefore you uninstall it. Very simple, very easy. Unfortunately the reality is a little bit different as you will see in this blog posting.

My website was slow, very slooooow

As you might have also encountered, my website http://www.SQLpassion.at has been quite slow over the last weeks. Sometimes the loading of a simple blog posting took 5 or even 10 seconds!

My website was slow, very sloooow...

At the beginning it was really strange. I talked to my web hoster here in Vienna, and they hadn’t changed anything (as usual). I also hadn’t changed anything, so I was puzzled: you sell performance related training and consulting, and your own website is terribly slow, and sometimes you even have timeouts from the MySQL database – this doesn’t really fit very well with a SQL Server consulting business…

The troubleshooting process

In the first step of some more detailed troubleshooting my web hoster moved my WordPress installation to a physical machine. Previously http://www.SQLpassion.at was running on a virtual machine, and of course other virtual machines can cause side-effects in your own sandbox, when they run CPU or I/O intensive work. After the migration nothing positive happened: the loading of every website/blog posting still took around 5 – 10 seconds. Just unbelievable on a bare-metal installation without any other side effects! Of course in the next step my web hoster pointed his finger at me: it’s not my hardware, it’s YOUR WordPress installation! Every time you requested a blog posting my website hoster also saw a CPU spike of 100% over 5 – 10 seconds. Terrible, terrible, terrible…

At the beginning of the year, I had rebranded http://www.SQLpassion.at and I had installed a custom developed theme from a WordPress developer. So I disabled that theme, and switched to the WordPress default. And of course – nothing changed – the performance was still unbelievably slow. Therefore I took my time and disabled every WordPress plugin that I used on my website – there were around 15 – 20 different ones. And again: with a default WordPress theme and with all plugins deactivated everything was still slow. It’s not my WordPress installation, it’s YOUR hardware! My web hoster pointed to me – I pointed to him – the classic deadlock situation!

The root cause

I really freaked out, because I had no idea how to proceed. I have personally almost no knowledge of the LAMP stack (Linux, Apache, MySQL, PHP). Therefore I talked to my friend Google: how can a default WordPress installation cause a 100% CPU spike over several seconds?

After several hours of research time, the following question popped up from StackExchange.com. Oh yeah, I’m not alone with such strange WordPress behavior! It seemed that I have a problem with cron jobs in WordPress. A cron job is just a scheduled job that runs regularly in WordPress. Because I had no direct access to the MySQL installation (I don’t want it, because I know how bad my SQL statements are), next I installed a simple WordPress plugin that showed me how many cron jobs I had.

WOW! I had more than 100 000 cron jobs in my WordPress database over the last few weeks. It seemed that a WordPress plugin created a cron job every time that a blog posting was requested. The crazy thing was that this plugin had already been deinstalled several weeks ago! When my web hoster finally looked into the wp_options table in MySQL (where the cron jobs are stored), he just found 1 simple record: that record consisted of a BLOB column, where the individual cron jobs were stored! And finally he deleted that record. The rest is history: http://www.SQLpassion.at is now fast again, very fast!

Summary

You have to be very careful about which WordPress plugins you install, and what they do within your MySQL database. Even if you deactivate or even deinstall a plugin, it doesn’t mean that *everything* is deinstalled. Some plugins just leave their mess in the database, and this mess can cause you horrible performance problems.

That was the second horror story that I encountered and finally solved over the quiet summer months .

Thanks for your time,

-Klaus

1 Comment

It`s your turn

Your email address will not be published. Required fields are marked *

SQLpassion

Copyright © 2015 by SQLpassion · Klaus Aschenbrenner · Imprint · Offerings · Academy · Contact · Go to Top