11 questions (and answers) about content delivery networks and web performance

I get asked about content delivery networks (CDNs) and how they fit into the bigger performance picture all the time, both in-house here at Strangeloop/Radware and out in the world. So it came as a huge surprise to realize that I’ve never corralled the most common questions in a post before. I wrote this piece as much to help myself as anything else — to have my answers all under one roof for future reference — but you may find it useful, too.

1. What performance problem does a CDN solve?

While content delivery networks also solve ancillary problems such as improving global availability and reducing bandwidth, the main problem they address is latency: the amount of time it takes for the host server to receive, process, and deliver on a request for a page resource (images, CSS files, etc.). Latency depends largely on how far away the user is from the server, and it’s compounded by the number of resources a web page contains.

For example, if all your resources are hosted in San Francisco, and a user is visiting your page in London, then each request has to make a long round trip from London to SF and back to London. If your web page contains 100 objects (which is at the low end of normal), then your user’s browser has to make 100 individual requests to your server in order to retrieve those objects.

Typically, latency is in the 75-140ms range, but it can be significantly higher, especially for mobile users accessing a site over a 3G network. This can easily add up to 2 or 3 seconds of load time, which is a big deal when you consider that this is just one factor among many that can slow down your pages.

A CDN caches static resources in distributed servers (AKA edge caches, points of presence, or PoPs) across a region or worldwide, thereby bringing resources closer to users and reducing round trip time, as illustrated in this admittedly crude graphic:

How a CDN works

2. Does a CDN help in every situation?

A CDN is a must for many sites, but not necessarily for every site. For example, if you’re hosting locally and if your users are also primarily local, a CDN won’t help you much.

Contrary to what some site owners believe, a CDN is not a standalone performance solution. You need to bear in mind that, in the ecommerce and SaaS worlds, two of the most common performance pains are third-party content and server-side processing. Your CDN can’t help you with those.

3. Are all CDNs created equal?

The CDN you pick really matters. Your benefits will vary depending on which provider you choose, as well as things like how your CDN stores content and how far their PoPs are from users. To pick the most effective CDN for your site, first you need to know where your users are.

As well, latency can vary hugely among different providers. About a year ago, we did some ad hoc testing of three of our customers’ sites to measure, among other things, the differences between desktop and 3G latency. Each of the sites we measured used a different CDN, and as you can see, there was a pretty broad range in median desktop latency:

4. Does CDN performance vary, even with the same CDN?

In a podcast interview a while back, Turbobytes founder Aaron Peters stated that, after his company studied the real-world performance of some leading CDN providers, he discovered that performance fluctuated a lot more than expected. (At Velocity last year, Aaron delivered a great session on measuring CDN performance, which you should check out if this is an area of interest to you.)

5. Are CDNs effective for mobile users?

I wrote about this a few weeks back, but the short answer is this: Yes, CDNs are somewhat effective for mobile users, but it may be hard to rationalize the cost based on the marginal return.

In the case study I described, we stepped through a series of acceleration treatments on a page to measure the impact of each treatment for mobile users. When we added the CDN, we found that:

  • Doc complete time decreased by 10%, compared to a 20% improvement we noted in a similar experiment in desktop optimization.
  • We shaved less than a second off start render time, taking it from 7.059 seconds down to 6.245 seconds.

So while there were performance gains, they were not hugely significant. However, I wouldn’t want to say that CDNs are ineffective for mobile. I offer this as a speaking point for when you’re talking with CDN providers about what they can do for you on mobile.

6. Does using a CDN guarantee 100% availability for my site?

Every CDN provider I’ve encountered guarantees nearly 100% availability, even during massive power outages, hardware issues, and network problems. The basis for this guarantee is the fact that CDNs have automatic mechanisms that sense server availability, with instant user redirection if a server (or servers) go down.

So what does “nearly 100% availability” actually mean? A CDN’s uptime guarantee should be outlined in its customer SLA. I’ll also suggest that if you’re interested in a particular provider, you should Google “[CDN name] outage availability” and see what kinds of news stories come up.

7. Do most leading sites use a CDN?

No. According to our most recent surveys of leading ecommerce sites, 79% of the top 400 ecommerce sites in the EU and 75% of the top 2,000 ecommerce sites in the US don’t use a recognized CDN. (A “recognized CDN” refers to any CDN listed in the extensive directory of CDNs maintained by WebPagetest.)

Cost is probably the most prohibitive factor for many site owners, but in the last year or so, more competitively-priced options have come on the market.

8. How do CDNs and front-end optimization compare when it comes to delivering faster pages?

To get the best acceleration results, most of our customers use a combination of front-end optimization (FEO), content delivery network (CDN), application delivery controller (ADC), and in-house engineering.

As we’ve already covered, CDNs address the performance middle mile by bringing resources closer to users — shortening server round trips and, as a result, making pages load faster. FEO tackles performance at the front end so that pages render more efficiently in the browser.

The benefits of combining content delivery with FEO aren’t news if you’ve been reading this blog for a while. As the table below (which uses data from this case study) shows, this combined solution has a huge impact on page metrics, from number of requests to payload to start render and load times.

Performance benefits: Content delivery network (CDN) + front-end optimization (FEO)

The bottom line: a combined CDN/FEO solution can make pages up to four times faster.

We also did something similar to the stepwise acceleration experiment outlined in question #5, but for the desktop instead of mobile. This side-by-side video shows the impact of applying a series of best practices — keep-alives and compression, CDN, and advanced FEO treatments — to an unoptimized page.

Here’s how they stacked up in terms of delivering above-the-fold content:

  • Unoptimized: 16 seconds
  • With keep-alives and compression: 9 seconds
  • With keep-alives, compression, and CDN: 7 seconds
  • With keep-alives, compression, CDN, and FEO: 3 seconds

There are other benefits to using an automated FEO solution to complement your CDN, such as:

  • Renaming files so they can be served from a CDN can be time consuming. FEO solutions can do this automatically, thus saving a lot of developer time.
  • Adding expires headers is a performance best practice that you should be taking advantage of. While adding headers is relatively easy, dealing with versioning is tricky, especially if you use a CDN. You either need to keep someone glued to the CDN purge tool or you need to use a tonne of dev hours integrating with your CDN’s API. An automated solution takes care of this for you, again saving a lot of dev time and eliminating the margin of error.

9. Can CDNs use SPDY?

Google’s SPDY is a protocol for transporting web content, designed specifically to address latency. Early tests found that SPDY delivered load time improvements ranging between 27% and 60% over HTTP.

SPDY has not been widely adopted by the content delivery industry. In a recent podcast interview, Google’s Ilya Grigorik discussed why widespread CDN adoption of SPDY would be a huge boon, not just for SPDY, but for optimization best practices in general, and ultimately for end users.

10. How competitive is the CDN market today?

This is a good time to be a site owner. A few short years ago, content delivery solutions were a luxury that only deep-pocketed mega-sites could afford. (Think monthly CDN bills in the hundreds of thousands of dollars.) Now there’s a growing selection of competitive products backed by innovative companies offering newer technology that plays well with other technologies such as real user monitoring (RUM).

To get an idea of who the major players are, check out this list of notable CDN providers. For analysis, Dan Rayburn does an excellent job of staying up to date on whom to watch in the CDN space. If this is a space that interests you, his blog should be a must-subscribe.

11. How do I choose the right CDN for my site/business?

I was about to start writing an answer to this one, but then remembered that Dan wrote a great detailed post here. Thanks, Dan! 🙂

If you have questions about these questions — or if you have brand-new questions — let me know in the comments. This post is a living document, so I’ll be updating with fresh content as I find it.

Related posts: