Skip to content

Use uvloop by default#2874

Merged
r4victor merged 2 commits intomasterfrom
pr_uvloop
Jul 4, 2025
Merged

Use uvloop by default#2874
r4victor merged 2 commits intomasterfrom
pr_uvloop

Conversation

@r4victor
Copy link
Copy Markdown
Collaborator

@r4victor r4victor commented Jul 4, 2025

The PR installs uvicorn[standard], which includes uvloop and makes uvicorn use it by default when possible.

uvloop improves server performance 10-20% (throughput, latency), which is noticeable on fast endpoints:

without uv loop:

(venvt) ➜  stuff wrk http://localhost:8000/healthcheck
Running 10s test @ http://localhost:8000/healthcheck
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     9.61ms   26.02ms 223.25ms   93.55%
    Req/Sec     1.50k   433.86     1.95k    84.85%
  29731 requests in 10.02s, 4.11MB read
Requests/sec:   2966.66
Transfer/sec:    420.13KB

with uvloop:

(venvt) ➜  stuff wrk http://localhost:8000/healthcheck             
Running 10s test @ http://localhost:8000/healthcheck
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    11.63ms   32.02ms 265.65ms   91.91%
    Req/Sec     1.84k   537.20     2.36k    84.74%
  35526 requests in 10.02s, 4.91MB read
Requests/sec:   3544.50
Transfer/sec:    501.97KB

As expected, there is no effect for slow API endpoints (e.g. /api/runs/list).

@r4victor r4victor merged commit 0ddaa13 into master Jul 4, 2025
25 checks passed
@r4victor r4victor deleted the pr_uvloop branch July 4, 2025 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant