uWSGI
2026-04-12
Edited: 2026-04-12
WSGI stands for Web Server Gateway Interface and is mainly used for web applications communication with python web servers. In particular, the uWSGI binary protocol can be more efficient than HTTP as it is much smaller. Gunicorn is another WSGI framework and it recently go support for the uWSGI binary protocol. The main difference is that gunicorn is much easier to configure while uWSGI has the entire kitchen sink. In general
- stick with default worker for most tasks
- switch to gevent for many long living concurrent connections
- workers = 2 * CPU cores + 1
The uWSGI binary protocol is great in conjunction with reverse proxies like NGinx and HTTPD/Apache2 as they come with optimized uswgi protocols. (See mod_proxy_uwsgi for HTTPD, NGinx supports uwsgi out of the box). For httpd, you can use
<Location /api/>
ProxyPass uwsgi://backend:3050/api/
ProxyPassReverse uwsgi://backend:3050/api/
</Location>Note that you must start uwsgi with --socket 0.0.0.0:3050 when the backend is separate from the proxy.
References: