This article covers ways to improve speed of execution for WordPress but you could also look at it as a checklist to verify. Speed of a website is crucial to retain viewers. It is said that 47% of the viewers expect websites to load within 2 seconds, but don’t quote me from that this is just a figure from https://www.crazyegg.com/blog/speed-up-your-website/

Shared Managed Hosting

First question to ask is whether you are on shared hosting? If you are a shared hosting that means a few things. The machine on which you are running is shared with other users, just like the name suggests. So in case they exceed the normal X amounts of visits, for example 20,000 per month. And get a spike in traffic this could mean that your website experiences a slow down. This is because the resources are being used by the other user’s website. Of course this depends and might not happen.

Dedicated Managed Hosting

If you have the money available and you are experiencing significant traffic consider to invest in a dedicated hosting option. The other advantage is that this is also more secure. The other downside from shared hosting is that if a website from a user sharing the machine has been attacked by a malware. Then you could also be a victim of it. So the first advice if you can afford it is to buy the dedicated hosting solution.

Use A CDN

If you don’t have it yet on your managed hosting then try to at least configure your DNS records on Cloudflare for example. Cloudflare will provide you with a few speed improvements out of the box for free which is the autominification of css, html and javascript. There are other CDNs available and well documented here: https://www.wpbeginner.com/showcase/best-wordpress-cdn-services/

Image Optimisation

The next speed optimisation is to compress your images (and to serve them over a CDN actually). You can do the first part easily with a plugin. Many of them are available again well documented on WPBeginner https://www.wpbeginner.com/plugins/best-wordpress-image-compression-plugins-compared/

Offload Images

On top of compression you as far as possible you try to offload the images completely from your website. They easily the largest files that are going to be served by your pages. You can do this with the plugin: https://wordpress.org/plugins/amazon-s3-and-cloudfront/

Use PHP 7

If you are on Godaddy hosting for example you should make sure to check on your Godaddy dashboard that you are using the latest version of PHP7. PHP7 is nearly 2 times faster than Php5. However, before making any changes to the PHP5 please do it in a test environment/staging server first. It might be that not all your plugins have been coded to support PHP7.

Use Opcache

Opcache uses a byte caching engine to save operations in memory. In short it will make your processing faster at the expense of memory. You should again conduct your tests in a staging environment. You need to make sure that you have the opcache extension and to enable it in your php.ini(opcache.enable=1) or your dashboard (if from a managed hosting). If you have access to the server then you are in luck, because although enabling is easier, tuning OpCache is much harder.

But there is a handy script available which does that https://gist.github.com/ck-on/4959032

For example if you run it and find the following you will know that all the opcache memory allocated is being used so you might consider increasing it.

Object Caching

Just like you offloaded images before you should also consider offloading memory. This can be done by installing a database like Redis and then using the following plugin https://wordpress.org/plugins/redis-cache/ to cache objects there. Careful to benchmark your system again or at least use monitoring to see if there is an actual improvement in performance from this.

Query Monitor

This one is a free plugin you can download here https://wordpress.org/plugins/query-monitor/ which will basically allow you to find which queries are taking more time and also to allow you to check if there are any improvements from adjusting Opcache and object caching. Additionally, you could also pinpoint part of the code that is slow(and potentially identify plugins making your website slow).

Query monitor showing time taken by plugins

MySQL Tuner

If you have access to the installation of the MySQL server on which the WordPress site is running you could actually use the script here https://github.com/major/MySQLTuner-perl to get tips on how to adjust the configuration to get better performance.

IO Limit

A lot of people who run WordPress on AWS are unaware of the limitations present gp2 volume types. The IO limit is based on the size of the disk that you are using. You won’t feel this until you have expended your burst credit https://aws.amazon.com/blogs/database/understanding-burst-vs-baseline-performance-with-amazon-rds-and-gp2/ If you are experiencing a slow website you should consider monitoring that either with iostats command or cloud monitoring(if available). Same thing for other volumes outside AWS.

Tuning Apache

If you have access to apache2 then you should consider tuning this as well. You can use https://github.com/richardforth/apache2buddy apache2buddy which is the equivalent of MySQL tuner but for apache2. Things to take in consideration are the sessions sizes and how long they should last. It doesn’t make sense if you have a small blog to allocate too much to both of them. Anyway Apache2buddy will make a best guess for you.

If you have any other ways to optimise please feel to comment.