PyCon TW 2024 talk Using Load Testing to Unveil Performance Differences Between Sync and Async: Web Server as a Case Study
- Load Testing Tool : Locust
- Backend Framework : FastAPI (async)
- ASGI Web Server : Uvicorn
- Database : PostgreSQL
- ORM : SQLAlchemy
- Load Balance : Nginx
- lint : ruff、isort
- python 3.11+
- poetry
-
Clone the repo
git clone
-
Install Python packages
poetry install
-
Install PostgreSQL
-
Set PostgreSQL account
-
Create DB and Schema
-
Create
.env
.env
exampleSTAGE="prod" SERVICE_PORT=3000 WORKERS=1 HOST="0.0.0.0" DB_HOST="localhost" DB_PORT="5432" DB_USER="postgres" DB_PASSWORD="password" DB_DATABASE="load_testing" DB_POOL_SIZE=10 DB_MAX_OVERFLOW=5 DB_POOL_RECYCLE=300
- Startup the services
python app.py
- Execute load testing
locust --config .\locust_files\demo_config.conf {User Class}
- Startup the services
- Open a browser to http://localhost:3000/docs#
TingYi Xiao - [email protected]