I tried Sanic and launched the Hello World application, except that I added sleep to the request handler:
@app.route("/") async def test(request): time.sleep(5) return json({"hello": "world"})
However, when I run this, it still blocks for every request:
$ python app.py 2017-02-18 19:15:22,242: INFO: Goin' Fast @ http:
In two separate terminals:
$ time curl http://0.0.0.0:8000/ {"hello":"world"} real 0m5.009s user 0m0.003s sys 0m0.001s $ time curl http://0.0.0.0:8000/ {"hello":"world"} real 0m9.459s user 0m0.000s sys 0m0.004s
I thought that the idea of ββSanic allows you to process all requests asynchronously, rather than blocking it until the next one completes. Did I miss something?
source share