News for hackers. Stuff that matters.
Re:A viable solution for Python concurrency by Buttons840 on Friday October 15, 2021 @07:39PM (#28884350)
> our web servers and batch workers have throughput limited only by CPU and RAM

Are you able to fully utilize a multicore processor? I'm not familiar with gevent.

Re:A viable solution for Python concurrency by js2 on Friday October 15, 2021 @09:03PM (#28884753)
This is why you run one process per core, and you'll typically have something like nginx+uWSGI distribute requests across them. I use this combination with https://falconframework.org/ and boto3 to spool HTTP POST requests to S3 and SQS and am pretty happy with it.

uWSGI supports gevent https://uwsgi-docs.readthedocs.io/en/latest/Gevent.html

Falcon also benefits from Cython acceleration. It's been a while but at the time I tested against PyPy and either it was slower or had quirks I was unable to resolve (don't recall w/o consulting my notes).

Re:A viable solution for Python concurrency by btown on Friday October 15, 2021 @11:29PM (#28885325)
Yep, we use Gunicorn in full gevent mode, tuned to spawn and route to a gevent-patched Django process per core, each of which can handle as many concurrent requests as will fit in (its slice of) RAM.

A far cry from the one-request-per-thread days of yore!

Re:A viable solution for Python concurrency by sandGorgon on Saturday October 16, 2021 @01:34AM (#28885782)
you use gunicorn as a reverse proxy - it seems that you are not running Gunicorn to spawn django processes is it ?

I'm wondering how would this work in a kubernetes/docker world.

Re:A viable solution for Python concurrency by btown on Saturday October 16, 2021 @12:26PM (#28888954)
Gunicorn both acts as a reverse proxy and a master process that forks workers - each of which, in our case, loads Django.

https://docs.gunicorn.org/en/stable/design.html