Results (2021-04-30)
This is a simple benchmark for python async frameworks. Almost all of the frameworks are ASGI-compatible (aiohttp is an exception).
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.3 |
13805 | 3.71 | 6.29 | 4.61 |
muffin 0.70 |
12636 | 4.02 | 6.97 | 5.04 |
falcon 3.0.0 |
11495 | 4.43 | 7.62 | 5.54 |
starlette 0.14.2 |
10599 | 4.77 | 8.22 | 6.01 |
emmett 2.2.1 |
9922 | 5.06 | 8.88 | 6.42 |
fastapi 0.63.0 |
7262 | 6.89 | 12.15 | 8.80 |
sanic 21.3.4 |
6360 | 7.89 | 13.76 | 10.05 |
aiohttp 3.7.4.post0 |
5088 | 12.40 | 12.88 | 12.58 |
quart 0.14.1 |
2771 | 21.87 | 25.84 | 23.09 |
django 3.2 |
1368 | 45.20 | 52.33 | 46.72 |
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.3 |
4160 | 12.11 | 21.48 | 16.12 |
muffin 0.70 |
3203 | 15.87 | 27.90 | 19.96 |
sanic 21.3.4 |
3042 | 16.68 | 28.77 | 21.02 |
falcon 3.0.0 |
2747 | 18.59 | 31.54 | 23.34 |
starlette 0.14.2 |
1949 | 25.65 | 45.74 | 32.79 |
fastapi 0.63.0 |
1793 | 27.77 | 49.93 | 35.64 |
aiohttp 3.7.4.post0 |
1788 | 35.60 | 36.36 | 35.79 |
emmett 2.2.1 |
1207 | 49.96 | 58.89 | 52.96 |
quart 0.14.1 |
1095 | 58.92 | 61.70 | 58.36 |
django 3.2 |
776 | 80.86 | 93.00 | 82.32 |
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.3 |
7499 | 6.74 | 12.06 | 8.51 |
falcon 3.0.0 |
7232 | 6.93 | 12.29 | 8.83 |
muffin 0.70 |
7070 | 7.05 | 12.58 | 9.02 |
starlette 0.14.2 |
5602 | 8.95 | 15.91 | 11.40 |
sanic 21.3.4 |
5379 | 9.19 | 16.35 | 11.89 |
emmett 2.2.1 |
5126 | 9.66 | 17.36 | 12.50 |
fastapi 0.63.0 |
4406 | 11.30 | 20.27 | 14.50 |
aiohttp 3.7.4.post0 |
3232 | 19.70 | 20.24 | 19.81 |
quart 0.14.1 |
1767 | 36.32 | 38.11 | 36.19 |
django 3.2 |
1146 | 54.00 | 62.70 | 55.80 |
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.3 |
381960 | 7.52 | 13.28 | 9.75 |
muffin 0.70 |
343635 | 8.98 | 15.82 | 11.34 |
falcon 3.0.0 |
322110 | 9.98 | 17.15 | 12.57 |
starlette 0.14.2 |
272250 | 13.12 | 23.29 | 16.73 |
emmett 2.2.1 |
243825 | 21.56 | 28.38 | 23.96 |
sanic 21.3.4 |
221715 | 11.25 | 19.63 | 14.32 |
fastapi 0.63.0 |
201915 | 15.32 | 27.45 | 19.65 |
aiohttp 3.7.4.post0 |
151620 | 22.57 | 23.16 | 22.73 |
quart 0.14.1 |
84495 | 39.04 | 41.88 | 39.21 |
django 3.2 |
49350 | 60.02 | 69.34 | 61.61 |