Unexpected Performance Degradation with uvloop in FastAPI + MySQL Benchmark #2607
Unanswered
M1-Elmasry
asked this question in
Potential Issue
Replies: 1 comment 2 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.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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