Live data from Hacker News

Is Nginx obsolete now that we have Amazon CloudFront?

peterbe.com

31–40 of 64 posts

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

#31

Does anyone have experience with using nginx as a caching proxy? I've used Varnish and swear by it, it's just an amazing piece of software. How well can nginx replace Varnish?

It's great in tandem with Redis. http://mikeferrier.com/2011/05/14/my-beautiful-dark-twisted-...

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

#32
post #20

Earlier quoted context omitted.

Tools like Apache and nginx are not ONLY faster at serving files with less load on the system than a script. They are also more thoroughly audited and battle-tested. And their declarative configs won't go wrong just because the person writing them missed an unbelievably subtle corner case introduced by using a Turing-complete language. It's important because there are so many opportunities for error in serving arbitr…

Here's the thing: Django makes the standard staticfiles app available. It's a great convenience, eliminating extra steps (collecting/moving static assets) and processes (another nginx/etc). And many projects' 'dev'/prototype incarnations are already open to the world, in one way or another. So if this is a security sin, they've already encouraged its widespread commission. A bit of "don't do this" or "don't do this i…

"eliminating extra steps (collecting/moving static assets)"

Interestingly, we extended the collectstatic command in many ways to perform minification, combination of assets, generation of sass and javascript variables (based on settings in python), etc. It's part of our deployment and if we were serving static files through django, we would still have to run a similar command.

I'm also happy that nginx is handling file uploads, aliasing, redirection, virtual hosting on different IPs and Ports with different access control, real ip extraction (when behind a load balancer), etc.

I'll be following more closely this trend of moving static asset hosting from a regular web server to the application container, but I believe that web servers like nginx and apache can do a lot more than just serving static files (at least, in complex deployment scenarios).

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

#33
post #11

I was once told by somebody wise that if a post asks a question, then the answer is usually no. e.g.: Is Mountain Lion going to kill Windows 8? .. etc.

A meta-corollary: whenever a headline with a question mark appears on Hacker News, there will be at least one comment referring to Betteridge. (Please, can this stop?)

Why? I never heard about this "law", and now I just learnt about it.

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

#34
post #5

Sure it's obsolete, who needs databases and live, chancing data. All we need is a static pages. Besides who needs to build his own infrastructure, it's 2012 right ? Let's buy it.

This misses his point that originally he had app nginx user, then he added cloudfront so he had app nginx cloudfront user. At that point is nginx really serving much purpose?

I think for the average use case the answer is no, nginx doesn't buy you much. However nginx is a lot more flexible than cloudfront, so if you have more complicated caching rules and such nginx is a perfect fit.

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

#35
post #31

Does anyone have experience with using nginx as a caching proxy? I've used Varnish and swear by it, it's just an amazing piece of software. How well can nginx replace Varnish?

It's great in tandem with Redis. http://mikeferrier.com/2011/05/14/my-beautiful-dark-twisted-...

Hmm, that looks very interesting, but I've had Varnish serve 100k requests on a small (512 MB RAM) VPS without me actually noticing (I only found out when Google Analytics had a spike the size of a mountain).

Can nginx do that? It sounds like this solution wouldn't really be able to, having to go through Lua and all, but nginx is an all-around very solid piece of software too, so I wonder...

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

#36
post #11

Earlier quoted context omitted.

A meta-corollary: whenever a headline with a question mark appears on Hacker News, there will be at least one comment referring to Betteridge. (Please, can this stop?)

Ultra-meta: Whenever a repeating meme occurs on the internet, there will be someone asking for it to stop. And the answer to whether it will stop will be no.

Recursive-super-ultra-meta-induction: Whenever someone refers to a level of meta-ness, someone else will refer to level n+1.

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

#38
post #22
post #3

More generally: once you adopt any of the various schemes for having a inbound proxy/front-end cache (Fastly, CloudFlare, CloudFront, or an in-house varnish/squid/etc), are all the optimizing habits of moving static assets to a dedicated server now superfluous? I think those optimizing habits are now obsolete: best practice is to have a front-end cache. A corollary is that we usually needn't worry about a dynamic fra…

Regarding Django and staticfiles; Rightly so, because they're not ready for production and being taken over my the CDN. You need to sprinkle some django_compressor on it first but still that doesn't get the cache headers perfectly right. Or the gzipping.

Wouldn't it be great if a framework got the headers/compression right without sprinking extra options in?

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

#39
post #20

Earlier quoted context omitted.

Here's the thing: Django makes the standard staticfiles app available. It's a great convenience, eliminating extra steps (collecting/moving static assets) and processes (another nginx/etc). And many projects' 'dev'/prototype incarnations are already open to the world, in one way or another. So if this is a security sin, they've already encouraged its widespread commission. A bit of "don't do this" or "don't do this i…

"eliminating extra steps (collecting/moving static assets)" Interestingly, we extended the collectstatic command in many ways to perform minification, combination of assets, generation of sass and javascript variables (based on settings in python), etc. It's part of our deployment and if we were serving static files through django, we would still have to run a similar command. I'm also happy that nginx is handling fi…

That's certainly a value of a 'project prep step' (whether it involves static export or not).

Not also, though, that a service like CloudFlare now puts some of these optimizations (minification, asset-combination, obfuscation, etc) into the cache layer, as optional cloud 'app' services to be enabled/disabled/paid-for as desired.

Not saying that way is better for all, but it has potential as a convenience for some, getting those same expert-level optimization benefits while retaining a simple project/deployment structure.

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

#40
There's a good post from late 2011, in the context of 12-factor deployment on Heroku, where the author muses about just using a pure Python server behind a CDN to serve static content:

...and yeah, I think I should bloody use this server as a backend to serve my in production.

http://tech.blog.aknin.name/2011/12/28/i-wish-someone-wrote-...

Post reply on HN