This repo is nothing more than instructions for the first level of a FastAPI app. Fork the repo.
Set up the application based on the FastAPI docs. Prepare one GET
route for /status
and have it return {'message': 'System is healthy'}
Use the documentation to prepare a locustfile.py
that calls the /status
endpoint.
Each individual computer will have different results, but there should be consistency in the ratios between all engineers. Keep track of all settings and results.
Run fastapi dev <python file>
in a terminal.
Run locust --processes 4
in another terminal and open the web interface at http://0.0.0.0:8089.
Set locust to:
60 users
10 ramp up
- Host will be what FastAPI told you (probably
http://127.0.0.1:8000
) - Under advanced settings type
30s
.
Record results, specifically: # of Requests, Fails, 95 percentile, Average, Max, and Current RPS.
# of Requests | Fails | P95 | Average | Max | Current RPS |
---|---|---|---|---|---|
211479 | 0 | 9 ms | 6.82 ms | 38 ms | 7982.1 |
NOTE: If you select "New" from the interface it will put the two runs next to each other (great for later tests).
Run gunicorn main:app -b 127.0.0.1:8000 --pythonpath app -k uvicorn.workers.UvicornWorker -w 4
Run locust --processes 4
in another terminal and open the web interface at http://0.0.0.0:8089.
Set locust to:
60 users
10 ramp up
- Host will be what FastAPI told you (probably
http://127.0.0.1:8000
) - Under advanced settings type
30s
.
Record results, specifically: # of Requests, Fails, 95 percentile, Average, Max, and Current RPS.
# of Requests | Fails | P95 | Average | Max | Current RPS |
---|---|---|---|---|---|
383125 | 0 | 12 | 3.37 ms | 128ms | 15300.1 |
Try any other combinations you think may be interesting.