Steps to Optimize WordPress to Reduce Server Load

Steps to Optimize WordPress to Reduce Server Load

Recently I came across a question on WordPress Development StackExchange asking for steps to optimize WordPress with regard to server load. Here’s a link to the question. Most of the answers were technical and couldn’t be understood by anyone new to WordPress. So I created this answer-like post to fix that shortcoming.

Enable Caching

Install the W3 Total Cache plugin for caching functionality in WordPress. Enable page caching and database caching feature from the plugin’s settings page. Make sure you choose ‘Alternative PHP Cache (APC / APCu)’ as the caching mechanism. Do NOT enable any minification in W3 Total Cache as there are many chances for you to break your site’s appearance and/or functionality. We’ll leave it to Cloudflare.

Use a Content Delivery Network

Once you’re done with configuring the rest of the plugin functionalities, set up Cloudflare for your website. Make sure you enable Cloudflare in the W3 Total Cache settings too under ‘Extensions’.

Cloudflare is a Content Delivery Network which caches all the static contents (image files, CSS, JS, documents, etc.,) from your site and serves it to your visitors from their global servers. This can help speed up page load times and reduce the load on your server. For a list of file types that are cached by Cloudlfare checkout this list. Moreover, Cloudflare has a free plan too.

In Cloudflare, set the caching level to standard and set browser cache expiration to something at least greater than 20 hours. Enable Always Online™ so that even if your server goes down, Cloudflare will serve your website’s static pages from their cache. Also enable their auto minify feature (remember why I asked you to not enable minification is W3 Total Cache? Because Cloudflare does it better!) Then set Rocket Loader™ to automatic.

Here’s an excerpt of what Rocket Loader does :

  • Decreases the number of network requests by bundling JavaScript files, even third party resources, to avoid slowing down page rendering.
  • Asynchronously loads scripts (including third party scripts) so
    that they do not block the content of your page from loading
    immediately.
  • Caches scripts locally (using LocalStorage, available on most
    browsers and smart phones) so they aren’t re-fetched unless
    necessary.

More information can be found here.

Also Read: Redirect non-www URLs to www using Cloudflare

Use Genesis Framework

If possible switch to the Genesis framework for WordPress because they are clean without any bloat. Genesis was built with speed, security and SEO in mind. I myself have tested it out and my PageSpeed scores were pretty damn good. Also if you’re using Genesis, then don’t forget to enable fragment cache in W3 Total Cache settings.

Compress Images

Since now you’re using Cloudlfare as a CDN, you can make use of a plugin like ‘Imagify‘ or ‘Compress JPEG & PNG images‘ by TingPNG to compress your images. Both are free plugins available in the WordPress.org plugin repository. Also, Imagify supports the powerful lossy compression algorithm.

Remove Query Strings

Finally, install ‘Remove Query Strings From Static Resources‘ plugin by Your WP Expert from the WordPress repository so that it removes the query strings from static resources like CSS & JavaScript files. This is because resources with a “?” or “&” in the URL are not cached by some proxy caching servers (remember, Cloudflare is also a proxy caching server).

Use Google’s AJAX Library API CDN

Then install ‘Use Google Libraries‘ plugin by Jason Penney. This plugin allows your WordPress site to use Google’s AJAX Library API CDN rather than serving these files from your WordPress install directly.

Some of the key benefits are:

  • Increases the chance that a user already has these files cached.
  • Takes the extra load off your server.
  • Uses compressed versions of the libraries (when available).
  • Google’s servers are set up to negotiate HTTP compression with the requesting browser.

Optimize Database

Last but not the least, use the ‘WP-Optimize‘ plugin by Ruhani Rabin to clean and optimize your database.

Hope this helps you with regard to optimizing WordPress to reduce server load.

Also Read: How to make WordPress site HackProof

Advertisements

2 thoughts on “Steps to Optimize WordPress to Reduce Server Load

    • Howdy,

      Thanks for the recommendations Andy. I’ve tried ShortPixel earlier and found Imagify to offer better compression rates than ShortPixel. Haven’t tried Kraken Image Optimizer yet. Will give it a try and maybe I’ll post the results in a separate blog post.

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s