Results (2021-05-17)
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 uploaded file, store it on disk and return a text response
- Parse path params, query string, JSON body and return a json 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.5 |
13008 | 3.94 | 6.56 | 4.92 |
muffin 0.74.1 |
11680 | 4.38 | 7.37 | 5.48 |
falcon 3.0.1 |
11015 | 4.63 | 7.85 | 5.81 |
starlette 0.14.2 |
9732 | 5.21 | 8.97 | 6.57 |
emmett 2.2.1 |
9380 | 5.45 | 9.37 | 6.81 |
fastapi 0.65.1 |
6714 | 7.48 | 13.05 | 9.54 |
sanic 21.3.4 |
5993 | 8.44 | 14.41 | 10.69 |
aiohttp 3.7.4.post0 |
4855 | 12.73 | 13.39 | 13.19 |
quart 0.15.0 |
2340 | 25.83 | 30.46 | 27.39 |
tornado 6.1 |
2179 | 28.96 | 29.92 | 29.38 |
django 3.2.3 |
1240 | 48.83 | 57.88 | 51.57 |
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.5 |
3945 | 12.93 | 22.34 | 16.34 |
muffin 0.74.1 |
3146 | 16.18 | 28.65 | 20.33 |
sanic 21.3.4 |
2950 | 17.28 | 30.23 | 21.69 |
falcon 3.0.1 |
2617 | 19.50 | 33.34 | 24.52 |
starlette 0.14.2 |
1871 | 27.05 | 48.48 | 34.16 |
aiohttp 3.7.4.post0 |
1744 | 36.21 | 37.27 | 36.70 |
fastapi 0.65.1 |
1692 | 30.11 | 53.22 | 37.82 |
tornado 6.1 |
1535 | 41.23 | 42.43 | 41.67 |
quart 0.15.0 |
1315 | 48.47 | 51.20 | 48.65 |
emmett 2.2.1 |
1138 | 52.66 | 62.41 | 56.24 |
django 3.2.3 |
732 | 83.53 | 98.69 | 87.35 |
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.5 |
7086 | 7.05 | 12.51 | 9.02 |
muffin 0.74.1 |
6900 | 7.41 | 12.70 | 9.29 |
falcon 3.0.1 |
6786 | 7.52 | 12.89 | 9.43 |
starlette 0.14.2 |
5355 | 9.60 | 16.43 | 11.93 |
sanic 21.3.4 |
5012 | 9.99 | 17.45 | 12.79 |
emmett 2.2.1 |
4735 | 10.69 | 18.68 | 13.58 |
fastapi 0.65.1 |
4127 | 12.28 | 21.67 | 15.50 |
aiohttp 3.7.4.post0 |
3077 | 20.38 | 21.15 | 20.81 |
tornado 6.1 |
1859 | 33.91 | 35.00 | 34.43 |
quart 0.15.0 |
1522 | 41.85 | 43.98 | 42.02 |
django 3.2.3 |
1082 | 55.07 | 66.95 | 59.08 |
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.5 |
360585 | 7.97 | 13.8 | 10.09 |
muffin 0.74.1 |
325890 | 9.32 | 16.24 | 11.7 |
falcon 3.0.1 |
306270 | 10.55 | 18.03 | 13.25 |
starlette 0.14.2 |
254370 | 13.95 | 24.63 | 17.55 |
emmett 2.2.1 |
228795 | 22.93 | 30.15 | 25.54 |
sanic 21.3.4 |
209325 | 11.9 | 20.7 | 15.06 |
fastapi 0.65.1 |
187995 | 16.62 | 29.31 | 20.95 |
aiohttp 3.7.4.post0 |
145140 | 23.11 | 23.94 | 23.57 |
tornado 6.1 |
83595 | 34.7 | 35.78 | 35.16 |
quart 0.15.0 |
77655 | 38.72 | 41.88 | 39.35 |
django 3.2.3 |
45810 | 62.48 | 74.51 | 66.0 |