WordPress Performance: How to Find a Slow Plugin
One common problem with Content Management Systems including WordPress is that they are usually slow. The quick fix to a slow WordPress site and any other Content Management System is to enable a cache system.
But there are cases where increased traffic leads to slow site despite the existence of a functional cache system. In this article, we shall address this issue with slow WordPress plugins.
One plugin can slow down the entire site. We shall look at the P3 (Plugin Performance Profiler) and how it can be used to identify a slow performance plugin on your WordPress website. With P3, you'll be able to see each plugin performance on the site.
In the admin, go to Plugins, Add New.
Search for P3
Click Install Now and than activate the plugin.
Running the First Scan
Go to Tools and; P3 Plugin Profiler.
Click Start Scan
Enter a scan name (no spaces).
Click Auto Scan
If only certain pages are giving you trouble, you can do a Manual Scan and navigate to those pages in P3.
You'll see a message, Scanning is complete
Click View Results
Along the top, you'll be able to see some overall stats for your plugins. You'll see breakdowns per plugin.
Runtime by Plugin: This is a pie chart showing a percentage of each plugin total. If you hover over each part, it will also show the time of each.
Also, it shows the load time of the WP Core (in blue) and your theme (in red).
The gold line across the top is the total load time of the site. If under one second, you're in good shape. If it's over two seconds, and there's one plugin that's taking up most of the load time, that the slow plugin.
Hover your mouse over each dot to see which page was tested.
If one or more of the pages takes significantly longer than the others, you can run a manual scan for it to find the offending plugin. Or, use the Detailed Timeline, which we&#39;ll show you next.
Each dot that's lined up vertically is for a specific page. Hover your mouse over a dot to see the page URL.
Generally, the more queries, the slower the page load. If some of your pages are getting thousands of queries, this is likely why they are slow.
You can hover your mouse over each bolded term to get more detailed information.
Based on the above data, you should be able to see a plugin that taking significantly longer than others to load. If it's accounting for 50% or more of your total load time, there's cause for concern.
To resolve the issue, report it to the plugin's developer. The developer will be able to look into it in detail and provide a solution.
If it is not an essential plugin for your site, you can temporarily deactivate it from Plugins Installed
How Plugins Affect Your WordPress Website Speed
WordPress speed performance are affected by three major components
- Speedy managed WordPress hosting: Investing in fast hosting like Todhost offers is one of the simplest ways to get a big win here
- Streamlined code in your theme: Googling for free WordPress theme is not the best way to find a well-coded theme that loads quickly.
- Installed plugins: This is what we have focused on in this post. Every plugin adds a bit of complexity to your site, and it's important to install well-developed plugins from a reputable source.
Plugins allow site owners to exert very specific control over site performance because plugins are simple to swap out and exchanged for one another. Installing and enabling is as easy as uninstalling and disabling. If one plugin is slowing your site down, you can find a faster one or remove it altogether. In general, you always want to have the fastest set of plugins possible for the features you want the plugins to add.
Can Your Installed Plugins Be Too Many?
There is a common refrain heard in the world of WordPress, spoken at groups and written in blog posts that you want to run as few plugins as possible because having too many plugins increases the chances that your your website will be slowed down. This isn't really wrong, but like anything that has to do with development, there's a bit of nuance and subtlety you can dig into.
Yes, more plugins will add more code that a browser has to load, which can slow it down. And to paint with very broad strokes, a website with a simpler codebase will usually load faster than one that is complicated, all other things being equal. Since plugins are basically a way of adding code without having to write it yourself, telling new WordPress folks think to run as few plugins as possible is not a bad idea. It keeps people from installing 10 different Facebook plugins that all basically perform the exact same functionality.
How many plugins will be too many?
Popular WordPress developer Pippin Williamson says the trick isn't how many plugins you have, but what operations they need to perform in order to render your site in a visitor's browser. Most plugins are pretty simple, but some will perform complex actions that are expensive in terms of backend processing, and will slow a website down. In other words, you could have a quickly loading website with 80 plugins, and add a single, complicated plugin and lose half a second (or more) of loading time!.
According to Pippin, there are four major areas he looks for when he evaluates adding a plugin to his website.
Does it load lots of scripts, styles, or other assets?
Does it add extra database queries to each page?
Does it perform complex operations?
Does it perform remote requests, like to external APIs?
Also read: How Not to Hurt Your Visitors When Using the WordPress Maintenance Mode.
Plugins That Load a lot of scripts, styles, or other assets on pages.
There are two ways to speed this process up. The first is to stop plugins from loading certain things altogether. Some plugins are set to load files on every pageload, even when they aren't necessary for that page. You want to specify when the file is loaded.
The other way to speed pageload time is to load the assets either asynchronously, or even after everything else has been loaded on the page. A good example is loading Google Analytics asynchronously so that it doesn't block other requests from loading in the process. Google Analytics is essential to your website SEO, but it's also a big file, so you want to make sure it can be loaded at the same time other assets are loaded, rather than in serial, so it would hold everything up.
Plugins that add extra database queries to each page
Database queries have a large impact on performance, and plugins can make a lot of these requests if the plugin author wasn't careful. For example, plugins that track post/page views by storing a value in the database every time a page is loaded will dramatically impact performance over time because the server has to make an additional MySQL request for that number on each page.
Now, the number of page views or comments on a post can be important to display, but it is not a mission-critical enough to hit the database every time you load a page. In order to reduce this, you can reduce the frequency a plugin queries the database, or kill specific database requests altogether and save the processing power in addition to speeding your site up.
If a plugin is making a lot of database calls, it is important to evaluate the importance of that plugin's functionality and weigh it against the speed of your site. If you can find an alternate plugin that makes fewer database calls, you may consider using that one instead. A good developer will be able to help you work through questions like this.
Plugins that need to perform complex operations
Plugins that query large amounts of data and then perform an action with the data will impact performance. In general, plugins that perform overly complex operations should do them off server, and not in your WordPress hosting environment.
Good examples of this are the class of Related Posts; plugins that create FULLTEXT indexes on the posts table in MySQL. These queries become increasingly problematic as sites get larger and larger because the FULLTEXT index will continue to grow as well. At run time, the index will consume huge amounts of resources. Over time, the site slows and in extreme cases can crash the server if it runs out of threads.
Plugins that perform a lot of remote requests
This can include requests to external APIs from 3rd party services, and the like. Anything where your site needs to make an external request in order to run can impact performance
Again, this comes down to the number of requests that have to be made by your site before a page can load. The more times you have to request data from an external API, the more times you have to wait for a response from that API.
You can have plugins that request data from external APIs (earning reports, page views, etc.), you just want to ensure that they don't adversely affect performance by caching the requests. Caching the request will mean that the request doesn't have to run every time you load a page, which will save you a great deal of time.
Breaking this down, the number of plugins is less important than their quality. When you hear folks tell you, running fewer plugins will make your site faster, that's not 100% true. Sometimes a single plugin can make all the difference in pageload time because it loads too many scripts, or hits the database with expensive requests
If you think your site is loading slowly, and a plugin may be the culprit, we have explained a very simple way to test this out, and you don't have to be a hardcore developer to do it. Another very simple way to check for unscalable plugins will be to deactivate all of them from the plugin menu in the wp-admin and then load your site. If the site loads faster, you know that there was an issue with one or more plugins. Now, activate the plugins one at a time, loading the homepage every time to narrow down which plugin is causing the slowdown.
Once you've discovered which plugin is the culprit, it's time to find a replacement.