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.

I am a website owner planning to use Amazon's cloudfront S3. I have been reading all the stuffs about what a CDN can do but i still have an unanswered question.

Does a CDN still work even when my main server is down. That's the main reason i am interested in it. Because, my server usually experiences frequent outages due to power failure here in Mali.

share|improve this question
3  
You may want to consider CloudFlare, which is a) free and b) can keep your static pages up during an outage. –  ceejayoz Nov 25 '12 at 17:32
add comment

6 Answers 6

CDN's are designed for scalability and performance, but not for high availability. At any given time, they may require access to the original files.

Most people use them to store static files such as images, css and javascript files. Some can be configured to cache HTML, but that's only if you have a completely static website. If that were the case, you could host the whole thing on S3 and wouldn't need a server at all.

share|improve this answer
add comment

It would depend on who is hosting your CDN. If you host your website on one server, and the CDN with a 3rd party then it is likely that your CDN will remain active when your website it down. This may not be the case however, as some CDNs only distribute content they can verify is on your website.

A side note, CDNs are not for hosting your whole website. So if you're thinking that you can use one to replace your web hosting or use it as some sort of failover plan, you're barking up the wrong tree.

TL;DR - You'll have to ask your CDN provider.

share|improve this answer
add comment

Generally, yes, up to the TTL.

When using CDNs you usually configure TTLs (time to live) for your content. This is a maximum on how old the cache can get before it decides it absolutely has to refresh the cache with the newest content. For example, suppose you configure all *.jpg URLs to have a 5 minute TTL.

Then if your server goes down, you have an extra 5 minutes to bring it back up before users will notice. Well, at least for .jpgs. Well, at least for .jpgs that happened to have gotten cached beforehand.

Also, some CDNs use features like Akamai NetStorage where you can upload content directly to the CDN -- the CDN is given some content and told to serve it directly a priori. Since there's never an "on-demand" "pull" style caching going on here to begin with, that should of course work when your server is down.

As the other posters noted though, this isn't what CDNs are designed for and they provide NO guarantees that this behavior will work. It just happens to usually work (and it's awesome when you watch it happen!). And of course for specific technical details you'd have to contact your provider.

share|improve this answer
add comment

Most CDNs are caching (dynamic) content for a period of time (TTL) from the origin, in this case your server. In Amazon's Cloudfront Management Console the cache-control of a S3 bucket is explained.

  1. The default behavior of Amazon's S3 is to cache an object 24 hours.

  2. You can influence the default behavior, by supplying/writing a Cache-Control header on your origin server or an Expires header.

    • When you use the Cache-Control max-age header, the minimum value is 0. At that point, Amazon will content your origin server, to check if the object has changed, every time.

    • When you use the Expires header for an object, Amazon will not contact your origin server until that date.

I hope this clarifies Amazon's behavior.

share|improve this answer
add comment

Yes: the CDN servers will still be running even while your site is down, which is a good option to have for handling major outages. You have a fair amount of control over what happens so you can tailor the experience based on your resources and priorities. The options generically fall into these categories:

  1. Objects which have been configured for caching (most commonly by setting the Cache-Control header) should be available until they expire. Some CDNs offer the ability for CDN edge servers to retrieve content from other CDN servers, which can help during outages as well as generally improving performance when your origin servers are comparatively high latency relative to the CDN servers.

  2. Some CDNs offer the ability to serve content which has expired when your backend server is unavailable (e.g. with Fastly you can enable Varnish's grace or saint modes). Obviously this won't help with content which was never cached but in many cases it could at least keeps your core homepage, contact info, etc. online while you work to get your servers back online.

  3. Most CDNs offer the ability to try multiple backend servers so you could have a separate failover site provide the experience which makes sense for your site: failover to another server or reduced functionality site, a static HTML page, etc. This can be useful for catastrophic hosting failures since you have the option of hosting with a completely different company or, in the case of something like Akamai NetStorage, directly with the CDN provider so they will support the full stack.

With the exception of the third option, you have no control over what will be cached on the CDN servers so the most important part of the process is deciding how your site can degrade if various features aren't available: for example, if you have reasonable HTML content even when JavaScript fails completely a mostly information-driven site might be able to run with only basic page content even when more advanced features are quietly failing in the background.

share|improve this answer
add comment

I was a Support Engineer at a CDN for over a year and I will say all of the answers here are great but IMO @Chris-Adams has the best answer (if I could up-vote it I would).

One thing our customers do is point www to the CDN and 301 the TLD to www. If an objects TTL expires then the edge will serve the expired content if it is available in cache.

With that said, if uptime (and fresh content) is important to you then I would consider moving your origin (pain in the butt I know) to a host that doesn't experience frequent power outages.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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