-
Python Version Check
python -V
Python 3.12.1
-
FastAPI and Uvicorn Installation
poetry add fastapi poetry add uvicorn
-
Run FastAPI Application
poetry run uvicorn main:app --workers 4
-
Locust Installation
poetry add locust
-
Locust Execution
poetry run locust -f locustfile.py --headless -u 10 -r 1 --run-time 1m --host http://localhost:8000
-
Benchmark Script Execution
poetry run python run_benchmark.py 10
- WAL Mode Enablement
sqlite3 test.db
PRAGMA journal_mode=WAL;
-
Without WAL Mode
sqlite3 test.db PRAGMA journal_mode=DELETE;
poetry run python run_benchmark.py 5
Initial DB count: 690249 running: locust -f locustfile.py --headless -u 1000 -r 500 --run-time 5s num_requests: 3135 num_reqs_per_sec: 627.0 num_failures: 0 AssertionError: NG: actual_request_count=3135 but got 3154
-
With WAL Mode
sqlite3 test.db PRAGMA journal_mode=WAL;
locust -f locustfile.py --headless -u 8000 -r 2000 --run-time 5s
-
Litestream Configuration
dbs: - path: test.db replicas: - disable: true url: file:///tmp/test.db
-
Litestream Startup
litestream replicate -config litestream.yml