One of the major factors that affect your website's search engine optimization (SEO) is your site speed. Not only does a search engine prefer a faster site, but your readers too. From a strictly SEO point of view, a faster site wins. In today's article I'm going to cover a number of methods that will help you speed up your website, thereby improving your SERP rankings and user experience (UX). Here's a wonderful infographic from Quick Sprout that shows you how load time affects your online business. Let us begin:
Understanding Web Servers
The World Wide Web as we know it revolves around billions of webpages intertwined amongst each other. The fundamental entity that serves as the binding component is what we call a web server. The primary function of a web server is to host your webpage (HTML document integrated with image, audio/video file, etc.) in the World Wide Web and serve the content efficiently to the visitor or requestor.
The major webservers that have been powering the top million busiest websites include Apache HTTP Server (at a whopping 59.98%) followed by Microsoft’s IIS (13.57%), and then the rest. Now that's a good history lesson.
I would like to draw your attention to 2 relatively newer webservers:
NGINX is an open source web server which focuses on high performance and low resource usage. It powers over 12.18% of all active sites and guess what? Bigshots like Netflix, Hulu, Pinterest and yes WordPress.com use NGINX to name a few.
However, on the down side very few shared hosting servers use NGINX. Why? I don't know (probably because the ones using Apache would run out of business :P)
But if your site is hosted on a VPS, a properly configured NGINX server is a Godsend. To quote Chris Lea:
Apache is like Microsoft Word, it has a million options but you only need six. NGINX does those six things, and it does five of them 50 times faster than Apache.
Not convinced? Check out the benchmark on NGINX vs Apache.
LiteSpeed is a lightweight proprietary web server, which is insanely fast, very much like Apache and is easier to use. In simpler terms:
LiteSpeed is like Apache’s faster twin.
Here are some benchmarks to prove my point. Good news is, quite a few hosting companies that have started using LiteSpeed and they have gained considerable reputation in the web-hosting scene.
Which WordPress host should I choose?
Choosing your WordPress host depends on two factors - (1) budget and (2) traffic.
If you're just starting a new blog, then any decent web host should be enough. Considering the fact that you'll be running WordPress, 99% of shared hosting providers use the Apache HTTP Server. NGINX is used by barely anyone. So you're left to decide between LiteSpeed and Apache. I for one have tried both, and found LiteSpeed to be considerably faster than Apache - be it while downloading files from the server to my PC (over HTTP and not FTP) or hosting WordPress. I've been using CorcWeb for over a year. It runs on LiteSpeed and is pretty cheap. Thankfully, I haven't encountered a downtime other than the scheduled maintenance. If you want to stick to the traditional budget shared web hosting, you could take a look at out list here. Beyond this, it's more of a personal choice.
Shared web hosting costs around 4-6 USD per month and can smoothly handle traffic of +/- 10,000 visits per month. Keep in mind that, at high traffic levels, LiteSpeed is known to perform much faster and efficiently - with low resource usage, compared to Apache.
Managed WordPress Hosting
If your site has considerable traffic (15,000+ visits per month) and you want all WordPress related issues to be handled by someone else (i.e. your host) you should consider Managed WordPress hosting. To help you decide a managed hosting provider we have a list of the best managed WordPress hosting providers in the industry. Granted, the prices are higher than traditional hosting, but, you have your peace of mind and bang for the buck.
VPS / Dedicated Server
Hosting your WordPress site on a VPS or dedicated server powered by NGINX is the ultimate combination and serves as the highest value for money you can find. A good VPS (or dedi) powered by a properly configured NGINX web server can handle enormous amounts of traffic with very little memory footprint. However, you must have sound knowledge of NGINX, PHP, web servers and Linux to pull this off.
Content Delivery Network
The WordPress Theme
The theme that is currently active in your WordPress site plays a crucial role in your website's load time. A heavy theme with bloated CSS and JS files can wreak havoc in the site speed. You must always use a theme which is lightweight and has more or less the exact number of features you need. Take a look at our theme buying guide to learn more.
Importing too many fonts in your CSS isn't a good idea as it increases the load time. It is recommended to use a maximum of 3-4 fonts in your theme. Also the type of fonts you use matters. While selecting a font, check the page load time meter in Google Web Fonts - if it's in the yellow zone, then it's probably a good idea not to use it. If the pointer hits red, that's a big no no.
Reduce the number of Active plugins
You can download as many plugins as you want, but only activate the ones you need. Especially the plugins which add visual effects to your theme - for example, a fancy Love button. These plugins have their own CSS and JS, which loads after the main stylesheet.css has been loaded. Hence an increase in load time. Same goes for comment plugins. If you're site isn't looking at much traffic, its best to not install comment plugins like Disqus or Livefyre. No doubt they're great, but if you don't really need them, don't use them. The default WordPress comment box will do! As a general rule of thumb:
If you don't need 'em, don't install 'em!
Assess Individual Plugin Impact
To find out which plugins are causing your site to slow down, I would recommend - P3 (Plugin Performance Profiler). This is a plugin that analyzes all the active plugins in your WordPress setup and generates a detailed report of their impact. I would recommend running P3 on a monthly basis to maintain a fast WordPress site.
Optimize your WordPress Database
As you experiment more and more plugins (and themes), your WordPress database gets clogged with excessive table entries. The WP-Optimize plugin repairs and optimizes your WordPress database by removing unapproved comments, post revisions and comments in the spam queue. Post revisions and comments in your spam queue consume a lot of space in your WordPress database. Every time you edit an article, WordPress auto-saves a copy of it to prevent loss of data. Now suppose an article is 100KB in size, and you edited it 7 times. That would bring a total of 700 KB whereas the original article was 100 KB! Clearing post revision for one such post saves 600 KB in your database. 600 KB in terms of database is huge. Therefore, installing this plugin is a must. To further reduce the size of your database, you can manually use phpMyAdmin to delete the table entries of the themes and plugins you don't use anymore.
Optimizing your images reduces image size thereby improving load time and saving bandwidth. It constitutes of two vital factors:
- Choosing an effective format
- Optimizing the image
When you're using a vector based image, like an icon, using a PNG format saves more space compared to the JPG format. For example, consider these two images:
I've purposely saved the file in JPG format. It weighs 24 KB whereas the PNG format weighs 11 KB - which is almost half the size. Plus, if you notice carefully, you'll find that the quality of the PNG format is better than the JPG format (specially around the edges of P)
However, in case of everyday images (nature, people, etc) JPGs will always consume lesser space. As for image optimization, there are various free tools available, out of which I'd recommend Trimage for Windows and ImageOptim for Mac.
But wait! Here's another reason to love WordPress. EWWW Image Optimizer and CQ Image Optimizer are two plugins (among many others) that use various algorithms to optimize your images in the Media Library - the ones that you've uploaded in the past and the ones to follow.
Reducing the number of HTTP requests
Let's break this into two parts - how and why. The why part is fairly simple. Lesser the number of requests, lower the page size and faster the load time. The how part is a bit complex and requires advanced WordPress knowledge. For an everyday WordPress user choosing a proper theme and activating only necessary plugins should do the trick!
Using a caching plugin
Saving the best for last - a WordPress caching plugin such as W3 Total Cache, if configured properly could do wonders to your site speed. Here's a small overview of the process. Everytime you load a page in WordPress, the PHP code is executed and the HTML content is generated. This increases the load time of the site and puts pressure on the server. A caching plugin periodically generates static HTML files of all your WordPress pages and posts and saves them. When a page is requested, it is directly served from the previously saved cache. This saves precious load time (no PHP code/database queries are executed) and reduces server load.
Today we've seen some of the most effective methods to pull off a faster, smarter WordPress site. Of course, these are only needed when you're looking at serious traffic. However, above all these factors, what really matters is your website's content. That is the bedrock on top of which all of these factors stand. First get the content straight, then the rest.
Tools for testing site speed
Once you've implemented the points mentioned in this article, you'll want to see how they've affected your website. Once you've paid for a CDN, no doubt your site will load faster. But to actually see and measure the difference, here are some tools that will measure your website's speed.
Pingdom: I've been using Pingdom Website Speed Test every since I learnt about site speed. Its a free tool that measures your site's load speed from multiple locations including NY, Texas and Amsterdam. Plus they give you a beautiful graphical interface displaying the amount of time it took to load each requested element.
GTMetrix: This is like the Swiss Army Knife of site speed measurement. It gives you:
- Combined scores from Yahoo YSlow, Google Page Speed and others
- Downloadable PDF with detailed recommendation on how to improve site speed
- A WordPress plugin to incorporate the GTMetrix's features in you WordPress dashboard
If you have some tips to cook up a faster WordPress site, we'd love to hear!