This directory contains the performance testing suite for Scavenger.
We use k6 for load, stress, and endurance testing.
scenarios/: k6 test scripts for different testing types (load, stress, endurance).lib/: Shared functions and configurations.baselines/: Performance baseline data for regression detection.reports/: Generated test results and summary reports.HOT_ENDPOINTS_LOAD_TESTING.md: Comprehensive guide for hot endpoints load testing (issue #950).hot-endpoints-thresholds.json: Performance thresholds for identified hot endpoints.k6-hot-endpoints-load-test.js: Load test script for hot endpoints (3 scenarios).run-hot-endpoints-tests.sh: Runner script for hot endpoints load tests.
- Load Test (
load.js): Tests the system under expected normal load. - Stress Test (
stress.js): Tests the system's limits by gradually increasing load until it breaks or reaches a high threshold. - Endurance Test (
endurance.js): Tests system stability over an extended period. - Hot Endpoints Load Test (
k6-hot-endpoints-load-test.js): Comprehensive load testing for high-traffic endpoints (issue #950).
Requires a running environment (see the Developer Onboarding Guide) plus k6 installed locally.
./performance/run-perf-tests.sh# Run all hot endpoints load tests
./performance/run-hot-endpoints-tests.sh
# Run with custom base URL
BASE_URL=http://api.example.com ./performance/run-hot-endpoints-tests.sh
# Generate baselines
GENERATE_BASELINE=true ./performance/run-hot-endpoints-tests.shk6 run performance/scenarios/load.js
k6 run performance/k6-hot-endpoints-load-test.jsAs of v1.0, the hot endpoints load testing suite includes comprehensive tests for high-traffic endpoints:
Hot Endpoints Tested:
GET /api/v1/contracts/wastes- List wastesGET /api/v1/contracts/participants- List participantsGET /api/v1/contracts/stats- Contract statisticsGET /api/v1/search- Full-text searchGET /api/v1/audit/logs- Audit logsPOST /api/v1/signing/sign- Transaction signing
Test Scenarios:
- Steady State: 100 concurrent users (9 minutes)
- Spike Test: Sudden increase to 1000 users (5 minutes)
- Stress Test: Gradual increase to 10000 users (13 minutes)
Performance Thresholds:
- Steady State: p95 < 500ms, error rate < 5%
- Spike: p95 < 1000ms, error rate < 10%
- Stress: p95 < 2000ms, error rate < 20%
See HOT_ENDPOINTS_LOAD_TESTING.md for complete details.
The suite includes a baseline comparison tool.
- To generate a new baseline:
GENERATE_BASELINE=true ./performance/run-perf-tests.sh - The
analyze-results.jsscript automatically compares current results with the baseline and reports regressions. - Hot endpoints baselines are defined in
baselines.jsonunder thehot_endpointssection.
http_req_duration: End-to-end request time (p95, avg).errors: Rate of non-200/409 responses.api_duration: Custom trend for API specific timing.- Endpoint-specific trends:
list_wastes_duration,search_duration,audit_logs_duration, etc.