Configuring and hosting websites for lightning-fast delivery

With countless experts, and even Google themselves, singing about how important speed is for search ranking and converting visitors, it’s well worth investing a little time on improving your load times.

Website performance is a daunting subject. With so many tricks and tips around for the cornucopia of different website and hosting setups it’s hard to find what’s relevant.

To help make things easier, we’ve outlined a few simple changes that can apply to any kind of website, big or small.

Main control board of a hard drive with cache.

Caching

What is caching?

If you’re after one thing that’ll make a huge impact to how fast your homepage loads up, caching is what you’re looking for.

Let’s look at how it works. Usually the user waits while your hosting pieces together your page with all its dynamic content every visit. With caching, your server assembles the page once and keeps a copy on file, ready to deliver for anyone that comes knocking.

There is a potential downside. caching is not always good for private pages that need to change on demand. User dashboards are a good example, but this applies to most personalised content.

“Here’s one I made earlier” you might say.

Why is caching important?

Everyone wins, in some cases the improvements are more than a 90% reduction in load times.

There’s no processing delay for loading cached content. With caching, because the server is spending less time on cached requests there’s more power to dedicate to dynamic requests.

How do I enable caching?

There are many different ways and tools to do this. Platforms such as Joomla and Magento have various tools built-in which you can use, but for others there’s always plugins you can use. One such example we make good use of at WSA is W3 Total Cache for WordPress. On another level exists reverse proxies and caching tools such as Varnish, memcached, and nginx, but those are for another time as they each warrant their own in-depth article.

So far we’ve only covered server-side caching. By setting the proper headers you can instruct the visitors browser to fetch pages and content from its own storage. This is an the ideal solution, as it hardly involves your hosting at all. Most of the tools mentioned earlier can help set these up, or your hosting provider will able to point you in the right direction. Some of the headers you’re looking for would include the following:

  • Last-Modified
    • States the last time the requested content changed. If the visitor already has a recent copy then it won’t fetch a new copy, saving resources.
  • Expires
    • Lets the visitors browser know how long to hold onto the content before it’s no longer relevant.
  • Cache Control
    • This generally specifies if the browser should cache the request, and how long for.
  • ETag
    • ETag works as a unique identifier. If the stored ETag and the requested don’t match, it’s time to fetch a new copy.

Inside a hard disk drive.

Compression

What is compression?

Now that you’ve got your website responding instantly, the next task is to reduce the actual amount of data that the visitor receives. It’s no good responding quickly if your images and content are so gigantic it takes an age to download them all. Compression takes your content, and then through some very clever maths, crushes it down to a much more manageable size.

Why is compression important?

The average UK broadband speed is around 2.5 megabytes per second. If you’ve loaded your stunning new site with high-resolution imagery but failed to apply compression, visitors could be waiting a while to download it all. Uncompressed photographs often exceed 4 megabytes in size, and with sites these days stuffed with pictures it adds up fast.

The same goes for things like stylesheets and scripts. Those verbose comments and notes in the code which were so helpful during the site build are now dead weight, wasting bandwidth.

How do I enable compression?

The most widely available and useful type of compression for the web is GZip. GZip provides an ideal way to squash down your content, without degrading it at all. Unfortunately though,  GZip usually only has an impact on text-based content like JavaScript, HTML, and CSS.

For your images, make sure you’re using the right format, and consider compressing images a little. For JPGs, around 80% compression provides a good balance between image quality and size. PNGs are a little more difficult to compress, so where possible consider converting to a different format.

To help crunch your scripts and styles, there are web tools readily available. These will strip all the unneeded blank spaces, line breaks, and old comments from your code to slim it down.

Many switches in a server rack with cables.

Hosting

What is hosting?

This is the backbone of your website, where all the heavy lifting happens. Generally hosting refers to the service which runs and delivers your website. Hosting often takes the form of a shared hosting plan from any of the large providers,  a private virtual, or dedicated server.

Why is hosting important?

Your hosting is the key piece that builds and serves your content. When it’s overloaded, busy, or otherwise sluggish, response times are slow and intermittent. Often with oversubscribed hosting providers, the visitors connection outpaces that of the website, making them wait as the data trickles through.

How do I improve my hosting?

Hosting is a difficult thing to get right. It generally comes down to the amount of resources provided to each website. Give too little and they’ll suffer from poor response times and errors, give too much and it’s not an effective use of time and money.

The phrase “You get what you pay for” often rings true in this case. Spend a little more than the price of your coffee on a month’s hosting and you can expect things to get a little slow, especially around busy periods. Throwing hundreds of pounds at a high-end dedicated setup for a personal blog doesn’t make much sense either.

Other tips

CDN

Consider using a Content Distribution Network. These keep a copy of your content, spread across a cluster of servers around the globe. This reduces the load on your hosting, as well as provides a faster connection for those that who are a considerable distance from your own server.

Keep it tidy

Cleaning up old files and software can always help. Accidental duplicates of content and older revisions stack up quickly. This can bog your server down, so a good clean out every now and then is a good idea.

Stay up to date

Make sure you’ve got the latest software. Software developers regularly publish performance improvements and updates. A good example is the recently released PHP7 which performs almost twice as well as its predecessor. The security fixes and other upgrades issued in these updates will keep your site safe and prevent outdated technology from being exploited.

Screenshot of a website performance test.

Simply put, by minimising the work your hosting has to do, you can make visiting your site much easier. Your pages will display quicker, meaning your visitors are more likely to stay, and for longer. The SEO folks also claim that it will boost your rankings, meaning more visitors and sales for you. There’s nothing to lose from making your website faster, but plenty to gain.

If you’ve gotten this far and you’re feeling a little confused, don’t worry. Websites are complex, with so many rules and subtleties it’s difficult to keep track of. If you need help making your online presence perform better, get in touch, we can help.