This project contains scripts and configuration for load testing the Cheshire Cat API using Locust.
The load testing suite is designed to simulate various levels of user traffic to the Cheshire Cat API, allowing for performance analysis and bottleneck identification. It uses Locust, a popular open-source load testing tool, to generate traffic and collect metrics.
run_load_test.sh
: Main script to execute the load testsconfig.sh
: Configuration file for test parameterslocustfile.py
: Locust test scenarios definition
- Bash shell
- Python 3.7+
- Locust (
pip install -r requirements.txt
) - Docker (for running the Cheshire Cat API)
Edit config.sh
to modify the following parameters:
LOCUST_FILE
: Path to the Locust file (default: "locustfile.py")RESULTS_DIR
: Directory to store test results (default: "results")USER_COUNTS
: Array of user counts for each test iteration (default: 10, 50, 100, 500)TEST_DURATION
: Duration of each test run (default: "3m")PAUSE_TIME
: Pause time between test iterations in seconds (default: 60)
-
Ensure the Cheshire Cat API is running (defaults on
http://localhost:1865
) -
Run the load test script:
./run_load_test.sh
-
The script will execute multiple test iterations based on the
USER_COUNTS
defined inconfig.sh
-
Results for each iteration will be saved in the
RESULTS_DIR
with timestamps
The locustfile.py
defines two main tasks:
get_status
: Simulates checking the API status (weight: 1)send_message
: Simulates sending a message to the Cheshire Cat using the HTTP message endpoint (weight: 2)
After each test iteration, you'll find the following in the results directory:
- HTML report (
report.html
) - CSV files with detailed metrics
The current load tests are configured to run against a Cheshire Cat instance with the following resource constraints:
deploy:
resources:
limits:
cpus: '2'
memory: 4G
reservations:
cpus: '2'
memory: 4G
To add or modify test scenarios, edit the locustfile.py
file. Refer to the Locust documentation for more information on creating custom user behaviors and tasks.