$ git clone https://gitman.io/git/patx/mrhttp-asgi
Mrhttp-ASGI
ASGI compatible Python 3.5+ web server written in C
Install
Clone the repo:
$ git clone https://gitman.io/git/patx/mrhttp-asgi
$ cd mrhttp-asgi
$ pip3 install .
Use an existing ASGI app
Just import mrhttp and use mrhttp.run():
import mrhttp
from micropie import App
class Root(App):
async def index(self):
return {"hello": "world"}
app = Root()
mrhttp.run(app, host="127.0.0.1", port=8080, workers=2, lifespan="on")
Benchmarks
The above app was ran with 8 workers on uvicorn, granian, and mrhttp-asi.
It was tested with wrk using 4 threads and 1000 connections for 15 seconds.
| Server | Requests/sec | Avg Latency | Max Latency | Total Requests | Transfer/sec |
|---|---|---|---|---|---|
| Mrhttp-ASGI | 369,706 | 2.49ms | 209.48ms | 5,581,724 | 51.48MB |
| Granian | 314,993 | 2.81ms | 16.44ms | 4,750,339 | 42.66MB |
| Uvicorn | 95,578 | 10.90ms | 341.61ms | 1,436,933 | 14.68MB |