feat: set event loop to uvloop #1697
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
https://github.com/MagicStack/uvloop
UnixSelectorEventLoop (current worker loop) vs Uvloop
Test 1: 10k reqs, 50 UVs
Unix
Total: 19.4 s total
Avg: 96.95 ms
Median: 95.45 ms
p(95): 106.34 ms
RPS: 515
Uvloop
Total: 17.7 s total
Avg: 87.99 ms
Median: 87.79 ms
p(95): 95.99 ms
RPS: 565
Test 2: Number requests in 5 minutes, 100 VUs
Unix
Total: 157,580 reqs completed
Avg: 190.35 ms
Median: 189.89 ms
p(95): 206.88 ms
RPS: 525
Uvloop
Total: 167,928 reqs completed
Avg: 178.58 ms
Median: 178.21 ms
p(95): 195.29 ms
RPS: 560
Test 3: Number requests in 5 minutes, 500 VUs, with simulated parallelism for each request (5 concurrent tasks via asyncio.gather)
Unix
Total: 216,212 reqs completed
Avg: 694.03 ms
Median: 693.09 ms
p(95): 814.89 ms
0.15% failed requests (no 200)
RPS (success only): 720
Uvloop
Total: 231,878 reqs completed
Avg: 647.01 ms
Median: 643.42 ms
p(95): 737.38 ms
0.12% failed requests (no 200)
RPS (success only): 772
Test 1 improvement: 8.76% faster
Test 2 improvement: 6.57% more reqs
Test 3 improvement: 7.24% more reqs
PR information
Quality of Code and Contribution Guidelines