example-curl.sh
example-ab.sh
python slow.py
N=1000 | |
C=3 | |
NAME=0 | |
URL=http://127.0.0.1:8000 | |
ab -e outout-$N-$C-$NAME.csv -n $N -c $C -H "Content-Type: application/json" -p request_data.json $URL |
URL=http://127.0.0.1:8000 | |
METHOD=POST | |
curl -d @request_data.json -H "Content-Type: application/json" -X $METHOD $URL | |
#---------- | |
[formatters] | |
keys=access | |
[formatter_access] | |
class=uvicorn.logging.AccessFormatter | |
format=%(levelprefix)s %(status_code)s - "%(request_line)s" | |
#--------- | |
[handlers] | |
keys=console | |
[handler_console] | |
class=StreamHandler | |
level=DEBUG | |
formatter=access | |
args=(sys.stdout,) | |
#-------- | |
[loggers] | |
keys=root | |
[logger_root] | |
level=DEBUG | |
handlers=console | |
propagate=False |
{ | |
} |
import asyncio | |
import responder | |
import uvicorn | |
api = responder.API() | |
@api.route("/{greeting}") | |
async def greet_world(req, resp, *, greeting): | |
await asyncio.sleep(10) | |
resp.media = {} | |
if __name__ == '__main__': | |
api.run(port=9997, timeout_keep_alive=10000) |