Perhaps the most dreaded discovery for any webmaster is finding out your website just isn’t as fast as it used to be, or in your eyes, as fast as it should be. All too often webmasters and site owners fall into the trap of thinking their software can scale indefinitely without any optimizations and without being mindful of the plugins, themes, or addons you’re installing. This is a particularly common problem with WordPress and as a result we’ve found a few basic debugging steps can go a long way in finding out where your sites bottlenecks are and how to fix them.
WordPress is great…until it isn’t!
WordPress is, unsurprisingly, the single most popular piece of software our customers rely on to build their websites. From a simple blog to a full on e-commerce shop you’ll find every type of WordPress site on our network. Whether you’re a true beginner just looking to create a basic website or a full on webmaster customizing every aspect of the site WordPress can do whatever you need. That flexibility and robustness comes at a price if you’re not mindful of what you’re really installing and running.
If it’s so popular then how can it be so bad?
WordPress, at its core, is a mature product and really well developed. Each new release brings popular features, performance & code improvements, and usually a cleaner look to make your site feel modern. The problem is not with WordPress itself but instead how you configure your installation.
Due to its popularity there are literally thousands upon thousands of unique themes and plugins available for WordPress, and most of them are completely free. This ecosystem makes it a little too easy to go install-happy with cool looking features. Here’s the kicker: there’s no code oversight on those plugins. This leads to some very poorly developed and resource heavy plugins that, one way or another, become popular. It’s easy to fall into the trap of assuming just because a plugin or theme is popular that it’s also worth using.
What plugins should I avoid?
In the current shared hosting world nearly every host implements some type of CPU, disk i/o, process, and RAM limit on individual hosting accounts. All it takes is one high resource site under your hosting account to cause issues for every other site on your account. These limits mean you need to be mindful of not only what you run but how it impacts your overall resource quotas.
In our experience the most troublesome WordPress plugins revolve around SEO / keyword generation and advanced search tools. These types plugins will eat up your available CPU or PHP processes in no time, even if you have a low traffic site. Here are some examples of problem plugins:
- Relevanssi: This plugin is an “improved” search for WordPress. It allows you to do customized searches and sort the results by relevance. You can search for phrases or keywords in titles, bodies, tags, categories, or even custom fields. In theory this sounds great but if you’re not careful a single query can eat up all of your available disk i/o as it tries to not only fetch the search terms but construct the query results in a relevant fashion. Run more than one search at once and your site won’t be able to serve any new visitors.
- Search-terms-tagging-2 (STT2): This plugin attempts to add relevant search terms, keywords, and SEO content to your posts and articles. Similar to Relevanssi a single query from this plugin can consume all of your accounts available disk i/o or CPU as it tries to look through every article that may contain a keyword or instead automatically add SEO keywords to all posts in a given topic.
- SEO Auto Links & Related Posts (SEO-ALRP): This plugin has not been updated in over two years yet we still see it in use on new installations. The purpose of this plugin is to find related articles to the one you’re currently viewing by looking through keywords, meta tags, and article content. However it uses extremely inefficient queries to return results and as a result one too many search terms will cause a search to hang indefinitely.
The above are just a few examples of bad apples we’ve seen repeatedly over the years. This is not to say the plugins can’t be used properly, as we know they can, but if you don’t know what you’re doing they will ultimately cause performance issues for you.
My site is slow, I think I made a mistake. Help!
Don’t worry, we can fix this! If you got a little carried away with your plugins or you’ve noticed over time your site just seems sluggish it can be corrected. Now the steps below assume you’re a Hawk Host customer (which, if you’re not already, why not?):
Let’s check your resource usage history. This can be a good indicator of whether you’re actually hitting your CPU/disk i/o/RAM/process limits or if your site itself is the problem. Login to cPanel for your account and search for the ‘CPU and Concurrent Connection Usage’ interface. You’ll see one of two things, either:
Or you’re going to see:
This tells us that, unfortunately, your account has been hitting one of or more of its resource limits. From there you’ll click [Details] so you can get a graph and chart of your usage history.
You can also click [Snapshots] to see exactly what processes were running at the time your account hit its limits:
The above tells us that at the time we were CPU limited our PHP processes using the resources were coming from our /home/public_html directory.
Alternatively you can login to your account via SSH and using the command ‘top -Mc’ we can get a live output of your PHP processes which will again show the site using the most traffic/resource:
Again this tells us our problem site is located at /home/bftest/public_html/.
We’ve figured out the problem. Awesome! But…how do we fix it?
Now that you’ve identified where your usage is coming from we can do something about it.
Step 1: Caching, caching, caching! I would say (not exaggerating) that 95% of the WordPress sites we see experiencing performance issues can be fixed by installing a caching plugin. The purpose of a caching plugin is it will stop serving requests dynamically via PHP and instead serve them statically via HTML, reducing the number of PHP processes needed to serve traffic to cached visitors and therefore drastically reducing your CPU usage. Our official and only recommendation for a caching plugin for WordPress is the Litespeed plugin. We have another blog post which covers the benefits of the plugin and how to install it: Install and configure Litespeed cache for WordPress
Step 2: Figure out what plugins are using the most resources. Once you’ve identified the plugins eating up the most resources you can think long and hard about if they’re really necessary. Alternatively you can start looking for a replacement to the plugin that does the same tasks but has better reviews or performance. This can be accomplished by installing and running the P3 Profiler Plugin from your WordPress admin.
Step 3: Consider using Cloudflare. Cloudflare is a free service that you can enable on all your websites through us. In fact as an official partner we offer you the ability to enable Cloudflare on all your sites right through cPanel! By enabling this service your sites static files (HTML, images, CSS, etc) will be distributed to servers on their network. That way when visitors go to your site they don’t need to go all the way to the origin server (your hosting account with us) to get all your sites content, most of it will instead be served from the Cloudflare server closest to the visitor. You can also choose to minify your content, enable additional gzip compression, and much more!
Step 4: Enable memcached! If you’d prefer to use an object cache such as memcached, as opposed to Litespeeds WordPress plugin, you can do that! We offer memcached for free on all hosting plans and you can find the memcached instance details in cPanel. Take a look at our KB article for more information on this. Again though, you should only use this or Litespeeds cache, not both!
Step 5: Do some outside research! WordPress has a page on their site which details optimizations you can make to the software. Most of that is covered in this post but who knows, maybe you’ll learn something or find another helpful tip! There are also countless community forums and sites which you can interact with other webmasters to learn about their tips for making sure your site is as fast as it can be.
Following the above steps should keep your sites running sharp for as long as you keep them online. Not only will your visitors be impressed with the speeds but you’ll also gain some valuable knowledge on how to maintain and optimize a WordPress website on shared hosting.