Live data from Hacker News

Is Nginx obsolete now that we have Amazon CloudFront?

peterbe.com

61–64 of 64 posts

Re: Is Nginx obsolete now that we have Amazon CloudFront?

#61
post #23

I think not. Requirements change, and locking myself in to a front-end cache is not appealing. I may also have things which I can't or won't let others cache for me, so I want my local stack to be optimized anyway. You won't see me serving everything out of WEBrick anytime soon just because I have a cloud cache. It's nice to be able to defer decisions, especially optimizations, but making performance someone else's p…

On several of my modern projects, there's not a single piece of static data that can't be cached forever in a CDN. That's because server-side code is not getting really good at managing the initial build of static assets and the delivery of their URL.

errr. just because it's static, and a pdf, doesn't mean you want it cached on amazons servers.

sensitive business documents and such.

Re: Is Nginx obsolete now that we have Amazon CloudFront?

#63

How does this shit make it to the front page? First and foremost, everyone needs caching. It's what makes computers fast. That RAM you have? Cache. The memory in your CPU? Cache. The memory in your hard drive? Cache. Your filesystem has a cache. Your browser has a cache. Your DNS resolver has a cache. Your web server's reverse proxy [should] have a cache. Your database [should] have a cache. Every place that you can…

But if the CDN is serving your static assets, your origin webserver only has to generate them once [1] to populate the CDN. It almost doesn't matter how long this takes. And this works well enough that you don't need to bother setting up an Nginx or Apache instance at all . And furthermore, you don't have to copy your static files anywhere -- just use your framework's built-in webserver for everything! This greatly s…

How you use a CDN is site-specific. Some people still need to serve hundreds of thousands of requests via a caching frontend layer separate from their CDN origin. It's silly to assume you will never need a fast web server, because unless you aren't serving dynamic content, you will be serving content yourself and the rate will be consistent with the number of users, among other things.

Using a CDN does not actually simplify production deployment, it complicates it. It's an extra layer of complexity, and one you don't know very much about since it isn't your gear. You need an API hook (or a web interface) to invalidate old content when you publish new content. You need a contact with whom you can figure out why a tenth of your users can't route to the CDN all of a sudden, but can route to you. You need to get all your headers right so you don't accidentally push an invalidate to all content and kill your slow-ass origin with new traffic.

Finally, as someone else mentioned, using a framework webserver for production is A Bad Idea(TM). Only one of the reasons why is poor performance. Several others are security, compatibility, cache control, access control, privilege separation, stability, high-availability, virtual hosting, and about a billion other features that webservers have been designed to handle for decades that you will need to reinvent the wheel for with your application framework, which was never intended to be a webserver.

The reason your framework has a webserver is it's the simplest way to get the dynamic content from the app server to the frontend proxy. For example, AJP is such a huge pain in the ass that most Tomcat admins I know use http to communicate between app server and frontend (and it's more compatible). But would they use Tomcat as their production server? Not if they wanted to stay sane.

Re: Is Nginx obsolete now that we have Amazon CloudFront?

#64
post #23

Earlier quoted context omitted.

On several of my modern projects, there's not a single piece of static data that can't be cached forever in a CDN. That's because server-side code is not getting really good at managing the initial build of static assets and the delivery of their URL.

errr. just because it's static, and a pdf, doesn't mean you want it cached on amazons servers. sensitive business documents and such.

If it's serious enough, why are you serving it as a static, unprotected resource?
Post reply on HN