Development and Managed Hosting
ANEXIA
APR
18
2018

Performance tuning in WordPress

Written on April 18, 2018 by Manuel Wutte

WordPress Logo

In times like these where network connections are continuously improving and bandwidths are expanding, fast websites are a must. But to be able to provide the speed and performance required for this, it’s important to put in place the right actions. Studies have shown that people’s attention span is currently approximately 9 seconds. That means that, in order to get visitors to stay longer, they need to be won over by the content of the website during this short period of time. But long loading times rapidly increase the probability of visitors leaving the website! Moreover, Google , along with other search machines, has begun to rank websites with faster loading times more highly when it comes to search results.

Put simply: if you want higher hit rates, more visitors and consequently an increase in the associated turnover, a fast website is a MUST! In this tutorial, we would like to present a few tips you can use for performance tuning of WordPress.
 

Measure your performance

If you now consider your own website, you will perhaps think that it is quite fast. But unfortunately this is a big mistake. Modern browsers “note” the content of frequently visited websites and save the data in their cache. If you then revisit a website that has been cached like this (by the browser), it opens straight away – almost without any loading time at all. This gives you the subjective impression of a lightning-fast website.

However, the first time visitors go to your page, their browsers have not yet cached any of your data, increasing the loading time for them.
Another significant factor is the geographical location of your visitors: the further away they are from the server location where your website is being hosted, the longer the loading time. The reason for this is that the data has a longer way to travel in terms of physical distance (latency problem).

This is the reason why a number of tools are available on the Internet to measure the performance of a website. These include services such as GTmetrix andPingdom, for example. These are free online tools you can use to analyze your site to reveal any weak points.
 

Causes of slow websites

If you perform a test using one of the tools mentioned above, you will also be provided with several suggestions for improvement at the same time. The problem is that they are often impossible or difficult to understand for the layperson. Nevertheless, gaining an understanding of why a website is slow is a basic prerequisite to enable you to take the corresponding countermeasures. For this reason, I would like to explain to you here the main causes of slow WordPress websites:

  • Webhosting: poor or suboptimal configuration of the hosting server
  • WordPress configuration: if a caching plugin has not been installed, the server needs to completely reassemble the page every single time it is accessed
  • Page size: in most cases due to the size of the images or because they have not been optimized
  • Bad plugins: if a plugin has not been correctly programmed, this can quickly have a significant effect on the performance of the entire website
  • External scripts: for example advertising or other external resources

Once you’ve got a grasp on these factors, we can begin to correspondingly optimize your website.
 

The most important actions for performance tuning

Ways and means to optimize websites are almost as prolific as sand on the beach. I will describe the most important and effective of these below and also which plugins could be useful to you.
 

1. Caching: the most important action

When a visitor accesses your website, the webserver normally begins to search for the individual contents step by step to build up your webpage. Only when this has been completed can the visitor actually view the webpage. This works somewhat differently with caching: after the webserver has first assembled the webpage, the completely rendered webpage will be temporarily saved for a specific amount of time.

When somebody now accesses the website, the server will first of all check whether it already has a temporarily saved (“cached”) representation of the desired webpage and delivers this. The server now no longer needs to search for the content and assemble it as it already “knows” the result.

In principle, there are two types of caching available: either via a caching plugin or caching provided by the server. But the latter option does need to be offered by the hosting provider. For example, this can be implemented using Varnish Cache.

However, it is easier to solve this using a plugin. I recommend you use WP Super Cache for this. To set up caching with WP Super Cache, first install it directly via your WordPress backend and activate it. Note that you first have to configure the caching.

Configuration:
To do so, click on “Settings” or directly on the “WP Super Cache” item in the “Settings” menu.

Then select the “Caching on (recommended)” option right at the top of the “Easy” tab and save the setting by clicking on “Update status”.

When you now open your website (preferably in a “private” or “incognito” window), you will notice that your website will load considerably faster after the first time you access it.
 

2. Remove unnecessary plugins

Overloaded WordPress websites can also have a negative impact on speed. If you have plugins that you do not need (anymore?), unfortunately it is not sufficient to simply deactivate them. Please delete them completely. The basic principle applies here: the fewer the plugins, the better the performance.

Plugins are important but every now and again you should have a look and see which ones you actually do need. Every one of your plugins and themes is associated with a large number of other PHP codes on your website. PHP is not a very fast script language, unfortunately. The less of it there is, the faster your WordPress will be.
 

3. Images, the underrated brake when it comes to speed

If you would like to now go one step further, you can attempt to reduce the volume of data required to display your website. Modifying your images is a very effective action. You can considerably reduce the file size of your images using “lossless compression”, so that much less data has to be transmitted overall. But this doesn’t affect the way visitors perceive them as there is no apparent loss of quality. You can either compress the images manually yourself or decide to use a suitable plugin. I recommend EWWW Image Optimizer if you want to take the latter option.

Configuration:
To do so, install the plugin and then activate it. Now go to the settings.

Select the option “Include media library folder” in the “Advanced settings” tab and confirm this by clicking on “Save changes”.

Start optimization:
Now click on “Mass optimization” in “Media” in the WordPress sidebar. Here you can optimize images that were previously uploaded. Start this action by clicking on the “Scan for unoptimized images” button and then confirm this by clicking on “Start optimization”.

EWWW Image Optimizer will now optimize all your images so that you can achieve the best possible result for each one. Please do not leave this page until this process has been completed!
 

4. Optimize CSS and JavaScript

Alongside images, CSS and JavaScript files also represent a large volume of data. If your website has these files relatively close to the top of the source code, for example in the header, the browser will first download all these files before continuing to process the source codes. You can probably already imagine the problem that this causes: rendering your website will be completely blocked for this period of time.

The goal is therefore to load these files as late as possible and to also ensure that 20 individual files are not loaded but perhaps only one larger one. The browser cannot download files simultaneously or only a very limited number of them.

The solution?

  • Combine individual CSS and JavaScript files together
  • Reduce the volume of data
  • Compress the files

I recommend the Fast Velocity Minify plugin for this.

As normal, simply install it and then activate it.

If you do determine any problems afterwards, e.g. some types of fonts do not load correctly or any other negative optical side effects occur, then please change the settings of Fast Velocity Minify.

Select the option “Disable CSS processing” in CSS options” in the “Settings” tab.
 

Further actions

There are a seemingly limitless number of optimization actions, whereby their effectiveness may be more or less beneficial.

  1. If you want the website to also achieve the best-possible performance in other geographical regions, it is definitely worth considering using a so-called content delivery network (CDN).
    A CDN mirrors and distributes the static files to decentrally distributed servers and infrastructures of the respective providers. Depending on where the visitor now accesses the website, the resources will be loaded through this CDN – but they actually come from the server that is closest geographically. This makes the loading times for these files relatively fast.
  2. Another relatively effective method is to use HTTP/2 instead of HTTP 1.0 or HTTP 1.1 as the transmission standard. This makes it possible for resources (such as CSS and JavaScript files, for example) to be loaded simultaneously from the server. However, this does require that the corresponding configuration is in place directly on the hosting server and therefore depends on whether the respective provider supports this protocol or not.

For managed hosting, the simplest solution is generally to be able to use these individual configurations.
 

Conclusion

The performance and speed of websites are the be-all and end-all to success – above all when you consider that you only have a few seconds time to win the visitor over with your content.

The plugins and tools presented here are simply provided as my personal recommendation, although we do use them time and time again for many website projects for our customers.

But before you install just any kind of plugin or update them, it is very important that you make a backup of your website – just in case any problems or errors arise as the result of carrying out these kinds of optimization actions!

If you want to achieve an increase in performance especially in the hosting area, it often makes sense to select a managed hosting solution. Experts perform all your settings for you to ensure your website is as powerful as possible. My colleagues have put together more information about managed hosting for you here:
More Information about Managed Hosting >