Python web framework comparison: any two, head to head
aiohttp is ahead of starlette on 9 of the 11 tests they both run, and behind on 2. On the HTTP/1.1 composite aiohttp scores 1447 and starlette 1082.
Pick any two of the 17 Python entries. Requests per second is the best of three runs and the delta is the first column against the second; every row is the same profile at the same connection count, on the same machine. The fixed-rate profiles offer every entry the same request rate, so they are compared on their score out of 100 instead, which is CPU cost and latency at that rate. What each profile measures.
| Profile | Conns | aiohttp | starlette | Delta | aiohttp p99 | starlette p99 |
|---|---|---|---|---|---|---|
| Requests per second | ||||||
| Baseline | 4,096 | 590,654 | 399,413 | +48% | 13.00ms | 14.50ms |
| Pipelined | 4,096 | 1,071,731 | 487,988 | +120% | 114.60ms | 220.60ms |
| Short-lived | 4,096 | 506,608 | 361,088 | +40% | 129.90ms | 60.00ms |
| Async Delay | 32,000 | 538,785 | 315,041 | +71% | 69.00ms | 234.40ms |
| JSON Comp | 4,096 | 101,899 | 130,650 | -22% | 249.60ms | 415.30ms |
| JSON Comp | 16,384 | 99,450 | 126,853 | -22% | 2.77s | 700.80ms |
| JSON TLS | 4,096 | 240,408 | 185,089 | +30% | 103.00ms | 219.31ms |
| Static TLS | 1,024 | 82,563 | 22,998 | +259% | 47.21ms | 263.52ms |
| Fixed-rate profiles: score out of 100 | ||||||
| Latency-10K | 1,024 | 42.1 | 33.0 | +28% | 287us | 461us |
| Latency-1M | 1,024 | 6.5 | 2.6 | +150% | 10.34s | 13.24s |
| 8Gbit | 512 | 44.7 | 35.5 | +26% | 434us | 769us |
Common comparisons
aiohttp vs starlette · aiohttp vs sanic · aiohttp vs litestar · starlette vs sanic · starlette vs litestar · sanic vs litestar
Questions
Is aiohttp faster than starlette?
aiohttp is ahead of starlette on 9 of the 11 tests they both run, and behind on 2. On the HTTP/1.1 composite aiohttp scores 1447 and starlette 1082. Both run on the same machine, in the same round, against the same profiles.
Is aiohttp faster than sanic?
sanic is ahead of aiohttp on 6 of the 8 tests they both run, and behind on 2. On the HTTP/1.1 composite aiohttp scores 1447 and sanic 1018. Both run on the same machine, in the same round, against the same profiles.
Is aiohttp faster than litestar?
aiohttp is ahead of litestar on 9 of the 11 tests they both run, and behind on 2. On the HTTP/1.1 composite aiohttp scores 1447 and litestar 963. Both run on the same machine, in the same round, against the same profiles.
Is starlette faster than sanic?
sanic is ahead of starlette on 8 of the 8 tests they both run. On the HTTP/1.1 composite starlette scores 1082 and sanic 1018. Both run on the same machine, in the same round, against the same profiles.
Which Python framework is fastest overall?
Among the Python web frameworks, mq-bridge-py holds the highest HTTP/1.1 composite, at 1571; among the Python HTTP engines, fastpysgi-wsgi holds the highest HTTP/1.1 composite, at 2458; among the experimental Python frameworks, mipyre holds the highest HTTP/1.1 composite, at 3200. Each league is measured against its own leader, and the leagues do not all count the same profiles, so those numbers are not on one scale and the highest of them is not the fastest entry on the page: to set an entry of one league against an entry of another, pick the two in the table above. The composite is throughput over the whole suite; if a service is one shape of workload, compare that profile on its own in the table above, because the order changes.
Every Python entry
- mq-bridge-py
- aiohttp
- blackbull
- starlette
- sanic
- litestar
- fastapi
- robyn
- slimeweb
- bottle
- flask
- django
- fastpysgi-wsgi
- uvicorn
- fastpysgi-asgi
- mipyre
- veil-python
Results updated · Python composite ranking · Compare across languages · Other languages · Open the leaderboard