10 ms·
CDN vs S3
- MichaelApproved 13y agoI was using S3 to deliver secure signed downloads to customers. It worked well enough for a long time but eventually customers started having major connectivity issues and dead slow downloads. I switched to CliudFront and, of course, downloads improved dramatically. I had to go with CF because we needed signed downloads. Would be nice to have alternatives but I'm happy with CF.
- davidandgoliath 13y agoI thought this was obvious? Amazon's Cloudfront on the other hand is a CDN and works great :)
- jdorfman 13y ago@davidandgoliath you would think so. But a lot of companies ignore it.
- davidandgoliath 13y agoYou also seem to have ignored it in your post, any reason you didn't test cloudfront?
- jdorfman 13y ago@davidandgoliath I work for MaxCDN so I would probably get fired. =P
- marceldegraaf 13y agoWhy would you get fired for covering an obvious and well-known CDN alternative in your blog post? Honestly interested :-)
- jonny_eh 13y agoBecause it's not in his or his company's best interest? I bet that Cloudfront's performance isn't too different from MaxCDN's.
- mathrawka 13y agoSo you post something that basically compares apples and oranges? Honestly, this post turns me off from MaxCDN.
- corin_ 13y agoAgreed. Especially if he was well aware that AWS offers a comparative service, but instead chose to compare to a different one.
- deleted 13y ago[deleted]
- asb 13y agoIf only Route53 allowed you to point the apex domain at Cloudfront (as I understand it, it's currently S3 or ELB).
- tzury 13y agoYou may not want to do so as: 1) POST (and so are PUT, DELETE, OPTIONS and CONNECT) are not yet supported on CloudFront. 2) HTTPS/SSL for your own domain is not yet supported on CloudFront.
- getdavidhiggins 13y agohttps://twitter.com/zeeg/status/297888975463542784 https://twitter.com/zeeg/status/297888975463542784
- kmfrk 13y ago$ curl -I http://phaven-prod.posthaven.netdna-cdn.com/uploads%2F2013-05-17%2F20%2F3128%2FErQE0vKlNMIeNvaxbneY75nWy HTTP/1.1 403 Forbidden Date: Sat, 18 May 2013 20:31:08 GMT Content-Type: application/xml Connection: keep-alive x-amz-request-id: 41706FB9149898AF x-amz-id-2: d5F1JMIBLaQzNG5A Boo. :)
- jdorfman 13y ago@kmfrk PostHaven cut off the URI: curl -I http://phaven-prod.posthaven.netdna-cdn.com/uploads%2F2013-05-17%2F20%2F3128%2FErQE0vKlNMIeNvaxbneY75nWyy4%2Fs3ul27%2Fposthaven-loves-maxcdn.png http://phaven-prod.posthaven.netdna-cdn.com/uploads%2F2013-0... HTTP/1.1 200 OK Date: Sat, 18 May 2013 20:34:13 GMT Content-Type: binary/octet-stream Content-Length: 52958 Connection: keep-alive x-amz-id-2: NO6o51/19JsQJN9YHc+T/sraZSGNT+f3R+1GWl2QL3aD4SubqazjbMURb4VYaZyS x-amz-request-id: E640348D2D6EDA7B Last-Modified: Sat, 18 May 2013 00:47:10 GMT ETag: "f95534e9752b560f4acdda20228f90ba" Server: NetDNA-cache/2.2 X-Cache: HIT Accept-Ranges: bytes
- geoffhill 13y agoAmazon Web Services does offer a worldwide CDN, CloudFront. http://aws.amazon.com/cloudfront/ http://aws.amazon.com/cloudfront/
- philip1209 13y agoCloudfront doesn't offer some services that I find necessary, such as nested directory indices (e.g. example.com/folder/ instead of example.com/folder/index.html) and it doesn't return a 404 header on missing pages. I just emailed MaxCDN to see if they provide these.
- jcastro 13y agoSince this thread will likely turn into people asking about Cloudfront performance, does anyone have any real-world experience with CloudFront vs. Rackspace with Akamai CDN? On paper the Rackspace one looks like a great performance/price alternative.
- jcampbell1 13y agoI am in the process of abandoning Cloudfront, because they have a serious bug when serving video files. They serve HTTP 206 (Range-Get) as HTTP 1.0 but 206 didn't exist in HTTP 1.0. Chrome and Firefox treat this as "uncacheable", thus media assets bypass the local media cache. Depending on the nature of the content, Cloudfront is not usable for video, particularly the kind where people seek around a bunch, like instructional videos and tutorials. Also, people with slow connections expect the video to buffer while paused. This doesn't happen if you serve the videos from cloudfront.
- deleted 13y ago[deleted]
- v13inc 13y agoWhy would Cloudfront cause the player to stop buffering the video? Does it happen with a HTTP Download distribution, or the RTMP streaming distribution? I've used both CloudFront and Akamai for serving video, and I don't remember running into those issues. I have only tested it with normal HTTP Download distributions, however.
- jcampbell1 13y agoCloudfront serves an invalid HTTP response, thus Chrome/Firefox refuse to cache the data. The theory is, it is better to not risk caching bad data. Chrome will still play the video served from Cloudfront, but it wont write any of the data to the media cache. Thus when you pause and buffer, it will only buffer a few seconds of video in the current playback window. It never writes to the cache so buffering must stop. To see this in action, play a video with chrome://media-internals/ open. A video served from S3 will get saved to the media cache, and the full video can buffer when paused. A video served from cloudfront will only buffer a few seconds of video. Update: It is probably just easier to see for yourself: Here is a video served from S3. Pause the video in chrome, and you will see the whole video gets buffered: http://s3.amazonaws.com/jctest20080526/test/test.mp4 http://s3.amazonaws.com/jctest20080526/test/test.mp4 Here is the same video served from Cloudfront. Start the video, and pause it, and notice how it doesn't buffer more than a few seconds: http://d3oocspv43fsel.cloudfront.net/test/test.mp4 http://d3oocspv43fsel.cloudfront.net/test/test.mp4
- deleted 13y ago[deleted]
- molecule 13y agoobvious: Amazon product isn't that great @ a service that's optimally provided by another Amazon product. http://aws.amazon.com/cloudfront/ http://aws.amazon.com/cloudfront/
- jdorfman 13y ago@molecule obvious to you and I. I wrote this to inform those who think it is a good idea to use S3 as a CDN, that it isn't. If we can educate a few developers then we (this awesome community of hackers) are making the web faster.
- fintler 13y agoSo why is the title of your post "CDN vs S3"? Shouldn't it be something like "Don't use S3 as a CDN"? To be honest, your post feels like spam for MaxCDN.
- zwily 13y agoHonest question: Do you actually know anyone that thinks S3 is appropriate as a CDN?
- Kudos 13y agoTumblr and Twitter both used to, and I've met a bunch of developers at meetups who rather than think S3 is a CDN, do not understand what a CDN is.
- kalleboo 13y agoUsing S3 for file hosting is still a better solution than using a raw box (or shared virtual hosting) which is what most people who use S3 instead of a CDN would have been doing otherwise.
- molecule 13y ago> If we can educate a few developers then we (this awesome community of hackers) are making the web faster. You're not making the web faster, you're shilling for your employer by comparing their apples to a competitor's oranges and proclaiming "our competitor's oranges make bad apple sauce!" Failure to mention CloudFront is disingenuous.
- iambibhas 13y agoWho said s3 is a CDN at the first place!?
- obviouslygreen 13y agoCertainly not Amazon, or they wouldn't have provided a service that acts as a CDN based on an S3 bucket.
- alinajaf 13y ago> I think S3 is a great origin server for static assets Pro-tip: If you're using Rails, just create a distribution with your app as the origin server and in production.rb, set your asset host to your distributions host. You get the asset cache without having to do the precompile step. Tastes great with Heroku.
- amalag 13y agoThis is smart, I usually use the precompile with upload to S3 via asset_sync gem. Since Heroku will precompile by default, what do you do to disable it. Just turning on config.serve_static_assets = true is likely not enough.
- alinajaf 13y ago> This is smart, I usually use the precompile with upload to S3 via asset_sync gem I used to do the same until cloudfront rolled out custom origins. > Since Heroku will precompile by default, what do you do to disable it. I misspoke in my comment, what I meant was you can skip the synch with S3 step. I've never actually bothered to stop heroku precompiling assets (though I may as well). This question on SO looks promising: http://stackoverflow.com/questions/8953360/preventing-heroku-from-using-precompiled-assets-in-development-mode http://stackoverflow.com/questions/8953360/preventing-heroku... If you do that though, as you mentioned, you will definitely need to flip serve_static_assets on.
- Icer5k 13y agoTrue, S3 is not a CDN, but for a lot of use cases, serving directly from S3 is fine. Taking Vine for example, I picked a random vine from twitter (https://vine.co/v/bE3YI365gxd https://vine.co/v/bE3YI365gxd) and a popular vine from twitter (https://vine.co/v/bEFFxdwjK9x https://vine.co/v/bEFFxdwjK9x). The popular video and thumbnails are served from a CDN, where the new one with no traffic is served directly from S3. YouTube did the same thing in it's early days. CDNs are not required for all traffic, and blindly recommending them is a bad prescient. They're really great for content that is frequently accessed, but their value greatly decreases on long-tail content.
- obviouslygreen 13y agoWhen S3 first came out, people used it for this without considering its latency issues, and it was a disaster. S3 is not a CDN and shouldn't be used as one; this is the reason for CloudFront. While I can't compare CloudFront to other CDN's, I do know it works well for my clients that have been using it (and certainly better than serving directly from S3).
- jefe78 13y agoAs the sysadmin to a company that does use both S3 and Cloudfront, I'm a little shocked anyone would think to use S3 for distribution. A little testing will reveal just how slow S3 can be.
- jere 13y agoFor everyone saying this is obvious: I'm one of those idiots that didn't quite get it and I appreciate this post a lot. For the past week, I've been working on writing a little static site generator and putting it on S3 and I thought I was pretty damn clever for finally getting around to doing that... except now it turns out I'm clueless yet again. I'm looking at Cloudfront now, but I'm still not sure if has all the features that I was expected out of S3 alone (someone already mentioned Route 53 integration).
- jimktrains2 13y agoI wrote a static site generator at the beginning of this year:) https://github.com/jimktrains/gus https://github.com/jimktrains/gus
- jdorfman 13y ago@jimktrains2 +1
- jcastro 13y agoCheck out cloudpress: https://github.com/cloudpress/cloudpress https://github.com/cloudpress/cloudpress
- jedberg 13y agoBack Fastly with your S3 static site. Works really well.
- tzury 13y agoYou should simply put CloudFront in front of S3. In that case, you get the benefit of both worlds.
- aritraghosh007 13y agoYou should really be using CloudFront and "NOT" S3 if you are looking for a CDN solution. There is a reason why CloudFront exists after all. S3 is a merely a drop-in storage option, consider it as a big file system residing within big fat piped data centers.
- 13y ago
- fs111 13y agoWhat is next? A blogpost saying "Hammers are terrible screwdrivers. Don't use a hammer with a screw!"?
- chj 13y agoWhat do you think CloudFront is for?
- hybrid11 13y agoJust put Cloudflare in front of it, it's free :)
- xur17 13y agoThis is what I ended up doing. I've been using Cloudfront for a while now, but Cloudflare is free, and people seem to indicate it is just as fast if not faster. I have my static assets on a sub-domain, so I just set cloudflare to cache everything on that subdomain (and left it off on everything else).