Ecton
Ecton

Reputation: 10722

Does file size matter when deciding to use a Content Delivery Network (CDN)?

I'm trying to figure out the effectiveness of using a CDN versus hosting images locally. Assuming that our load is such that serving an image or javascript file from the same server that is hosting the HTML content will not be any slower when compared against using a CDN, at what point does locality take effect?

My understanding of how a CDN works is that one request goes to the main CDN site for the file. This site only routes requests, so it issues a redirect to the other webserver that is (in theory) closer to the user making the request.

However, the overhead of 2 HTTP requests and 2 connections could actually add overhead compared to one request that suffers greater latency.

My question is, does anyone have any numbers or articles regarding at what file size decreased latency makes a big difference, and makes it an obvious choice to switch to a CDN?

Upvotes: 2

Views: 1402

Answers (2)

Alan Lapthorn
Alan Lapthorn

Reputation: 96

'at what point does locality take effect?' It very much depends on your traffic patterns. It might be that you host in country X and the majority of your customers are there too. A CDN might not be the right answer - you might want a robust caching tier in front of your application instead.

CDNs can provide in-country benefits such as better connection handling, reducing connections/requests/bandwidth to your origin, TCP optimization, DDoS protection, in addition to caching (which you've not mentioned in the original question). But it all depends on what you're willing to pay...

The further from your origin clients are, the more pronounced the benefits the CDN provides. And this will be the same whether the files are small or large.

Try some real world tests with a pay as you go CDN and see what happens.

Upvotes: 2

scunliffe
scunliffe

Reputation: 63606

Based on Yahoo's YSlow tool and any tests I've done, splitting across hosts for images, css, and javascript is a great idea and improves speed.

In addition, if you can manage it, serving up your static content from a domain that doesn't serve up cookies will also add a speed boost.

From the Yahoo developer help section for YSlow: http://developer.yahoo.com/performance/rules.html#cdn

"Remember that 80-90% of the end-user response time is spent downloading all the components in the page: images, stylesheets, scripts, Flash, etc. This is the Performance Golden Rule. Rather than starting with the difficult task of redesigning your application architecture, it's better to first disperse your static content. This not only achieves a bigger reduction in response times, but it's easier thanks to content delivery networks."

Upvotes: 3

Related Questions