It happens to thousands of people every day: for some mysterious reason, whether their website, made with WordPress or Drupal, becomes slow overnight (I mean 3 to 10 times slower than usual).

The dashboard takes several seconds to load (more than 2 seconds is that something is wrong), and all this becomes painful. In extreme cases, the whole page could even be temporary and return a message " unable to serve the page Which is every browser’s nightmare.

After contacting your hosting company's technical support, a technician examines several log files and comes back with a dreaded response:

«I see slow queries in your MySQL query log file, optimize your application ».

Understand this as: " It's your fault, take care of yourself " But did your website really cause this? Maybe not.

In this tutorial, we will walk you through in detail what makes your WordPress website slow.

If you have never installed WordPress, discover How to Install a WordPress Blog in 7 Steps et How to search, install and activate a WordPress theme on your blog 

But back to why we are here.

Basic prerequisites

As is the case with any accommodation problem, it is always best to do everything in your power to trace the source of the problem. Keep in mind that most hosting servers are not there to support your web application, but just make sure the server is running normally (Consult your agreement with it).

Any hosting company that will provide support on your app is certainly a worthwhile business, as a lot of the day-to-day issues come from the app layer.

Here are some easy steps that can help you find the problem for yourself:

  • Have a clear performance measure to monitor / improve:
    • Number of SQL queries (ID 16-80 for normal range)
    • Time of generation of the page (Php performance)
      • The time it takes for the server to build the page from the database and model. This is usually less than one second, between 0,3 and 0,7s).
    • Plugins like " WP Page Load Stats " or " WP Super Cache Provide this information.
  • Try disabling plugins, starting with the least critical ones, and see if the settings improve.
  • Switch to one of the default WordPress themes like TwentyFifteen. I know, this is probably not the best theme if you are in production. The alternative is to create a clone of your server.
  • Important: if your CPU usage is very high, or if your server is overloaded:
    • Make sure you have a caching plugin installed and working (most people can install and configure WP Super Cache in a few minutes).
    • Without caching, even a moderately " visit May be lacking resources

If the server load is too severe, all metrics will be skewed or totally wrong, so detective work will be more difficult. If you don't have access to Linux CPU usage statistics, check your website pageviews in WordPress statistics, Google Analytics (who has real-time statistics) or another analysis tool.

If you see a handful of people browsing the website, you are unlikely to consume a lot of resources, but it really depends on how your website is set up.

You can clone the server, or expand it enough to have logical data for debugging purposes. If not, find out what is consuming the CPU and fix that first.

Possible causes for slow queries on MySQL

It is important to recognize that it could very well be your website's fault, and therefore your fault. Here is a slightly slow request (2.13 seconds), although things could be much worse ... you can try it yourself:

SELECT SQL_NO_CACHE SQL_CALC_FOUND_ROWS wp_posts. * AT leave From wp_posts INNER JOIN wp_term_relationships ON (wp_posts .ID = Wp_term_relationships .object_id ) INNER JOIN wp_term_taxonomy ON(wp_term_relationships .term_taxonomy_id = Wp_term_taxonomy.term_taxonomy_id ) INNER JOIN wp_terms ON (wp_term_taxonomy .term_id = Wp_terms .term_id ) WHERE 1 = 1 ET wp_term_taxonomy .Taxonomy = 'Post_tag'ET  wp_posts .post_type = 'post' AND (wp_posts .post_status = 'Publish' ) GROUPBY wp_posts .ID ORDER BY wp_posts .post_date DESC LIMIT 0 , 6Post_dateDESC LIMIT 0 , 6Post_date DESC LIMIT 0 , 6

Result of a request

Reasons may include:

  • Plugins that perform intensive database queries, like related posts ... look for plugins that run every time you load a page
  • A very large database (2 million lines)
  • A very high number of MySQL requests (Hundreds per page)
  • High number of page views not cached (leads to a high number of requests)
  • A mixture of all the above, even at low doses.

With many shared hosting services, the database is on a different machine than the one that contains Apache and PHP, so performance issues are more isolated. If you have a Virtual Private Server (VPS), MySQL and PHP can reside in the same machine.

This means that the performance pressure on Apache / PHP can also affect MySQL performance. This can make the problem a little more difficult, so keep an eye on the current CPU usage when checking the performance of the query. If the CPU (or disk IO) is already saturated, this will generate false positives.

Improve your understanding of PHP errors by reading: Introduction to understanding php errors on WordPress.

But if you haven't changed anything (maybe an automatic update has occurred ?) And if your website is relatively small in size (database less than 200MB), you won't risk choking the database server resources, especially if you are using a tested application like WordPress, with simple settings and reliable plugins.

There are a number of reasons for slow MySQL queries that are not related to your web application:

  • Hardware issues with the MySQL server
  • Connectivity issues with the MySQL server
  • Limited number of simultaneous MySQL connections (less than 10)
  • Inadequate configuration settings on the MySQL server
  • Network latency between the web server and the MySQL server
  • Shared resources are abused by another client
  • Slow server storage
  • And more…

In this case, the companyWeb hosting should find and fix the problem. Again, check your agreement with the latter, but this should be possible in most cases.

Discover also some premium WordPress plugins  

You can use other WordPress plugins to improve the speed of your blog and to optimize the handling of your blog or website.

1. WP Instant Search & Auto Suggest

Le WordPress Plugin WP Instant Search & Auto Suggest lets you instantly get suggestions for posts, pages, and custom post types when searching your WordPress blog. It works with Visual Composer et Cornerstone.

Wp instant search auto suggest wordpress pluginIts features include: full-screen search, instant search in types of custom publications, three built-in design styles, fully customizable via settings, works with WPBakery et Cornerstone and more.

Download | Demo | Web hosting

2. Borlabs Cache

WordPress is a platform powered by a database that generates content dynamically. The more content and plugins you have, the more database queries are executed. This can slow down the performance of your website, especially when your database is located on a different server.

Borlabs wordpress caching plugin

Le WordPress Plugin Borlabs Cache saves dynamically generated content as a static file on your server's memory. When the page is requested, this static file is loaded and sent to the visitor, which is considerably faster than typical database queries. But that's not all.

See also our 5 WordPress plugins to clean your website database

Your pages contain a lot of unnecessary white space or HTML comments, which increases the overall page size. Borlabs Cache removes them all and uses GZIP to compress your pages.

Discover How to display all your WordPress publications on a single page

Many plugins have their own JavaScript and CSS files, which results in more requests on your server. Borlabs Cache combines all these JavaScript and CSS files so that, in the best of cases, your visitor only needs to load one JavaScript file and one CSS file.

Download | Demo | Web hosting

3. Lighthouse

So that WordPress can install and function properly, that is, quickly and without error, it needs a little cleaning. Lighthouse is a performance optimization tool. Its role is to get rid of the various defects of WordPress; it can be filters, actions, codes entered, embedded codes, or third party actions.

Lighthouse wordpress plugin

The purpose of this cleanup is to improve browser cache and caching plugins so that they can work at 100% efficiency.

Download | Demo | Web hosting

Other recommended resources

We also invite you to consult the resources below to go further in the grip and control of your website and blog.

Conclusion

Here is ! That's all for this dedicated article to the best WordPress plugins designed to help you improve the speed of your WordPress blog or website. 

However, you will also be able to consult our resources, if you need more elements to carry out your projects of creation of Internet sites, by consulting our guide on the WordPress blog creation or the one on Divi: the best WordPress theme of all time.

If you have some Comments or suggestions, please let us know in the reserved section. But, if you also liked this article, ndo not hesitate to share on your social networks.

...