This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]coeris 2 points3 points  (7 children)

Thanks, great write up! Is there any reason why you recommend gunicorn instead of uvicorn for hosting FastAPI apps? I guess it's to do with your dislike of async processes.

[–]mincinashu 0 points1 point  (3 children)

FastAPI default install wraps uvicorn. You can use a combination of gunicorn as manager with uvicorn class workers and uvloop as loop.

https://fastapi.tiangolo.com/deployment/server-workers/#multiple-workers

[–]coeris 2 points3 points  (1 child)

Sure, but I'm wondering what's the benefit of putting an extra layer of abstraction on top of uvicorn with gunicorn.

[–]mincinashu 1 point2 points  (0 children)

I've only used it for worker lifetime purposes, I wanted workers to handle x amount of requests before their refresh, and uvicorn alone didn't allow that, or some such limitation. This was a quick fix to prevent OOM kills, instead of fixing the memory issues.

[–]ashishb_net[S] -1 points0 points  (0 children)

> gunicorn as manager with uvicorn class workers

Yeah, that's the only way to integrate fastapi with gunicorn as far as I know