Hacker News new | ask | show | jobs
by Demiurge 4373 days ago
>Serve these through a CDN that is optimised for serving static files to ensure high transfer speeds and therefore increased user happiness.

I was not aware this was that common or even considered always the best practice. Is this really the best practice for any website? How exactly is a CDN more optimized than nginx on a dedicated server with 1GB connection?

5 comments

One of the reasons is that CDNs are geographically distributed so the files will be served from a datacenter closer to the client.
I personally don't find much use for a CDN when dealing with a typical website's CSS, JS, images until you have very large traffic. You can concat and minify your CSS and JS files, and add a cache control header to all static content. That should be good enough until you get very large traffic.

But like anything, it depends on the use case. If the product is primarily a file server like Dropbox then maybe using a CDN early makes sense. Or your smallish number of users are spread across the world might be another use case.

The very nature of the kind of content you're serving over a CDN seems to indicate that unless you're extremely high traffic, the benefits are few: most of your clients are going to grab the static content from you once at a cost of a few hundred extra ms, and then rarely need it again.

I think having CDN as a basic requirement for all projects is... ill-considered. Remember, using a CDN is giving away data about your users' browsing practices without their consent.

At a minimum, a CDN automatically caches and serves content from multiple servers globally.
Is it worth it if you have a US specific website that doesn't get that many users (~3 sessions at once)?

Also, another website I administer has a lot of user uploaded content that's constantly changing. I've not dealt with a CDN before, so I don't know how CDN helps with that? I think only a fraction of the data is static in this case.

PS Why the hell would someone downmod my honest question?

Not sure about the down mod, but I think the point of the OP is to address projects that have the goal of driving a "startup" business.

In addition, with mobile, getting rid of any network latency you can is going to help.

In general, though, I think you are right to ask the fundamental question. That said, it's something a lot of people end up needing anyway and it helps if you design for it up front.

tl;dr - If you're building a low-volume site, the OP probably doesn't apply to you.

That makes sense, thanks :)
Is there an entry level CDN. Enter your credit card and get access, upload files and go. For a few bucks a month.
Look at CloudFront from AWS. CloudFiles from Rackspace used to also include built-in (no additional charge) distribution over Akamai as well, though it had limitations on the number of purges you could do, I think.
Fastly can easily be setup on top of s3 and we have been super happy with their basic layout and then their advanced features as we needed more (ssl content delivery, selective purging, etc)