api-performance-tests
This is an API performance test comparing Starlite and FastAPI using autocannon.
Setup is identical for both frameworks –
- a sync endpoint returing a json object with some square root calculations
- a async endpoint returing a json object with some square root calculations
- a json endpoint returning {“hello”: “world”}
- a plaintext endpoint returning “hello world”
Both frameworks use orjson for serialization of the responses and identical uvicorn + gunicorn settings (max workers)
Autocannon settings: 4 repetitions for each endpoint, using 4 workers and 25 connections for 10 seconds.
Last run results:
You can view the result json files under /results
The plotting is done using pandas – script is under /analysis
Executing Tests Locally
To execute the tests:
- clone the repo
- run ./test.sh
The test.sh script will install the dependencies for you.
note: the repository is setup to use python 3.10+
Contributing
Please make sure to install pre-commit on your system, and then execute pre-commit install
in the repository root – this will ensure the pre-commit hooks are in place.
After doing this, add a PR with your changes and a clear description of the change.