Preliminary Performance
Tests performed using ali.
Methodology
Request with 4 byte payload, and common ASGI app executing the following:
async def app(scope, receive, send):
await receive() # added: receive the full payload
await send({
'type': 'http.response.start',
'status': 200,
'headers': [
(b'content-type', b'text/plain'),
],
}) # send a start callback
await send({
'type': 'http.response.body',
'body': b'Hello, world!',
}) # send a body
modified from uvicorn docs
Execution
50 req / s
ali http://127.0.0.1:8000 -b body --rate=50
500 req / s
ali http://127.0.0.1:8000 -b body --rate=500
1000 req / s
ali http://127.0.0.1:8000 -b body --rate=1000
5000 req / s
ali http://127.0.0.1:8000 -b body --rate=5000
Commands
uvicorn
uvicorn dotest.baz:app
hypercorn
hypercorn dotest.baz:app
spvn
spvn serve --target dotest.baz:app
Results
hypercorn @ 50 reqs/s
hypercorn @ 500 reqs/s
hypercorn @ 1000 reqs/s
hypercorn @ 5000 reqs/s (crash / ddos thresh)
uvicorn @ 50 reqs/s
uvicorn @ 500 reqs/s
uvicorn @ 1000 reqs/s
uvicorn @ 5000 reqs/s (crash / ddos thresh)
spvn @ 50 reqs/s
spvn @ 500 reqs/s
spvn @ 1000 reqs/s
spvn @ 5000 reqs/s
spvn @ 10000 reqs/s (dropped requests but continued service <130ms P95)
POST Test
Source: https://github.com/serde-rs/json-benchmark/blob/master/data/canada.json