Live data from Hacker News

Multiple Django and Flask Sites with Nginx and uWSGI Emperor

tghw.com

11–20 of 29 posts

Re: Multiple Django and Flask Sites with Nginx and uWSGI Emperor

#11
post #3
post #2

[deleted]

Yeah, I was using Supervisord before this, but was having some problems with it leaving zombie uwsgi processes around (for sites that needed multiple workers). While looking for an alternative, I came across Emperor. So far it's been great.

Have you found the need for the reaper option as well?

Re: Multiple Django and Flask Sites with Nginx and uWSGI Emperor

#12
post #8
post #6

Are there any updated benchmarks/feature comparisons between nginx/uWSGI vs. nginx/gunicorn out there?

The web server doesn't matter. Your app is what will be slow.

Personally, I would like to know if this setup is available using gunicorn.

Re: Multiple Django and Flask Sites with Nginx and uWSGI Emperor

#13
post #6

Are there any updated benchmarks/feature comparisons between nginx/uWSGI vs. nginx/gunicorn out there?

I'm actually setting up a new ec2 instance tonight as my current one is set to expire.

I currently run DUNG (nginx/gunicorn), perhaps I will run nginx/uWSGI first and compare performance. I will ping you if I get around to it.

Re: Multiple Django and Flask Sites with Nginx and uWSGI Emperor

#14
post #12
post #8

Earlier quoted context omitted.

The web server doesn't matter. Your app is what will be slow.

Personally, I would like to know if this setup is available using gunicorn.

It would be very similar, you'd just need supervisord or something similar to run gunicorn for you. There is a pretty complete example of deploying gunicorn + nginx in the docs: http://gunicorn.org/deploy.html

Re: Multiple Django and Flask Sites with Nginx and uWSGI Emperor

#16
post #3
post #2

[deleted]

Yeah, I was using Supervisord before this, but was having some problems with it leaving zombie uwsgi processes around (for sites that needed multiple workers). While looking for an alternative, I came across Emperor. So far it's been great.

supervisord doesn't know how to kill child processes that fork off from the processes you start.

Re: Multiple Django and Flask Sites with Nginx and uWSGI Emperor

#17
post #6

Are there any updated benchmarks/feature comparisons between nginx/uWSGI vs. nginx/gunicorn out there?

There are benchmarks around [1], though I consider them valuable only for the entertainment value.

The great thing about uWSGI/Nginx over Gunicorn/Nginx is that Nginx speaks the uwsi protocol natively[2], whereas with Gunicorn Nginx acts as a proxy.

Also, in my experience (2 years with gunicorn, 1 with uwsgi in prod), uwsgi is more stable, uses less memory, has better management and configuration tools and even lets you run multiple Python apps under the same intepreter (multitenancy) [3].

[1] http://www.peterbe.com/plog/fcgi-vs-gunicorn-vs-uwsgi

[2] http://wiki.nginx.org/HttpUwsgiModule

[3] http://projects.unbit.it/uwsgi/wiki/TipsAndTricks

(Edit: formatting)

Re: Multiple Django and Flask Sites with Nginx and uWSGI Emperor

#18

This is my favorite stack too. I usually use supervisord to handle uwsgi processes but this looks much more debian/ubuntu-like. Thanks for the write up. I like to think I am pretty experienced with Django/Python but it's ALWAYS fun to learn new things. Especially when sometimes it feels like a lot of the innovation and new stuff is occurring elsewhere (cough node)

Don't worry much about node, Twisted still beats it for async workloads and PyPI is still much bigger than npm.

I'm a big fan of twisted too. Can you show me the benchmark for Twisted vs. Node for async workloads?

Re: Multiple Django and Flask Sites with Nginx and uWSGI Emperor

#20
Could someone please explain to me what uwsgi does? Looking at the main page, it does ... everything! It's a wsgi server, but it looks like the default configuration is still to put it behind another server like nginx or cherokee. Also, nginx for example, has its own mod_wsgi. After reading the docs, I still don't quite understand why I'd want that extra layer between my server and my code.
Post reply on HN