Live data from Hacker News

Django Setup using Nginx and Gunicorn

senko.net

21–30 of 36 posts

Re: Django Setup using Nginx and Gunicorn

#21
post #4

I'm not clear on the advantages of using nginx+Gunicorn over nginx+proxy-to-Apache/mod_wsgi

Its not really hip and trendy, its the standard way to go now days. The advantages to me are, Nginx is much lighter on resources for any given number of concurrent connections. I can keep those connections open if I really need to, and I have found it flexible enough for almost all scenarios (hosting SVN is the one thing I can think of that it doesn't do, but SVN's days are numbered for my usage anyway and http1.1 proxying backends).

Nginx's syntax for its configuration tends to be easy to read, the community is helpful. Its also well tested and hosting a decent percentage of websites.

I question the need to use Apache2 these days and anyone who blindly recommends it without knowing the alternatives as they tend to be uninformed about modern hosting environments.

Re: Django Setup using Nginx and Gunicorn

#22

Am I the only one who's never had gunicorn crash on him? I don't run supervisor or anything, but I've never had any issues either.

If you have Gunicorn crash please make sure and report any tracebacks in the logs to the issue tracker so we know that's something is broken.

https://github.com/benoitc/gunicorn/issues

Re: Django Setup using Nginx and Gunicorn

#23
post #4

I'm not clear on the advantages of using nginx+Gunicorn over nginx+proxy-to-Apache/mod_wsgi

Simon, slightly better memory usage in most cases. More so if you don't end up stripping out all of the Apache modules you aren't using. But it's such a small differences it usually isn't worth changing from what you know and are comfortable with.

Re: Django Setup using Nginx and Gunicorn

#24
post #17
post #13

Earlier quoted context omitted.

Apache is also very well-tested and extremely reliable. For some people and organizations, that's a very important factor.

I happen to find this post very helpful as a student of the craft, and your comments seem to be defensive of a traditional approach because you don't care to examine the reasons for the choices you've made. The pros and cons of either choice would be more helpful than demonstrating animosity toward an approach you've chosen to dismiss. It's great that you have a setup you know and are comfortable with, but for those…

I didnt find the parent defensive. I appears to be more of an observation. Perhaps it was edited after the fact?

Re: Django Setup using Nginx and Gunicorn

#25
post #21
post #4

I'm not clear on the advantages of using nginx+Gunicorn over nginx+proxy-to-Apache/mod_wsgi

Its not really hip and trendy, its the standard way to go now days. The advantages to me are, Nginx is much lighter on resources for any given number of concurrent connections. I can keep those connections open if I really need to, and I have found it flexible enough for almost all scenarios (hosting SVN is the one thing I can think of that it doesn't do, but SVN's days are numbered for my usage anyway and http1.1 pr…

That's why I run Apache+mod_wsgi behind an nginx proxy (and have nginx serve up static files etc directly).

Re: Django Setup using Nginx and Gunicorn

#27
post #17

Earlier quoted context omitted.

I happen to find this post very helpful as a student of the craft, and your comments seem to be defensive of a traditional approach because you don't care to examine the reasons for the choices you've made. The pros and cons of either choice would be more helpful than demonstrating animosity toward an approach you've chosen to dismiss. It's great that you have a setup you know and are comfortable with, but for those…

I didnt find the parent defensive. I appears to be more of an observation. Perhaps it was edited after the fact?

It wasn't edited.

I'm not sure why 18pfsmt is overly sensitive. Maybe he subconsciously feels that his new techniques are inferior to proven approaches, and exhibits this through outrage?

Re: Django Setup using Nginx and Gunicorn

#28
post #19
post #4

I'm not clear on the advantages of using nginx+Gunicorn over nginx+proxy-to-Apache/mod_wsgi

Less packages to keep updated, thus less maintenance.

The number of packages involved is a very poor measure of the effort needed to maintain a system.

Apache and more established technologies have had much more testing and are far more mature. Their releases are often much more infrequent, merely because most of the problems have already been worked out. Newer technologies, on the other hand, aren't in such a position.

Although your solution may involve a smaller number of packages, having to perform weekly or even monthly updates due to the immaturity of the software is much riskier and disruptive than having to upgrade Apache and a few of its modules once or twice a year.

Re: Django Setup using Nginx and Gunicorn

#29

Everyone always shows a single server setup. What if you have a dozen sites? You can't just give each one 9 processes, you will swamp your box. Is there any way to do a master setup where you can dynamically feed it your settings file?

I've found uwsgi is great for multiple site hosting. There are numerous ways to configure uwsgi for this purpose, one of my favorites: http://projects.unbit.it/uwsgi/wiki/VirtualHosting. Newer versions of uwsgi also have a feature called emperor mode which is pretty slick: http://projects.unbit.it/uwsgi/wiki/Emperor.

Re: Django Setup using Nginx and Gunicorn

#30
> The best seem to be Gunicorn and uWSGI, and Gunicorn seems the best supported and most active project.

This is not so cut and dry. In May, Gunicorn had 12 mailing list messages, where uWsgi had 191. uWsgi has a twitter with 225 followers, where Gunicorn has none. #gunicorn@freenode has 32 users, but #nginx@freenode seems to have a lot of uWsgi users.

Also, the author mentions nothing about installing the Nginx PPA for ubuntu. If you use the default repo on Lucid (as suggested by the author), you will end up with a very old version of Nginx that doesn't even natively support wsgi.

Post reply on HN