WordPress logo

9 tips for improving WordPress performance

If you run a blog powered by WordPress, you should already know that tweaking it to improve the performance is not a one-shot deal. You have to keep tweaking it until you get it right. And even after you think you’ve got it right, there’s always one more thing to tweak.

The database, whether it’s MySQL or MariaDB, has to be tweaked to match the specs of your server. And you better not forget digging into your PHP configuration files.

After you’re finished with those two comes the really fun part – setting up and configuring your Web server of choice to work just right. If your Web server is Nginx, the folks at Nginx, Inc, the company behind the popular Web server, just published an article that shows you what you can do to improve the performance of your WordPress blog.

They’ve given you nine (9) tips, the first of which is:

Cache Static Resources:
Static resources are unchanging files such as CSS files, JavaScript files, and image files. These files often make up half or more of the data on a web page. The remainder of the page is dynamically generated content like comments in a forum, a performance dashboard, or personalized content (think Amazon.com product recommendations).

Caching static resources has two big benefits:

Faster delivery to the user – The user gets the static file from their browser cache or a caching server closer to them on the Internet. These are sometimes big files, so reducing latency for them helps a lot.
Reduced load on the application server – Every file that’s retrieved from a cache is one less request the web server has to process. The more you cache, the more you avoid thrashing because resources have run out.

To support browser caching, set the correct HTTP headers for static files. Look into the HTTP Cache-Control header, specifically the max-age setting, the Expires header, and Entity tags. You can find a good introduction here.

When local caching is enabled and a user requests a previously accessed file, the browser first checks whether the file is in the cache. If so, it asks the web server if the file has changed. If the file hasn’t changed, the web server can respond immediately with code 304 (Not Modified) meaning that the file is unchanged, instead of returning code 200 OK and then retrieving and delivering the changed file.

To support caching beyond the browser, consider the Tips below, and consider a content delivery network (CDN).CDNs are a popular and powerful tool for caching, but we don’t describe them in detail here. Consider a CDN after you implement the other techniques mentioned here. Also, CDNs may be less useful as you transition your site from HTTP/1.x to the new HTTP/2 standard; investigate and test as needed to find the right answer for your site.

If you move to NGINX Plus or the open source NGINX software as part of your software stack, as suggested in Tip 3, then configure NGINX to cache static resources. Use the following configuration, replacing www.example.com with the URL of your web server.

Read the other tips by clicking here.

WordPress logo

Please share:

Add a Comment

Your email address will not be published. Required fields are marked *