Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

closed as not constructive by Greg Askew, Sven, Michael Hampton, Dave M, petrus Apr 4 '13 at 18:55

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

    
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 '13 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 '13 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 '13 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 '13 at 19:04

3 Answers 3

up vote 6 down vote accepted

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.

share|improve this answer
    
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. –  Tom Marthenal Apr 6 '13 at 15:48

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.

share|improve this answer

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.

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.