3 ms·
What WSGI do people recommend for python? I've been using gunicorn but this made me think of alternatives. Quick google search found this benchmark [0], is it r
by ivalm 6y ago
What WSGI do people recommend for python? I've been using gunicorn but this made me think of alternatives. Quick google search found this benchmark [0], is it really that bjoern is much quicker? It seems all other WSGI are ~ equivalent.
[0] - https://www.appdynamics.com/blog/engineering/a-performance-analysis-of-python-wsgi-servers-part-2/ https://www.appdynamics.com/blog/engineering/a-performance-a...
- TheAdamAndChe 6y agoI've used uwsgi a few times before. It is a pain to set up every time, but once it's configured, it works fine for the small, basic apps that I make.
- dimatura 6y agoI've mainly used gunicorn and uwsgi, without seeing any large differences. But my apps have fairly light network requirements. It seems like the new trend for Python servers is ASGI (https://asgi.readthedocs.io/en/latest/ https://asgi.readthedocs.io/en/latest/), e.g. as in uvicorn (https://www.uvicorn.org/ https://www.uvicorn.org/).
- DizzyDoo 6y agoI'm using Waitress in production: https://docs.pylonsproject.org/projects/waitress/en/stable/ https://docs.pylonsproject.org/projects/waitress/en/stable/ It's main thing is that it's really simple, worth a look if you're using Django.
- CopyZero 6y agogoing to look at this in depth tomorrow. Thanks
- X-Istence 6y agoThe thing to note is that waitress is not built for the highest speed, or the fastest, or anything along those lines. Its primary use case is that it is pure python, doesn't rely on any specific libraries or compilers to run/build, and is a threaded WSGI implementation so it uses Python threads to run a WSGI app. It works well for what it needs to do, and hopefully it is fairly robust. I've personally ran waitress directly facing the internet, but will readily admit that in most cases running it behind a load balancer is a good idea, especially since it doesn't support SSL out of the box (yet, I should say, it's on my roadmap). It won't win any speed contests and it won't win performance contests, but it holds its own. If you have any issues, please drop by https://github.com/pylons/waitress/issues https://github.com/pylons/waitress/issues and I'll see if I can help you out :-)
- X-Istence 6y agoThanks for your kind words :-)
- luhn 6y agoI've been using gunicorn quite happily without the gevent stuff that Rachel ran into issues with. Running 2-3 workers per core is enough for my application to make full use of the CPU. It is a "waste" of memory, but memory is so cheap and plentiful I've never had an issue with it. bjorn is fast because it has a minimal feature set. No threads, no multiprocessing, no nothing. If it works for you, great, but it's never satisfied my requirements. I'd avoid uWSGI, it's performance is good but it's so complicated with so many features that I never felt confident using it. Never used waitress except in development, but people seem to have had success in production.
- rpedela 6y agoFalcon https://github.com/falconry/falcon https://github.com/falconry/falcon
- aeyes 6y agoThat's a web framework, you need a WSGI server to run it.
- Falell 6y agoI use uwsgi at work, we've found a lot of bugs in the more interesting features of the uwsgi module, and had to fix some signal and memory leak issues (I think we're still trying to get them upstreamed). That said, it's reasonably fast and the WSGI interface in general is pretty pleasant to work with.
- CopyZero 6y agoIDK but the mod_wsgi, although there seems to be a ton of documentation... It's way harder to install than a virtual environment, python and django. I love doing backend stuff in python and jinja but I fucking hate setting up wsgi on apache. It really makes me love php again.
- neurostimulant 6y agoIs there any reason why do you need mod_wsgi and apache? gunicorn behind nginx is an ideal setup for me (nginx handles static files and reverse proxying while gunicorn handles the python backend). I wrote a Dockerfile that combine all of those in a single package and I've been using it with very little tweaks for many of my smaller projects over the years and it makes deployment very easy.
- throwaway9d0291 6y agoI've been using uWSGI behind NGINX (using uwsgi_pass) for years. It might not be the absolute fastest option around but it's faster than a lot of the other options, rock solid and extremely configurable. Some fun extra features that uWSGI provides: - Daemon management: It can manage other daemons, for example Celery, for you, so you can put your whole environment into a single uWSGI.conf. - A cron-like interface for generating events on a schedule. - Emperor - hosting of multiple apps. This is extremely configurable, you can have the server look at the filesystem for config files for the simplest setup but it also supports AQMP, a Postgres database, MongoDB, a shell command or a bunch of other things. It has a bunch of interesting isolation options, like running each app in its own Linux namespace. It also has (optional) socket activation, so apps won't be started until the first request. - Auto-scaling - Soon, multiple event-loop/IO subsystems to choose from, including asyncio I've been meaning to have a look at nginx-unit though.
- JimDabell 6y agoDo you have a performance issue that you have tracked back to gunicorn? If not, then continue using gunicorn. There are almost certainly more valuable things to spend your time on than replacing something that is already working.
- xorcist 6y agoAlways uwsgi. It's the hidden gem of web serving. It's even useful for other things than Python, and has the operational features you would expect (such as graceful restarts). The more exotic features are a bit less tested however, and it shows.