Results (2021-08-02)
This is a simple benchmark for python async frameworks. Almost all of the frameworks are ASGI-compatible (aiohttp and tornado are exceptions on the moment).
The objective of the benchmark is not testing deployment (like uvicorn vs hypercorn and etc) or database (ORM, drivers) but instead test the frameworks itself. The benchmark checks request parsing (body, headers, formdata, queries), routing, responses.
Read more about the benchmark: The Methodic
Table of contents
- Accept a request and return HTML response with a custom dynamic header
- Parse path params, query string, JSON body and return a json response
- Parse uploaded file, store it on disk and return a text response
- Composite stats
Accept a request and return HTML response with a custom dynamic header
The test simulates just a single HTML response.
Sorted by max req/s
Framework | Requests/sec | Latency 50% (ms) | Latency 75% (ms) | Latency Avg (ms) |
---|---|---|---|---|
blacksheep 1.0.9 |
19432 | 2.70 | 4.27 | 3.26 |
muffin 0.84.1 |
17250 | 3.08 | 4.78 | 3.67 |
falcon 3.0.1 |
16127 | 3.24 | 5.15 | 3.93 |
starlette 0.16.0 |
14000 | 3.61 | 6.00 | 4.54 |
emmett 2.2.3 |
13977 | 3.63 | 6.04 | 4.54 |
fastapi 0.67.0 |
9929 | 5.06 | 8.49 | 6.41 |
sanic 21.6.0 |
9308 | 5.41 | 8.96 | 6.89 |
aiohttp 3.7.4.post0 |
7815 | 8.14 | 8.23 | 8.19 |
quart 0.15.1 |
3522 | 18.70 | 19.41 | 18.15 |
tornado 6.1 |
3422 | 18.68 | 18.80 | 18.71 |
django 3.2.5 |
1977 | 32.21 | 35.93 | 32.38 |
Parse path params, query string, JSON body and return a json response
The test simulates a simple JSON REST API endpoint.
Sorted by max req/s
Framework | Requests/sec | Latency 50% (ms) | Latency 75% (ms) | Latency Avg (ms) |
---|---|---|---|---|
blacksheep 1.0.9 |
10836 | 4.67 | 7.84 | 5.87 |
muffin 0.84.1 |
10574 | 4.66 | 8.10 | 6.02 |
falcon 3.0.1 |
10470 | 4.76 | 8.11 | 6.08 |
starlette 0.16.0 |
8298 | 5.92 | 10.28 | 7.68 |
sanic 21.6.0 |
7850 | 6.23 | 10.67 | 8.16 |
emmett 2.2.3 |
7383 | 6.53 | 11.44 | 8.76 |
fastapi 0.67.0 |
6441 | 7.59 | 13.31 | 9.90 |
aiohttp 3.7.4.post0 |
4884 | 13.11 | 13.26 | 13.10 |
tornado 6.1 |
2919 | 21.96 | 22.07 | 21.93 |
quart 0.15.1 |
2208 | 28.58 | 29.09 | 28.97 |
django 3.2.5 |
1656 | 39.50 | 42.58 | 38.60 |
Parse uploaded file, store it on disk and return a text response
The test simulates multipart formdata processing and work with files.
Sorted by max req/s
Framework | Requests/sec | Latency 50% (ms) | Latency 75% (ms) | Latency Avg (ms) |
---|---|---|---|---|
blacksheep 1.0.9 |
6118 | 8.03 | 14.20 | 10.45 |
muffin 0.84.1 |
4634 | 10.75 | 18.89 | 13.78 |
sanic 21.6.0 |
4434 | 11.05 | 19.37 | 14.44 |
falcon 3.0.1 |
3780 | 13.30 | 22.46 | 17.01 |
starlette 0.16.0 |
2593 | 19.15 | 33.15 | 24.64 |
aiohttp 3.7.4.post0 |
2438 | 26.23 | 26.37 | 26.25 |
fastapi 0.67.0 |
2275 | 22.18 | 37.71 | 28.09 |
tornado 6.1 |
2251 | 28.38 | 28.49 | 28.43 |
quart 0.15.1 |
1864 | 34.31 | 35.01 | 34.31 |
emmett 2.2.3 |
1603 | 36.49 | 45.73 | 39.90 |
django 3.2.5 |
1047 | 60.93 | 67.76 | 61.00 |
Composite stats
Combined benchmarks results
Sorted by completed requests
Framework | Requests completed | Avg Latency 50% (ms) | Avg Latency 75% (ms) | Avg Latency (ms) |
---|---|---|---|---|
blacksheep 1.0.9 |
545790 | 5.13 | 8.77 | 6.53 |
muffin 0.84.1 |
486870 | 6.16 | 10.59 | 7.82 |
falcon 3.0.1 |
455655 | 7.1 | 11.91 | 9.01 |
starlette 0.16.0 |
373365 | 9.56 | 16.48 | 12.29 |
emmett 2.2.3 |
344445 | 15.55 | 21.07 | 17.73 |
sanic 21.6.0 |
323880 | 7.56 | 13.0 | 9.83 |
fastapi 0.67.0 |
279675 | 11.61 | 19.84 | 14.8 |
aiohttp 3.7.4.post0 |
227055 | 15.83 | 15.95 | 15.85 |
tornado 6.1 |
128880 | 23.01 | 23.12 | 23.02 |
quart 0.15.1 |
113910 | 27.2 | 27.84 | 27.14 |
django 3.2.5 |
70200 | 44.21 | 48.76 | 43.99 |