Dean spoke a bit about how the location of your website and your users can affect how fast your site loads in his video, “What is a CDN?“, so we’ll pickup his example of a website with pictures and videos of kittens and puppies – although this is just as important, if not more so, if you’re running an ecommerce store selling products online.
Distance = Latency = Speed
You’ve setup your website with a hosting provider in the UK; you’ve got the best and cutest videos and pictures of kittens and puppies around and suddenly you’ve got really popular in Australia and you’re finding that 90% of your visitors are from there.
You’re also finding that you’re getting a number of people complaining in your comments that the site isn’t loading very fast for them, especially on the gallery pages. This is latency in action.
When it comes to computer networks, latency is the amount of time it takes for a single packet (a small chunk) of data to get from one device to another. Latency is governed mainly by two things:
- Distance – There’s a limit to how fast light can travel inside an optical fibre network cable (roughly 2/3rd the speed of light)
- Equipment – The more switches, routers and devices the data has to travel through and be processed by, the longer it takes
If you’re sending data from the UK to Australia this might be around 150ms, if you’re sending data within the UK it might be 2.5ms – that’s quite a difference, especially when you consider you might actually need to double that for most web traffic due to the way the web works.
You might think 1/3rd of a second doesn’t seem like a long time for your users to wait, but this latency affects every file you’re sending you users, so that means:
- Web pages
- Style sheets
Web browsers won’t try and start loading all of these files at the same time, as they try and limit the number of simultaneous requests, but also because they don’t know some of these resources are needed until others have loaded e.g. Your stylesheet may have details of other images or fonts to load.
The effect of this is that those 1/3rds of a second start to add up. If it takes 0.33s longer to load your site, then 0.33s longer to load the stylesheet and then 0.33s longer to load a background image referenced in it, then that 1s longer to load that image!
The good news is that there’s a number of ways of reducing this latency and some other ways of minimising the effects of it.
1. Host your website near to your customers location
For most websites this just means being roughly in the vicinity of your users e.g.
- If your customers are mainly in the UK then host your website in the UK
- If your customers are spread around Europe, then host your website somewhere in Europe
- If your customers are in the USA, then host your website in the USA
When it comes to financial trading, companies go to even greater lengths, being in the same city, street or building as the parties they are dealing with. Some have even gone so far to lay their own fibre cables across the Atlantic Ocean, but buried in a trench because this makes the distance slightly shorter compared to those with cables resting on the sea bed!
If you’ve found this page whilst looking to see where host all of our websites, then we host all of our websites and servers within the UK as standard.
2. Use a Content Delivery Network
The next best thing you can do, and we’d recommend you actually combine this with #1, is to use a Content Delivery Network (CDN). The simplest implementation will cache your content (make a copy of it) nearer to the users accessing it, reducing the latency to those users. This isn’t a perfect solution, as unless the content is being accessed regularly enough it will get removed from the cache and it’ll still have to come from your site directly.
One way around this is a more complicated CDN setup, where you would upload your puppy and kitten videos and photos to the CDN provider and pay for the storage you’re using – that way they don’t get removed from the cache unless you tell them to. This requires much more integration work in to your site and workflow though.
Our virtual hosting provides access to CDN via our integration with Baqend, and if you use WordPress you also get extra credits for using the QUIC.cloud CDN as well due to our use of LiteSpeed Enterprise Server.
This one isn’t in your control quite so much, but there has been a lot of work over recent years in reducing the effects of latency and speeding up web traffic by updating the fundamental protocol that underpins the web, HTTP (Hyper-Text Transfer Protocol). First developed in 1989 by Sir Tim Berners-Lee it became an international standard in 1995, HTTP/1.0, then in 1997 HTTP/1.1 was created and until 2015 it remained much the same, with a few tweaks and additions.
As things weren’t moving fast enough and they dominated the browser market with Chrome, Google developed their own protocol Spdy, and then Quic to address problems with latency and optimising web load times. Out of that work came HTTP/2.0 in 2015 and we’re currently not far away from HTTP/3.0 being released officially.
Fortunately nearly all web servers support HTTP/2.0 now, assuming your web host has enabled it and configured it correctly and LiteSpeed Enterprise Server supports pre-release versions of HTTP/3.0 along with supporting browsers such as Chrome.
To make sure your website is taking advantage you’ll need to confirm with your hosting provider if they support the modern protocols an that they’ve got them configured correctly.
You can check your own site by using the “Developer Tools”:
- Load your web browser, and right click on the main area and select “Inspect”
- A new window may open, or it may take over part of your browser, either way click the “Network” tab in this screen
- Now load your website in the usual way, you’ll see things appear in the Network screen
- If you don’t see a column called protocols, right click on one of the other columns and click “Protocol” in the menu that comes up
You can see from the example above that one of the resources on the site uses HTTP/1.1 still (Twitter in this case), others use h2 (HTTP/2.0) and h3-Q50 (the latest revision of the HTTP/3.0 standard).