AsgiFastStream not working with multiple workers? #1946
Replies: 3 comments
-
Hi, try to use something from this list for running your FastStream App gunicorn -k uvicorn.workers.UvicornWorker main:app --workers=4
granian --interface asgi main:app --workers 4
hypercorn main:app --workers 4 We will fix this problem as soon as possible |
Beta Was this translation helpful? Give feedback.
-
@KingofGnome yes, |
Beta Was this translation helpful? Give feedback.
-
@KingofGnome you can try 0.5.31 FastStream release - the bug was fixed there |
Beta Was this translation helpful? Give feedback.
-
Hey,
i got a shost question on the asgi + multiple workers.
I'm running FastStream workers to consume a queue of long running tasks and is just awesome to work with the framework 💯 !
I've closely followed the ASGI Support-Tutorial to enable K8S probes and added Prometheus metrics just for the fun of it.
However, after using
FastStream(...).as_asgi(...)
like here and running the app exactly like the tooltip suggests:it seems to now ignore the --workers -flag and running a single process only.
Am i missing something or is it supposed to work like this?
Having long running low-cpu but io-bound tasks i'm really looking foreward to having multiple workers (on top of k8s scaling).
Right now the only approach i can see, is getting rid of the asgi, (bye bye grafana dashboard 😂) and switching to exec-based livenessprobes.
I'm trying to keep the project FastStream-"centered" and using asgi only as by-product for metrics and probes. An alternative would probably be to embed Faststream compleatly into Fastapi and run FastAPI/Uvicorn on multiple workers?
However, the docs kinda suggests that
as_asgi(...)
together withfaststream run ... --workers
should work?So either there is a solution i'm missing or we could improve the docs :)
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions