Slower behavior using Fast API (same gunicorn config) Gunicorn with uvicorn.workers.UvicornWorker than using default one
See original GitHub issueI’m using this dependencies:
starlette==0.13.6 uvicorn==0.11.8 fastapi==0.61.1
According to every check I’ve worked with, using FastAPI is supposed to handle more request per second than a Flask App but I’m finding different behaviors.
- Using Flask + Gunicorn, I’m getting twice the number of req/s vs using FastAPI + Gunicorn(uvicorn.workers.UvicornWorker)
The other params (besides the worker class) are the same for both apps.
What can I check to improve this ? or is this the expected behavior? If so, what could be other places I could look into to improve the performance of using FastAPI ?
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Server Workers - Gunicorn with Uvicorn - FastAPI
Here I'll show you how to use Gunicorn with Uvicorn worker processes. ... Then Gunicorn would start one or more worker processes using...
Read more >Deployment - Uvicorn
Gunicorn is probably the simplest way to run and manage Uvicorn in a production setting. Uvicorn includes a gunicorn worker class that means...
Read more >Fastapi python code execution speed impacted by ...
@NaveenReddyMarthala Yes, I think in your case you can use just Uvicorn. But using gunicorn with single uvicorn worker may still give you...
Read more >FastAPI vs. Express.js vs. Flask vs. Nest.js Benchmark
I wanted to verify FastAPI's claims of having performance on par with Node.js. ... Flask + psycopg2 + gunicorn (1 worker). $ gunicorn...
Read more >Gunicorn Worker Types: How to choose the right one
This article assumes you're using a sync framework like flask or Django and won't explore the possibility of using the async/await pattern.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It’s kinda hard to tell without code and how you benchmarking them (running options etc.)
Also, I did some benchmarking you might want to check it out
Yes, please add these,
How do you run FastAPI, and options?
uvicorn your:app --workers int
How do you run Flask, and running options?
waitress-serve --call "your:app"
The code that you use for testing FastAPI
The code that you use for testing Flask
etc.