7 Ways to Boost Performance of Your WordPress Website

7 Ways to Boost Performance and Decrease Latency of Your WordPress Website

wordpress performance

WordPress is the number one open source CMS to create blogs and websites. However, it has some performance issues in the default configuration that can’t be easily mitigated.

Also fast load speed is vital for all websites because this guarantees that users will be able to access your website more efficiently, your advertising in Google Ads will get a higher quality score and people will not leave your website because of a slow page loading.

At Hidora, we helped many customers to optimize their WordPress websites in the cloud and collected several important tips that can boost WordPress performance. These approaches can optimize your WordPress page load time to less than 1.5 seconds.

1. Use Nginx instead of Apache web server

Although Apache is a well-known and proven web server, there are some alternatives on the market that can beat it. Among them is NGINX which is an open source web server that is used by 49.7% of the top 100,000 websites according to W3Tech.
Out of the box, serving static files, Nginx uses significantly less memory than Apache and can handle roughly four times more requests per second. This can be a vital argument for high-traffic websites that need to serve thousands of users per second.

2. Generate static HTML files

In most cases, your WordPress website is not being modified frequently.
You can use this fact to implement an advanced caching technique that will generate static HTML files from your dynamic WordPress site and, as a result, offload your WordPress site markedly.

How it works: Instead of building a new copy of the page for each customer request, you can generate a static version of the page. After an HTML file is generated your web server (either Apache or Nginx) will serve that file instead of processing the heavier and more expensive WordPress PHP scripts.

To generate static HTML pages, you can use free WP Super Cache plugin that will cache those pages immediately the first customer requests them. This cache can be automatically invalidated and rebuilt if necessary, either manually or automatically, if you submit a new page or a set period of time has elapsed.

3. Implement faster rendering by using async javascript and CSS files

Most of the websites use tracking tools such as Google Analytics, Google Ads, Facebook Ads, etc. to track website visitors. However, these tools may dramatically slow down your pages due to the time taken to synchronously load their JavaScript files from the internet.
Asynchronous loading of JavaScript files can solve this issue. To do that, you need to specify the async attribute on your script tag. In addition, there are some WordPress plugins that can do this automatically for you.
Note: you shouldn’t mark all your JavaScript files as asynchronous because some of them are needed to render your page. We recommend making async only for unimportant scripts such as analytics and ads tracking codes.

4. Integrate CDN to deliver static content to your customers across the globe

In addition to caching of static files on the web server or load balancer layer, you can achieve even better performance by using CDN. This makes total sense if your customers are distributed across the globe or located far away from your primary hosting location.
How it works: as soon as one of your website visitors requests an image, a video, a javascript or CSS file, it is cached on the CDN layer and distributed across multiple data centres that are located all over the world. All following requests of this static file are served from the CDN, which significantly offloads your server. The good news is that CDN delivers files from the closest locations to your customers: US-based customers will receive files from US-based data centres and Swiss customers from data centres located in Switzerland.

The downside of using CDN is that you need to tune the lifetime of each object correctly, otherwise your customers will see outdated versions of them. In addition, DELETE FROM CACHE operation is expensive at some CDN providers, so you need to use it carefully. In general, use of CDN can significantly increase the speed of your website and decrease latency.

5. Combine multiple JavaScript and CSS files to minimize the number of HTTP requests

If during page load a large number of files are synchronously downloaded this can increase page load time. In order to reduce the number of downloaded files, you can combine them into one JavaScript and one CSS file. As a result, many files can be replaced by 1 or 2 files. There are several free WordPress plugins that can do this for you. For example, Autoptimize can combine and minify both JavaScript, CSS files and fonts, and load them asynchronously to speed up the rendering of your web pages.

6. Use HTTP/2 instead of HTTP/1.1

HTTP/2 enables HTTP connection multiplexing which can dramatically increase site load speed and decrease latency due to all your files being loaded within the same HTTP connection instead of opening multiple HTTP connections. If you have many static files this will definitely help you – you can check how many files are being loaded from your website using Pingdom test. Just see the difference in this demo that loads 379 small tiles using HTTP/1.1 and HTTP/2.

The good news is that HTTP/2 can be easily enabled on NGINX.
You can follow this simple manual to integrate HTTP/2 on your website.

7. Make your website available from multiple locations using Anycast

If you have a large e-commerce site that serves customers all over the world, you can consider using Anycast IP and deploying WordPress instances in multiple locations. Each location entry point will be using the same public IP address. Customers will be routed automatically to the closest location based on their proximity to the target location. If any of those WordPress instances fails, the traffic will be automatically failed over to other locations.

The drawback of this approach is that not all cloud providers support the Anycast IP option and you have to own a block of at least 256 addresses. Another point is that you need to implement additional data synchronization features on the database and file system layers.

It is very important to optimize your page load speed. It will not take you long to implement all the tricks mentioned in this article, but the results will come quickly.