What you need to know about Content Distribution Networks (CDN) and performance – CDN Part 1

Date: 8th April 2015
Author: Deri Jones

Today, Content Delivery Networks (CDNs) are often an essential tool for optimising website performance as they provide a way of minimizing the time taken to load web content requested by a user. However, while their function is to deliver content quickly they can also affect a user’s experience if they do not work properly.

CDNGaining visibility of your CDN

Recently one of our clients was seeing slowdowns when certain objects were being served and wanted to know whether the cause was related to the CDN or not. They asked if we could help them by integrating a feature into our monitoring service, to measure the percentage of CDN hits and misses; that is how many requests were delivered by the CDN cache and how many were going back to the origin server. So, were the images being served from the CDN cache or were they being fetched back from the origin server?

If a CDN has to go back to the origin-server it could be for a number of reasons, for example, the object is dynamic and needs to be built or the object isn’t held in the CDN cache. By checking CDN cache headers for hits and misses, they were able to rule out the CDN as the cause of performance issues. So, if it’s not CDN related then what is it? The potential causes could be many but ruling out the CDN means helps track down the true root cause such as configuration or infrastructure issues.

A CDN is a collection of web servers distributed globally. They deliver web content faster, with better availability and offer some scalability. CDNs store copies of the website content in multiple places – you may have heard the term they ‘maintain multiple Points of Presence’. This approach reduces the time it takes to get the content into the user’s browser because rather than having to come from the origin server the content is supplied by a server in close proximity to the user therefore eliminating some latency in the page-load time.

The CDN addresses network latency by caching page resources often static (text, images, scripts) but also streaming media (video) on its globally distributed web servers. In this way the resources are physically closer to users and the round trip time is reduced. Time sensitive content such as price and stock levels by nature are not cached in a CDN as they need to be provided in real-time to the browser therefore come directly from the origin server.

Commercial CDN providers, such as CloudFlare, CDNetworks, and EdgeWorks have thousands of servers, all strategically placed around the globe enabling content to be delivered to users, according to their geographic location (time, products, etc) and user preference (language, currency, etc).

It all sounds good, eh? Up to a point it is, you can be reasonably sure that your customers are getting a better performance without any significant time lag.

Some things to watch on CDN performance

As is often the case, an increase in one aspect of web performance can lead to other problems. Perhaps the worst possibility for an e-commerce retailer is that your peak time is often the peak time of others. There is, therefore, a risk that CDN servers can get overloaded with requests as every other e-commerce site requests content at the same time. In theory, the closest CDN server will be handling this, but in practice, overloaded servers will hand-off requests to another server, which maybe some distance away, cancelling out any immediate advantage.

Another consideration is surrendering the control of your domain name servers (DNS) as the CDN provider would be running its own DNS service. This means that a company would be ceding control of its website to a third party and any DNS problem could leave the company website unobtainable.

Another paradox to consider is that a choice designed to speed up access to a website could end up sending customers old or out of date content – users receive information that goods are out of stock, when they are not (or vice versa) or get inaccurate pricing information. This happens when your CDN ignores the time-to-live value of the content. It would be galling to introduce a special price promotion only for it to lose its impact because of poor content delivery. A mistake that will ultimately cost sales and can damage your company’s credibility.

With the growing importance of mobile devices, do not forget the latency in last-mile mobile wireless. This bottleneck takes place between the smartphone and tower. The delay in traffic is due to low bandwidth, interference and other volatilities. While not directly a CDN issue, it can be mistaken for one.

Outsourcing to CDN provider may look as if it should provide a better service but it will not be very helpful if there is an underlying problem with the website. It’s a bit like a homeowner having a problem with some subsidence. Employing a plasterer to splash about on a bit of render to disguise the cracks in the brickwork will not do much help the underlying structure?

Moving content to a CDN provider does not help if there are problems with the infrastructure of the web server or the front-end of the website: whether these are coding errors, poor optimisation, server issues or whatever.   What’s needed is better performance visibility, a way to identify issues from the perspective of your customers, so you can find where the real faults are.

It’s not all doom and gloom

There’s nothing wrong with using CDN, just as long as you recognise that it’s not a standalone performance solution, be aware of the limitations and be prepared to take the appropriate actions to simulate your customers’ experience.

Read Part 2 of our blog for tips on how to avoid CDN performance pitfalls.