Matt Seymour

You have been working hard building your app. Now has come the time to deploy your application to production but there is one question you have which wsgi server shall I use? Your two real options for Django are Gunicorn or uWSGI. Both integrate easily with Django and you can get them up and running (as a beginner within an hour).

But which one should you choose?

tldr; Either Gunicorn or uWSGI correctly configured will give you more than adequate performance for your website. Go with the wsgi server you think is best suited for you.

Okay first things first...

I will not be comparing the performance of Gunicorn and uWSGI. There are a number of reasons, primarily being there are a large number of posts talking about performance. Simply put either wsgi server will give you more than enough performance if configured correctly.

Introducing uWSGI uWSGI is a high performance, powerful wsgi server. It has a massive number of configuration options (personally I think too many) to allow you to tailor your server to your needs. Though a large number of the options you will never need to use. uWSGI works well with nginx as nginx talks uwsgi by default. A basic wsgi server can be setup easily but to tailor the server for your system will take time as you figure out all the configuration options.

Introducing Gunicorn

Gunicorn is a simple, performant, and easy to setup and configure. Gunicorn may not be as performant as uWSGI (depending on your source ~10-15% down on max requests per second), but it is still fast the standard user would have no idea of the performance difference. What Gunicorn loses in performance it gains in simplicity and ease of use; Gunicorn has a fraction of the options than uWSGI. A Gunicorn wsgi server can be set up and running in less than 10 minutes.

So which one is better?

uWSGI is highly configurable (maybe too much so), whereas Gunicorn is simpler. Both have more than enough performance to run any website at scale. You have to remember that in most web applications the datastore and API calls will be the performance bottleneck.

The question you need to ask yourself is this: Is the extra time spent configuring uWSGI beneficial to your application, or would the time saved using Gunicorn. The Gunicorn settings file can easily be made to work with uWSGI; so one option is to start by using Gunicorn and if the situation requires it make the move to uWSGI.

My personal preference is towards the Gunicorn wsgi server. Whilst offering excellent performance, it is simple to configure, well documented and can be used whilst developing my Django applications locally. When used with supervisord it provides a stable well rounded system.