0

I have a FASTApi application, that I'm trying to deploy via Uvicorn Async task using the below cmd:

uvicorn app.main:app --host='0.0.0.0' --port=8080 --workers=5

My system has below config: 12core, 24threads processor - 32GB RAM - 16GB GPU

I tried to perform load test on one GET & one POST APIs (executing detectron2 and Paddle OCR model predictions). GET takes on avg 3ms and POST takes approx 1.7s-4s. Both my functions/APIs are defined with async def prefix

Irrespective of the number of workers(1-8), GET API runs avg 385RPS while POST API runs on avg 3RPS-10RPS. Like even with 5 workers, for POST my RPS is 3. Can't understand why is this happening.

Please suggest where am I going wrong. How can I increase my RPS/throughput? Should I continue to use Uvicorn for production or switch to anything else (production grade)?

Your help will be highly appreciated. Thanks in advance.

Tried to update number of uvicorn workers from 1 to 8 (can't go beyond 8 - have processing restrictions).

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Kiran Roy
  • 1
  • 1

1 Answers1

0

May be gunicorn running with uvicorn and taking care of workers fastapi link for gunicorn workers

Apart from that, I would suggest:

  • Find the bottlenecks in the program, where the performance can be improved by optimising the code like using cProfile .
  • Use asyncio for parallel computing.
Prudhviraj
  • 441
  • 3
  • 12