Unexpected Performance Degradation with uvloop in FastAPI + MySQL Benchmark #2607
Unanswered
M1-Elmasry
asked this question in
Potential Issue
Replies: 1 comment 5 replies
-
My hypothesis is that the latest CPython is getting faster even in common cases, and it's becoming harder to optimize with custom loops/uvloops. I have sensed this as well. Feel free to try with different/old versions of CPython. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I was benchmarking the performance of fastapi and noticed something unexpected, when i install uvloop (which becomes the eventloop used due to
--loop auto
setting) performance degrades.Setup
aiomysql
installed packages, click to expand
run command
uvicorn <server-module>:app --host 127.0.0.1 --port 3000
Server Code
Click to expand
k6 Test Scripts
All tests use a load pattern of:
Benchmark Results (Before and After
uvloop
Installation)IO-Bound (
/employees/{employee_id}
)uvloop
uvloop
CPU-Bound (
/calculate-factorial/{n}
)uvloop
uvloop
IO + CPU (
/employee-exp-factorial/{id}
)uvloop
uvloop
Notes
uvloop
restores performanceQuestions
uvloop
, and why ?uvloop
?Beta Was this translation helpful? Give feedback.
All reactions