1

Normally when I hear about CDNs and how great they are, they're usually talking about serving a site's static content, like images, CSS, JS, and video.

But if CDNs are so great, why don't we run entire sites off of them, instead of just the static content?

4
  • They're "great" because they do one thing and do it well. Trying to do everything you end up with something that is not "great".
    – Chris S
    Apr 4, 2013 at 17:41
  • It's not a CDN per say but the equivalent of what you are describing would be to host your dynamic content in a cloud such as Amazon Web Services.
    – Alex
    Apr 4, 2013 at 18:11
  • @Alex There's not really anything special about "the cloud". It all runs on servers - you can make an AWS-alike system in your own datacenter, if you want.
    – ceejayoz
    Apr 4, 2013 at 18:49
  • @ceejayoz you sure can make your own cloud, you can also make your own CDN. My point was that, the equivalent of getting a third party CDN to distribute dynamic content is getting a third party to host such content in their cloud.
    – Alex
    Apr 4, 2013 at 19:04

3 Answers 3

7

CDNs are configured to not allow dynamic content to run. You are paying them for bandwidth not for processing power. The reason for this is for security of their servers as if you could run ASP.NET or PHP you'd have access to a lot more of their systems than you have now. Also there's session state issues, etc.

1
  • In addition to the security aspect, allowing you to run dynamic content would massively increase the amount of CPU resources needed. The servers used by CDNs typically have lots of memory and disk space, but not very powerful CPUs, since all they're doing is serving files. They would need a completely different machine configuration if they were to permit you to run code. Apr 6, 2013 at 15:48
5

CDNs are can't generate dynamic content, they only fetch stuff from an origin, cache it, and deliver it from local edges.

Many people do put their entire site behind a CDN and have it cache pages. For example etsy.com caches their homepage for non-logged in users. However, once a user logs in, there is a requirement to show that username, which requires dynamic content and there for still must go to the origin.

2

It's entirely possible, and it's been done before.

Here's a writeup from NPR on how they host high-load sites off S3/CloudFront and use a server instance just to push new data to it.

2
  • Those are still semi-static sites... I suppose most websites are, but calling it "dynamic" would make my skin crawl.
    – Chris S
    Apr 4, 2013 at 17:42
  • Semi-static, yes. For something like a forum, an approach like CloudFlare is more likely.
    – ceejayoz
    Apr 4, 2013 at 17:43

Not the answer you're looking for? Browse other questions tagged .