Live data from Hacker News

CDN vs S3

jdorfman.posthaven.com

81–87 of 87 posts

Re: CDN vs S3

#81
post #79

Earlier quoted context omitted.

I don't think you're an idiot, it's more likely that you were just unaware of cloudfront or perhaps CDNs in general. S3 is for storing files, Cloudfront is for serving cached versions of them really quickly out of edge locations (i.e. the closest CDN datacentre to the user that requests it). In your usecase, your best bet is to use them in combination. Set up a Cloudfront distribution to point to your S3 bucket, then…

>If performance at the expense of convenience was your main reason for going with static site generation, you might want to rethink that decision (there are other perfectly good reasons for wanting to use a static site generator, security being my favourite). Great comment. I didn't get this part though. What would be a better alternative? Performance is one of the main reasons I considered this (uptime is another).…

> I didn't get this part though. What would be a better alternative?

To clarify: I'm not saying that static assets behind an edge cache is not performant, just saying that a dynamically generated site behind an edge cache is effectively the same performance wise. It's probably not worth the sacrifice in convenience if performance was your main reason for going the static generated route.

I can't speak to the argument from uptime as I haven't used shared hosting in a while. Using an edge cache (without S3) might give you a little help there, as it only needs to hit your shared hosting on cache expiry, but that obviously won't be as safe as statically generating the files and making CF read them out of S3.

I think S3 behind CF is a perfectly good approach. I was just saying that if you've currently got a dynamically generated site and are considering moving to static generation because of performance alone, the trade-off probably isn't worth the effort.

I wouldn't advise you personally to go back on that decision at all, especially because of the issues you've seen with uptime.

> I think my assumption was S3 did have edge locations

I think you get this from the rest of my comments but just to be clear: I've only ever experienced bad download times from S3 and would not feel comfortable recommending that you use it to serve traffic directly from the internet. It's not what S3 is for and so you shouldn't expect good performance from it in that use case.

Re: CDN vs S3

#82
post #73
post #33

Earlier quoted context omitted.

Honest question: Do you actually know anyone that thinks S3 is appropriate as a CDN?

Tumblr 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.

Using 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.

Re: CDN vs S3

#83
post #79

Earlier quoted context omitted.

I don't think you're an idiot, it's more likely that you were just unaware of cloudfront or perhaps CDNs in general. S3 is for storing files, Cloudfront is for serving cached versions of them really quickly out of edge locations (i.e. the closest CDN datacentre to the user that requests it). In your usecase, your best bet is to use them in combination. Set up a Cloudfront distribution to point to your S3 bucket, then…

>If performance at the expense of convenience was your main reason for going with static site generation, you might want to rethink that decision (there are other perfectly good reasons for wanting to use a static site generator, security being my favourite). Great comment. I didn't get this part though. What would be a better alternative? Performance is one of the main reasons I considered this (uptime is another).…

I was working on a site and noticed a 500kb background image was taking 2 seconds to load and around the same time I saw that the spotify homepage was streaming a fullscreen video instantly

I don't think that's a fair comparison - it seems unlikely to me that the video requires much data to get started, or a sustained 250kB/s (about 2 megabits/s) connection to play.

Re: CDN vs S3

#84

Just put Cloudflare in front of it, it's free :)

This 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).

Re: CDN vs S3

#85
post #53

For 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…

I think I'm going to go with CloudFront, but I'm pretty upset about not being able to use a naked domain.

Re: CDN vs S3

#86
post #53

For 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…

I wrote a static site generator at the beginning of this year:) https://github.com/jimktrains/gus

@jimktrains2 +1

Re: CDN vs S3

#87

Earlier quoted context omitted.

@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.

> 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.

CloudFront
Post reply on HN