uwsgi is the latest and greatest WSGI server and promising to be the fastest possible way to run Nginx + Django. Proof here But! Is it that simple? Especially if you're involving Django herself.
So I set out to benchmark good old threaded fcgi and gunicorn and then with a source compiled nginx with the uwsgi module baked in I also benchmarked uwsgi. The first mistake I did was testing a Django view that was using sessions and other crap. I profiled the view to make sure it wouldn't be the bottleneck as it appeared to take only 0.02 seconds each. However, with fcgi, gunicorn and uwsgi I kept being stuck on about 50 requests per second. Why? 1/0.02 = 50.0!!! Clearly the slowness of the Django view was thee bottleneck (for the curious, what took all of 0.02 was the need to create new session keys and putting them into the database).
So I wrote a really dumb Django view with no sessions middleware enabled. Now we're getting some interesting numbers:
fcgi (threaded) 640 r/s
fcgi (prefork 4 processors) 240 r/s (*)
gunicorn (2 workers) 1100 r/s
gunicorn (5 workers) 1300 r/s
gunicorn (10 workers) 1200 r/s (?!?)
uwsgi (2 workers) 1800 r/s
uwsgi (5 workers) 2100 r/s
uwsgi (10 workers) 2300 r/s
(* this made my computer exceptionally sluggish as CPU when through the roof)