WordPress Plugins Performance Impact

WordPress plugins, what are they, what do they do and why should you care?

Plugins, some of us love them, some hate them and some can’t live without them. I have worked on more than a 100 wordpress built sites in the last 6 months, optimizing, converting from PSD and maintaining some of my clients sites. Whether my clients knew it or not, each site that I worked on was ultimately leading to this point today.

I have seen every plugin you can think of in action and I have come up with a conclusion and a set of points for you to consider before jumping to the plugins department, downloading and activating. But first, let’s take a look at what plugins actually do.

Plugins for this plugins for that

The shortest explanation of what a plugin does in WordPress is that it adds additional functionality to your site, extending what WordPress can do, but they can also transform and mold the entire structure of the site, turning it from a blog to a forum, members site or social network.

The longer answer to what plugins can do is a little more important, the vast majority of WordPress users simply don’t realize the impact that plugins have on their sites and often blame the host instead.

Let’s be real, if your looking to build say a forum and this could be using any platform you can think of, Vbulletin, wordpress or some of the open source forum scripts and expect large or even moderate numbers of users, you should ask yourself a question.

Does $3.99 a month sound like something that can power this idea?

The answer is probably not. Shared hosting is designed for small site, with little traffic, or for sites that have minimal functionality, say a site with just text and a few images.

Shared hosting on the other hand isn’t designed for busy sites or sites with complex functionality or extended features that require plenty of power behind it.

Think of Newtons 3rd law

“To every action there is always an equal and opposite reaction”

So how do plugins affect your site?

Plugins affect your site in many different ways. Almost all plugins have a few things in common.

  • They come with additional CSS and JavaScript

This means they add additional requests to your overall HTTP requests. It also means that you can bet your ass that they plugin is also going to enqueue the JavaScript in the head of your page. Not all plugins do this, but the overwhelming majority do and this means that you have yet another piece of JavaScript to parse onload ultimately blocking the rendering of your page for a brief moment and in some cases seconds.

Avoid Plugins that come packed with a ridiculous amount of JavaScript and CSS files, you can find out how many scripts it comes with by downloading it, extracting the files from it on your computer and take a look at what your adding to your site. If it looks big, it’s generally because it is.

Consider what this plugin is going to do, if it’s job is to add a check box for subscribing to comments and yet its got 16 different files then something is way off.

  • They love to query your database

Almost all plugins query your database, some more than others. The number of queries is very important as this can seriously affect your initial load time.

Sometimes you may be loading your site, you see the indicator in your browser saying that something is happening, the site is loading but you don’t see anything, then all of a sudden your site throws itself at you. If this happens all the time, then it is because you have a lot of queries and resources to fetch before the page can even think about rendering.

If however, your site loads progressively, it’s initial load and the rest of the load is similar then you need a bigger server to process all the data.

How do queries effect your initial load?

When you originally install wordpress it establishes a database with all the basic tables required to run WordPress. The default engine used is something called MyISAM, this is the original engine used to run mysql databases. In recent years though other type of engines have come in to being, most notably InnoDB.

There are many differences between the two engines but the one that is most important to me is it’s locking mechanism.

MyISAM uses table locking

InnoDB uses Row locking

Now think about it, each time you query your database it has to find the information your looking for, or cross reference information before presenting it to you. The most notable plugins that cause extraordinary delays in load times are plugins like Yet another related post or plugins that require a compilation of statistics to present something like a top commentator  plugin.

These types of plugin literally spam your database with queries, the worst part is, that the bigger your site becomes, the more posts and comments it has to cycle through to produce the results.

Now let’s add in to that mix the idea of table and row locking. While your queries are being processed using MyISAM the entire table is locked until all queries are fulfilled.

So combining the two thoughts together we have somewhat a problem. As an example I will explain the process in a simple round trip.

Site starts to load. Queries sent to the database to fetch the information and content. Sites still loading…..

sites still loading…..

ah that’s right, wp_post table is locked because YARP is still figuring out what posts are related to your post.

When the table is locked, other separate queries cannot be executed at the same time in the same table.

This is where InnoDB comes in to it. InnoDB uses row level locking, which means that multiple queries can be run through the same table at the same time and thus reducing the wait time.

But simply changing the database engine does not justify the number of queries these type of plugins send to the database, it’s excessive and requires a good amount of power to process them all.

Imagine if you have 200 posts, that’s 200 queries there just to find out what 5 posts are related to 1 post.

Now imagine that 10 people enter your site at the same time. That’s 2000 queries to crunch through. Keep scaling it up and you can see that there is a problem. This doesn’t even include the native queries for wordpress or any other plugins you may have. If you intend to use such plugins with high resource usage then you will need to host your site on a bigger more powerful server just to load the site in a reasonable amount of time.

How can we find out how many queries we have?

Godaddy created a very useful plugin called P3 profiler which allows you to find out which plugins are causing you problems by letting you know how many queries are being submitted to the database and then displaying how much time it takes for the plugins to load.

I would recommend using the manual scan otherwise it will run through all your posts and pages and you don’t want to do that if the site is really big.

So here is a quick run down of what this plugin does and how to use it.

Step 1 – install the plugin and activate

Step 2 – go to tools and select P3 Plugin Profiler and a page that looks like this should appear.

Click to view are larger and clearer image

As you can see the number of plugins are listed.

Step 3 – Select start scan, a pop up will appear. Remember to select manual scan. Once your site loads in the pop up box, select im done and wait for the results.

Click to view are larger and clearer image

You can see that on my site I have;

  • 15 plugins
  • plugin load time 0.717 which equals 77% of my load time
  • 25 mysql queries

In terms of performance, my results are very good. 25 mysql queries is completely acceptable and well within the capacity of my server.

Also bare in mind that the more posts you display on your home page the more queries will be created. Some sites I have worked on have 60 – 70 posts on their home page laid out using jquery to slide the posts up and down. This means that each load of the site will send 60 – 70 requests to your database plus any queries related to plugins and other features.

Summary

I just want to help clarify what has been discussed here and highlight some points to consider.

Remember that each plugins equates to more requests and more requests equals slower load times, especially on shared hosting.

Consider the resources you will need in order to run your site. Shared hosting is a great starting point and I would recommend Web Hosting Buzz or Hostgator for starting out. If however you intend to build a heavy site from the get go, then consider jumping straight to VPS to ensure that you have sufficient resources to handle your site and traffic.

Never blame the host for poor performance on your site. 99% of the time the problem lies with your site, shared hosting especially only permits limited resources for small sites, or sites with little additional scripts.

When installing a plugin, ask yourself, does this server to promote your goal? or does the added penalties to load time justify its need and purpose?

Finally, be conscious of your site, be aware of your resources and the power you have to run your site. Again Newton summed it up really well.

“To every action there is always an equal and opposite reaction”

Meet the Author

Matthew Horne

Matthew Horne is web developer who specializes in optimized development. He also builds custom solutions instead of reverting to plugins. Matthew Has a strong understanding of PHP, JavaScript, jQuery.

9 comments… add one
  • Larry James Sep 24, 2012, 5:35 pm

    I am one of those people who just love WordPress plugins. On my blog I am running 36 different plugins. I know that this is too many, and I want to improve my page load time. I will try P3 (Plugin Performance Profiler) to see which plugins and using the most resources, and try to eliminate a couple.

    • Matthew Horne Sep 24, 2012, 6:10 pm

      Lol Larry, at least thats not the most ive seen, 53 was the most ive seen on one site, my jaw hit the floor when I saw it after the client was saying there site was just soo slow. But it’s not the client or persons fault, if you dont know you don’t know, but also if your server can handle it under strain then thats ok too. It’s each to their own, but I try to provide people with the information required so they can make an informed decission about what to do. Bigger server, less plugins ect

  • Sanjeev | Makewebworld Sep 24, 2012, 7:44 pm

    Wordpress is so great because of the thousands of available plugins. But I agree excess can be damaging and if you don’t even think what you want to achieve. I have seen sites loading 2-3 similar plugin with redundant functionality.

    I prefer backhand plugins rather than fronthand, at least they just slow the site for me but my readers does not feel much delays…

    • Matthew Horne Sep 24, 2012, 7:51 pm

      There are good plugins and bad plugins, the plugins I used show that even with 15, it only take 0.7 seconds to run them. Which is no time at all. But I do have vps also and modified some of the plugins to load the scripts more efficiently, but some plugins are really bad and cause untolled damage to your site, slow sites can put people off, they may never return. So it’s about asking that simple question, does the plugin benefit your overall goal and targets, if it doesn’t then its not worth having.

      Regards

  • Michael Aulia @CravingTech.com Sep 25, 2012, 3:41 am

    I’ve recommended that plugin to my readers too; most bloggers on a shared hosting must have experienced a suspension because of a high CPU usage 😛 the P3 plugin is one of the plugins you should install to flush the naughty plugin out

    I used to have 50 plugins active but now down to 30.. still a lot, I know but it’s hard to get rid of them

    • Matthew Horne Sep 25, 2012, 12:53 pm

      I have worked with many clients who have been suspended due to high resource consumption which can slow down the entire server cluster effecting other sites. It’s tough but where possible they should be removed unless its crucial to your site and business.

  • bbrian017 Sep 25, 2012, 3:45 am

    Hi Matt, you know ti’s so funny, or maybe not but for the longest time I tried to find what pligg module was causing my high server loads and found out it was in fact the wordpress plugin about author. The plugin was no longer supported I guess so obviously I replaced it and so far it’s been great. I’m sure if I was to remove some of the modules and plugins I would be able to even downgrade my dedicated server lol…

    • Matthew Horne Sep 25, 2012, 12:54 pm

      Lol Brian, its amazing what these little buggers can do, poorly coded plugins can be hard on your poor server.

Leave a Comment