FastAPI против FastAPI + Celery [закрыто]Python

Программы на Python
Гость
FastAPI против FastAPI + Celery [закрыто]

Сообщение Гость »


i really hope you can help me.
It's about an architectural question, i have been reading about the past week and now getting really stuck.
I plan to build a webapp using FastAPI that receives a real-time audio stream through websocket and passes this audio stream to a third party transcription API. Third party transcription API responds every 5-10s with a transcription chunk as long as the audio stream is sent to the API.
Plan is to manage 1'000 - 10'0000 concurrent sessions.
Where I'm currently:
  • Build it all in FastAPI, using asyncio tasks to initiate the function and asyncio.queues to stream the audio into the function.
  • Use FastAPI only as backend to receive the audio stream, create stream_states, continuously calling a celery task (differentiated if it needs to initialize the connection to the 3rd party API or stream data) Celery would run with gevent to ensure async nature and not block workers while waiting for external API to respond. Stream states would be shared with Redis.
  • Similar approach than 2) but instead of passing the data directly to Celery, use Redis to broke the data.
What is your recommendation to proceed, given the 1'000 - 10'000 concurrent streams?
Your answer is really appreciated!
I read about several architectural designs and expected a clear-path proposal, but i did not find.


Источник: https://stackoverflow.com/questions/781 ... api-celery

Вернуться в «Python»