azure-functions-python-worker
azure-functions-python-worker copied to clipboard
feat: allow event loop to be uvloop
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
- [ ] The title of the PR is clear and informative.
- [ ] There are a small number of commits, each of which has an informative message. This means that previously merged commits do not appear in the history of the PR. For information on cleaning up the commits in your pull request, see this page.
- [ ] If applicable, the PR references the bug/issue that it fixes in the description.
- [ ] New Unit tests were added for the changes made and CI is passing.
Quality of Code and Contribution Guidelines
- [ ] I have read the contribution guidelines.