Gunicorn

It has been raining Unicorns in India over last few months (albeit it has slowed down over last few weeks). However Gunicorn has nothing to do with the unicorns that we are seeing in the startup world. It is a most common name used in the Python world and let’s understand more about it in today’s term.

"GUnicorn - representative image of unicorn. It is an application server used for Python based frameworks.

Photo by Kindel Media" title="Representative image"

What is Gunicorn

It is a python WSGI application server for UNIX. WSGI means Web Server Gateway Interface. This component provides a way for python based frameworks to be accessible over the internet via reverse proxy. A typical web setup for a python framework involves Nginx, a WSGI server like Gunicorn or uWSGI and a web framework like Django or Flask.

Gunicorn can really work with a host of web servers including Nginx, and Apache and also can work with several web applications as long as those applications can interact via the WSGI interface.

It is a pre-fork worker model ported from Ruby’s Unicorn project.

https://gunicorn.org/

Gunicorn is made to serve one application per instance and to provide a way of running that application as efficiently as possible. It also takes care of managing the worker processes that run your app, so you can focus on developing your code and features.

Advantages of Gunicorn

It is one of the good-performing application servers that is easy to configure and is less CPU intensive. At some point, Instagram used to run Django + Gunicorn when they phased out mod_wsgi and replaced it with this application server. Additionally, it takes care of everything between the web server and your application, leaving your application to do what it is meant for. Easy to configure and easy to maintain, it is a common choice for several leading websites mentioned below.

Alternatives:

  • uWSGI
  • mod_wsgi with Apache
  • Nginx
  • IIS
  • OpenResty
  • LiteSpeed

Some popular websites that use this component as the application server include Mozilla.org, Twillio.com and ubuntu.com. (Statistics)

References:

Summary
Article Name
Gunicorn
Description
What is Gunicorn and where it is used.
Author

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.