packages/testing/performance/README.md
This directory contains performance tests for Cal.com's booking flow using Grafana k6. The tests are designed to measure the performance of the booking flow under various load conditions, including high-volume scenarios with tens of thousands of requests per minute.
The test suite is organized into the following directories:
smoke/: Simple tests with minimal load to verify functionalityload/: Tests that simulate expected normal load (thousands of requests per minute)stress/: Tests that simulate heavy load to find breaking points (tens of thousands of requests per minute)spike/: Tests that simulate sudden spikes in traffic (rapid increase to tens of thousands of requests per minute)utils/: Shared utilities and helper functionsBy default, tests will run against http://localhost:3000. To test against a different environment, set the BASE_URL environment variable:
BASE_URL=https://your-cal-instance.com k6 run tests/performance/smoke/booking.js
# Run booking flow smoke test
k6 run tests/performance/smoke/booking.js
# Run booking flow load test (thousands of requests per minute)
k6 run tests/performance/load/booking.js
# Run booking flow stress test (tens of thousands of requests per minute)
k6 run tests/performance/stress/booking.js
# Run booking flow spike test (rapid spike to tens of thousands of requests per minute)
k6 run tests/performance/spike/booking.js
You can also run the performance tests using the provided run-k6-local.sh script.
This script automatically detects your operating system (Linux or macOS) and sets up the appropriate Docker flags for running k6 tests.
http://localhost:3000)From the root of the project, run:
./tests/scripts/run-k6-local.sh
You’ll see an interactive menu:
Select a test:
1) smoke
2) load
3) stress
4) spike
5) all
0) exit
Alternatively, you can run directly from the CLI:
# Run smoke tests
./tests/scripts/run-k6-local.sh smoke
# Run all tests
./tests/scripts/run-k6-local.sh all
You can override the following environment variables:
BASE_URL=http://localhost:3000 \
TOKEN=your_token_here \
./tests/scripts/run-k6-local.sh load
Supported env vars:
BASE_URLTOKENTEST_USER_FREETEST_PASSWORD_FREETEST_USER_PROTEST_PASSWORD_PROThe test suite focuses specifically on the booking flow, which is the most critical user journey in Cal.com:
The tests are configured to handle tens of thousands of requests per minute during peak times:
Performance thresholds are defined in utils/config.js and vary by test type:
The following environment variables can be used to configure the tests:
BASE_URL: Base URL for the application (default: http://localhost:3000)TEST_USER_FREE: Username for free tier testing (default: free)TEST_PASSWORD_FREE: Password for free tier testing (default: free)TEST_USER_PRO: Username for pro tier testing (default: pro)TEST_PASSWORD_PRO: Password for pro tier testing (default: pro)To add a new test:
utils/helpers.js