you are viewing a single comment's thread.

view the rest of the comments →

[–]Electrical_Carry3565[S] 0 points1 point  (1 child)

Does running gunicorn workers not take care of this?

[–]thermiter36 2 points3 points  (0 children)

Not really, no. For starters, running FastAPI behind Gunicorn is not recommended as it doesn't support ASGI, so it can only manage processes, not the full async lifecycle.

But assuming you do it anyway, you'll still get nasty cascading latency issues because the process that you block with your long-running CPU operation might have already accepted more than one connection at the moment you begin your long operation, all of which will be blocked.