News for hackers. Stuff that matters.
Re:We have to talk about this Python, Gunicorn, Gevent thing by Too on Sunday March 08, 2020 @01:37AM (#22516663)
Surprised nobody mentioned asyncio.run_in_executor yet. It's designed to offload the event loop from long running cpu bound tasks, by moving them to another thread pool (or process pool if you are afraid of GIL). Eventually that thread pool will obviously also get starved given enough load but at least you wont have CPU blocking IO and vice versa. Tricky thing is knowing when an operation might grow to become too slow for io-thread given dynamic inputs.

https://docs.python.org/3/library/asyncio-eventloop.html#asy...

Re:We have to talk about this Python, Gunicorn, Gevent thing by obeleh on Sunday March 08, 2020 @03:48AM (#22516866)
that's because `run_in_executor` doesn't spread CPU usage. All it does is wrap functions in threads so you can call them async. It doesn't create multiple processes so you're still limited to a single core in Python.
Re:We have to talk about this Python, Gunicorn, Gevent thing by Too on Sunday March 08, 2020 @06:10AM (#22517299)
See example 3 in link above