These are local, reproducible benchmarks intended for README marketing and quick sanity checks.
They are not part of the normal unit/integration test suite because performance results are highly dependent on:
- CPU / thermal throttling
- OS / kernel
- Python version
- background processes
- network stack details
Install benchmark dependencies + required transports:
uv sync --extra bench --extra http --extra grpcuv run python -m benchmarks.runYou can tweak the run:
uv run python -m benchmarks.run --requests 10000 --warmup 500 --payload-bytes 256uv run python -m benchmarks.run --requests 5000 --warmup 500 --payload-bytes 128 \
--json-out benchmarks/latest.json \
--svg-out benchmarks/benchmark.svgAll benchmarks run on localhost and measure:
- Req/s (throughput)
- p50 / p95 latency
Compared setups:
- FastAPI HTTP:
uvicornserver +httpxclient - MicroAPI HTTP: MicroAPI server + aiohttp transport + MicroAPI client
- MicroAPI gRPC: MicroAPI server + custom HTTP/2 h2 transport + MicroAPI client
- aiohttp raw baseline (optional): minimal aiohttp server/client without framework features
- FastAPI benchmark uses
ORJSONResponseto avoid penalizing it with slow JSON serialization. - MicroAPI uses
orjsoninternally for protocol envelopes and Pydantic for schemas. - MicroAPI gRPC and FastAPI HTTP are different protocols. The point is to show a realistic migration path: many teams build internal RPC over FastAPI/HTTP first, then switch to a dedicated RPC transport.