Skip to content

Use uvloop by default #2874

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 4, 2025
Merged

Use uvloop by default #2874

merged 2 commits into from
Jul 4, 2025

Conversation

r4victor
Copy link
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