Speed up WordPress

Minified code

Michael Addison  Director of Technology

A successful website provides a user with the results they are looking for in a timely and user-friendly way. Your website content is the most important aspect of your site, and if your content is extremely appealing, users may even be happy to wait for it. But most of the time, in this day and age, waiting is almost always going to mean that people lose interest.

Website speed-optimization options

Here is a very brief list of options to consider when optimizing your website:

Page caching

Most CMS websites have to process a lot of PHP and get data from a database before HTML can be sent to your browser. Page caching saves the final HTML file so it can deliver directly when that page is requested again. Delivering a plain HTML file can be dramatically faster and lighter on your server.

Pages can be saved on disk or even in RAM. Obviously, if you are being sent an HTML page that was sitting in the servers’ RAM the response will be blisteringly fast.

Apache, PHP and Nginx all have various ways of doing this. Alternatively, you can use other programs such as Varnish to cache pages in RAM, which means many requests won’t even get to PHP. Facebook and other large organizations use farms of servers with Varnish.

Minification

The most obvious way to improve your page load time is to decrease the size of the web page. A web page can contain HTML, CSS, JavaScript, Images, Videos, etc.

HTML, CSS, and Javascript files are usually written in a somewhat human, readable way with spaces and paragraphs. Minifying all these files removes all unnecessary characters in a document, including comments, if you like, to make the text file as small as possible.

Related to this is combining files. If you are able to put all your CSS into one file, for example, the server only has to make one request, instead of dozens, or even hundreds, in some cases. The same goes with Javascript. Combining, though, often has some side effects and requires careful testing before being put into production.

Browser cache

It’s possible to include cache details on every page, so that users’ browsers know how long to cache the page locally. While it is still considered fresh, the browser will simply load the previously viewed page from its memory or disk instead of asking the website. They can even do a quick check to make sure it is still fresh. On a busy website, especially if you have many return visitors, setting this could make a dramatic difference on your server load and general performance.

It works particularly well on global scripts or CSS. After they have been loaded once, they will not need to be downloaded on subsequent page views on the rest of the site.

Image size

Usually the largest part of a web page is images, and for good reason. An immersive site is far more likely to keep users browsing longer. It’s important, though, to balance the page size and compress images as much as possible. Choosing the correct image dimensions is just as important as compressing them properly. There are a number of free and paid plugins that can do this for you.

CDNs

This topic is a bit larger, but can have very good effects especially if your audience is distributed around the world. A content delivery network copies images and other parts of your site onto their servers around the world, and then deliver them to the closest user when needed. A closer distance to the server usually decreases download time. Cloudflare is one very easy-to-use option that can get you started for free. If you are willing to pay, there are other very effective options out there too.

Database Caching

Almost all CMS platforms require a database. Querying a database is usually very fast, but if you have complex queries, caching those database queries can save some valuable milliseconds. The concept is the same as page caching to RAM. Regularly used, identical queries are cached so that they can be delivered faster.

If you are running a WordPress site, there are plugins to instantly speed up your site. At Paradigm we recommend only two of them, mostly because they have had the functionality and track record we need for our clients.

WordPress caching plugins
These two plugins do a bit more than just cache, and we have had some very good results from them. Both include all the functionality above and can help you integrate with Varnish and a CDN to varying levels.

W3 Total Cache

W3 Total Cache has been around for several years now. It is an open source project with a ton of options. We use it in most of our projects.

Since about six months ago, the plugin has required very little tweaking of options to get good results. Simply turn on page caching, auto minification, and browser cache and in most cases you are ready to go.
Its many options allow you to have a lot of control over everything from cache priming speed to even fine grain control over how CSS and Javascript files are combined and minimized.

WordPress Rocket

This is a paid plugin and gets similar results to an optimized install with W3 Total Cache, except that the setup is much easier. It has fewer buttons, and it just works. If you are OK with paying and don’t really want the hassle of learning how to use a new plugin, then this is for you. It works well with woocommerce sites, too.

If you have any questions or would like Paradigm to analyze your site, please feel free  to contact us.