Nginx – Recommended Nginx + WSGI Configurations

fastcginginxpythonweb-serverwsgi

Please explain pros/cons when using the different Nginx WSGI interfaces? Please explain in detail what differentiates each configuration? Which configuration should scale the best?

If relevant, what are you running right now, and why?

Some techniques I've seen, but please tell me if I've missed any:

Best Answer

I prefer uwsgi because it's super configurable and has tons of options.

From the benchmarks I've done it has the best performance/memory usage. It's very flexible and can probably be configured precisely to suit your needs. I use uwsgi's emperor mode to host multiple apps. It will scan a given directory for config files and launch/manage all applications it finds config files for. You can remove the config to kill the app, touch it to restart, etc. It's probably the quickest and easiest way to go about multiple-app hosting. I have posted the details of my config on another topic: https://stackoverflow.com/questions/5906197/what-is-the-most-common-way-to-configure-static-files-in-debug-and-production-for/5906206#5906206.

Generally your application will be the bottleneck, not the wsgi server! But hey, if you want an even more performant WSGI server, you might want to look at meinheld or bjoern. Both are extremely lightweight and fast, built on fast event loops, picoev, and libev respectively, and both use the same high performance HTTP parser as node.js.

Related Topic