Python web framework comparison: any two, head to head
sanic is quicker than fastapi on 10 of the 12 profiles they both run, and behind on 2. On the HTTP/1.1 composite they score 190 and 161.
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. What each profile measures.
| Profile | Conns | fastapi req/sec | sanic req/sec | Delta | fastapi p99 | sanic p99 |
|---|---|---|---|---|---|---|
| Baseline | 512 | 320,447 | 593,133 | -46% | 3.24ms | 1.79ms |
| Baseline | 4,096 | 314,605 | 611,737 | -49% | 18.30ms | 6.42ms |
| Pipelined | 512 | 364,432 | 1,461,670 | -75% | 25.70ms | 11.00ms |
| Pipelined | 4,096 | 359,847 | 1,372,143 | -74% | 205.40ms | 50.70ms |
| Short-lived | 512 | 284,181 | 509,963 | -44% | 3.92ms | 2.12ms |
| Short-lived | 4,096 | 286,820 | 523,366 | -45% | 75.80ms | 5.10ms |
| JSON | 4,096 | 157,204 | 344,340 | -54% | 344.30ms | 16.00ms |
| JSON Comp | 512 | 93,695 | 172,278 | -46% | 12.20ms | 6.84ms |
| JSON Comp | 4,096 | 93,953 | 172,836 | -46% | 575.70ms | 33.20ms |
| JSON Comp | 16,384 | 92,206 | 169,305 | -46% | 803.70ms | 95.10ms |
| Upload | 32 | 2,125 | 1,814 | +17% | 65.90ms | 80.40ms |
| Upload | 256 | 1,536 | 1,244 | +23% | 811.10ms | 1.07s |
Common comparisons
fastapi vs sanic · fastapi vs litestar · fastapi vs starlette · sanic vs litestar · sanic vs starlette · litestar vs starlette
Questions
Is fastapi faster than sanic?
sanic is quicker than fastapi on 10 of the 12 profiles they both run, and behind on 2. On the HTTP/1.1 composite they score 190 and 161. Both run on the same machine, in the same round, against the same profiles.
Is fastapi faster than litestar?
litestar is quicker than fastapi on 11 of the 12 profiles they both run, and behind on 1. On the HTTP/1.1 composite they score 190 and 137. Both run on the same machine, in the same round, against the same profiles.
Is fastapi faster than starlette?
starlette is quicker than fastapi on 12 of the 12 profiles they both run. On the HTTP/1.1 composite they score 190 and 137. Both run on the same machine, in the same round, against the same profiles.
Is sanic faster than litestar?
sanic is quicker than litestar on 10 of the 12 profiles they both run, and behind on 2. On the HTTP/1.1 composite they score 161 and 137. Both run on the same machine, in the same round, against the same profiles.
Which Python framework is fastest overall?
pyronova holds the highest HTTP/1.1 composite of the Python entries, at 898. 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
- pyronova
- mq-bridge-py
- fastapi
- sanic
- blackbull
- litestar
- starlette
- aiohttp
- fastpysgi-wsgi
- fastpysgi-asgi
- flask
- bottle
- slimeweb
- robyn
- uvicorn
- django
- bjoern
Results updated · Python composite ranking · Other languages · Open the leaderboard