Implementing a content delivery network, also known as a CDN, is an effective way to speed up page load times.
When a user clicks to load a webpage, a request is made from your IP address via the domain name’s server. This request is sent to the IP address of the server that hosts the webpage, so that they can send back the necessary data.
If the user request starts in the UK, but the page is hosted in a faraway location e.g. Australia that’s quite a distance for the request to travel. Plus, much like British Airways, the request can’t ‘fly direct to Australia’ – it has to be re-routed at various server ‘layovers’ on the way.
Intuitively, it makes sense that a server request from the UK to Australia will take longer to execute than one from the UK to Germany. Although, unlike in the example of aeroplanes, with server requests we’re talking a difference of milliseconds, rather than hours or days.
A difference of a couple of hundred milliseconds might not sound like a major concern, but with page load times an extra half a second could be enough for the user to hit the back button and abort the request. Studies have shown that an extra one-second page load delay can cause a 7% reduction in conversions for ecommerce sites, for example.
Okay, but what is a content delivery network?
Put simply, a content delivery network is a way of minimising the physical distance between the request and the server.
A content delivery network stores a cached version of the content that’s being requested in various locations around the globe. These locations are called ‘points of presence’, or PoPs. These PoPs will all hold a cached version of the webpage.
When a request for the content is made, the CDN works out where the request is coming from, and then looks for the PoP that is closest geographically to the IP address the request came from. This negates the need to send the request all the way from the UK to Australia, for example. Instead, the request will go to the nearest PoP to access the content, and therefore minimise the page load time.
How does a content network...work? Push or pull?
There are two distinct configurations for CDN technology: push and pull. The main difference between them is the stage in the request process where the content is served to the CDN.
After setting up a pull CDN configuration for a web server hosted in the UK, the very first time a content request is made,say from Australia, the CDN has to figure out which PoP is closest. After that, the PoP pulls the content from the host server, before presenting it to the user. From that point, the cached content is available on the Australian PoP to be served locally.
The difference with a push CDN is that the content is pushed out to the PoPs from the start; a push CDN doesn’t wait for the request to be made. The advantage of this is that the first user doesn’t have to wait that extra step for the content to go from the host server to the local CDN.
However, it's worth noting that the additional delay on a pull CDN configuration is only for the first user in that geographic location. All subsequent users in the area are presented the cached version as normal.
The disadvantage of a push CDN is that it requires extra configuration to keep content up to date. When updates are made to the website on the host server, there can be a delay of up to 15 minutes before the content is updated on all of the PoPs in the content network. During this time, a user would either see outdated content or a ‘file not found’ page.
Why use a CDN?
The most obvious reason is the described improvement of page load speed. It’s realistic that a four-second page load time could be decreased to two seconds with cached content on a properly configured content delivery network. This has immediately obvious benefits for metrics such as bounce rates, page views and conversion rates. Remember, 25% of users will bounce if a page takes more than four seconds to load.
CDNs can also be used for load balancing when a webpage is seeing a surge in traffic. If content is being pulled from the same PoP location because the surge in traffic is all local, a CDN can help manage this. For example, if the traffic is all coming from the UK and being pulled from the UK PoP, the load on the PoP will increase, which will negatively affect the performance of the website.
However, an intelligent CDN will begin to balance this load by redirecting traffic through, say, a German PoP. Although the latency will increase because there’s more physical distance between request and PoP, the page load time will remain lower because there’s less load on the German PoP than there is on the UK one.
As well as the improved latency and page load times, CDN technology has other benefits. Because server requests are effectively coming through a proxy in the form of PoPs, there are certain security benefits to a content delivery network as well. CDN technology can be configured to protect from malicious requests like denial-of-service attacks. The CDN can tell if the request is malicious based on things like IP address and payload, as well as frequency and volume of requests. Because the CDN is ‘outside’ of the host server, it can block these requests and the host server will remain unaffected.
If you don't want to set up a content delivery network, it's still important to consider where your website is hosted. Cloud Servers from Fasthosts let you choose between servers in the UK, Germany, Spain and North America, so consider where most of your traffic will come from before choosing a data centre.