I’ve been wondering about WordPress plugin overhead for some time. How does one keep track of how much processor time and overhead any given plugin requires?
We run fairly streamlined WordPress installs at Foliovision with about 30 active plugins per site. A lot of them are one-trick ponies developed in-house so we know the code isn’t creating a huge load.
But anyone who has been working on Macintosh computers from the old days (System 7, 8 & 9) knows very well that every extensions (and some people were running 50 of them) slows down your compuer and increases the chances of a system conflict. There were whole expensive utilities devoted to keeping extensions and control panels under control. Any one else remember long hours spent with Conflict Catcher?
conflict catcher screenshot
Here’s what WPdesigner.com has to say on his own plugin issues:
With the WP Download Monitor plugin, the front page of my blog had to operate with 136 queries on every page load. After uninstalling that plugin, the front page needed only 10 queries to work. 136 versus 10 and all I have to do is give up tracking the downloads, hmmm.. oh what, oh what should I do? I deactivated / uninstalled it, of course.
So some plugins are clearly worse than others. I hope I didn’t publish that post recommending Lucia’s LinkyLove for DoFollow. In the comments to the post above David Airey notes.
I found the real culprit – the LinkLove plugin for DoFollow comments.
By de-activating it I’ve dropped the queries from 117 to 24 on my blog post with 46 comments.
Lucia’s LinkyLove plays complicated games rewarding commenters for more comments with better links. A pox on this sort of brownie point system. I will get DoFollow turned on and will rely on Akismet and common sense to keep the spammers off. Everybody else is welcome to followed links.
Ironically enough David’s post recommending Lucia’s LinkyLove still stands and is ranked high – that is not taking very good care of one’s visitors. Perhaps he just forgot. Even more ironically, Lucia publishes another plugin to track CPU greedy plugins. I don’t recommend this plugin, as it is ugly and is less useful than adding a simple PHP tag to your footer to track both database queries and CPU time.
<!--<?php echo $wpdb->num_queries; ?> <?php _e('queries'); ?>. <?php timer_stop(1); ?> <?php _e('seconds'); ?>.-->
At this point you can load any page on your weblog and check the number of database queries and the CPU time just by viewing source. If you are really on a roll, you can remove the html comment markup from around the PHP tag and you will be able to see the load times and database queries without checking source. So will your visitors, but for a half an hour of quick testing it really doesn’t matter.
Here’s the PHP code alone:
<?php echo $wpdb->num_queries; ?> <?php _e('queries'); ?>. <?php timer_stop(1); ?> <?php _e('seconds'); ?>.
So with 30 WordPress plugins running, what’s the damage on Foliovision.com and client sites?
wordpress database queries cpu time
On Foliovision.com, 37 queries. 0.465 seconds for the home page and 30 queries. 0.506 seconds for a single post. The client sites are mostly in the same thirtyish queries neighbourhood. Clearly in there are a couple of plugins which are borderline greedy. I’ll have Peter do some tests on Monday. For comparision, with over 41 plugins, Saman’s install requires over 1.6 seconds to generate a page.
Generally I am happy about this result. It means the base FolioPress suite is quite efficient. Efficiency in coding is very important to me. Alas, the big three in OS have quite forgotten about efficiency: MS Windows, Apple OS X and KDE are all horribly inefficient: I have to run a quad processor to get decent performance out of Apple. Absurd. But malicious inefficiency in coding is a subject for another post.
How important is it to avoid greedy WordPress plugins? If you get little or no traffic or you are on a dedicated server, it’s probably not all that important. But if you are on shared hosting (broken link – http://www.ngtech.gr/blog/en/programming/php/turbo-charging-wordpress-or-how-i-made-my-wordpress-blog-1000-faster-2006-10-21.html) and you ever get Dugg, Slashdotted or listed at Yahoo, watch out. Your hosting may be disabled for a week due to the one or two errant plugins.
Here’s a small case study of a plugin gone bad: Comment relish issues #1, #2 & #3. This one has a happy ending as the plugin was eventually repaired and made useable.
Alec has been helping businesses succeed online since 2000. Alec is an SEM expert with a background in advertising, as a former Head of Television for Grey Moscow and Senior Television Producer for Bates, Saatchi and Saatchi Russia.
Thanks for reminding me of my post on the LinkLove plugin.
I’ve updated the article now to mention the resource usage, and how I’ve since uninstalled the plugin.
You’re right. I should’ve done that as soon as I discovered the issue.
All the best.
Great post, especially the piece of code to help you find out how many queries are being made.
I have to admit I’m a little lazy when it comes to things like this. I pretty much go by the “if it works don’t fix it” idea. This is a nice quick way to see if there is a problem before the site breaks.
I had no idea the Download Monitor plugin does so many queries. I have it installed on my blog for such a long time and I didn’t notice any performance issues. I didn’t test either :) I like the plugin a lot. … hmm I should find some time to test it and fix this one too :)
Thanks for stopping by. Loved your sleuthing on the issues with large static sites with lots of pages (we build CMS not weblogs) in WordPress.
We will get on that bug as well. I’d like to see it fixed and we can repair the code too. We’ll look at your fix and then let’s put together a campaign to get this fixed in the next version. It’s really inexcusable. Slow page loads in the page manager really are a nuisance for our own editing as well.
No excuses that this bug has been out there so long.
Bad, bad Automattic. Matt Mullenweg what are you thinking of?
There is already a ticket opened for the bug after I reported this: core.trac.wordpress.org/ticket/10852 . Seems like it’s going to be included in wp 2.9
Thanks for the link to the thread. Expect to see us on that thread in the next couple of days.
Great news that it will be rolled into WordPress 2.9. Optimisation should keep happening. Good catch.
Thank you so much, exactly what I needed!