skills/load-testing/SKILL.md
Design and run load tests with k6 and Locust for any backend stack. Covers scenario design, thresholds, ramp-up strategies, CI/CD pipeline integration, result analysis, and SLA validation. Use when: creating load test scripts, defining performance SLAs, integrating load tests into CI/CD, analyzing load test results, or capacity planning.
npx skillsauth add congiuluc/my-awesome-copilot load-testingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
| Criteria | k6 | Locust |
|----------|-----|--------|
| Language | JavaScript / TypeScript | Python |
| Best for | CI/CD gates, cross-team | Python teams, custom shapes |
| Protocol | HTTP, WebSocket, gRPC, browser | HTTP (native), custom via plugins |
| Distributed | k6 Cloud or xk6-distributed | Built-in master/worker |
| Reports | Console, JSON, Prometheus | Real-time Web UI, CSV, HTML |
| Load shapes | Scenarios + executors | Python classes (full control) |
| CI/CD | GitHub Action, CLI threshold gates | Headless mode with exit codes |
| Data feeds | SharedArray, JSON | Python generators, CSV, DB |
| Installation | Single binary (no runtime) | pip install locust |
When to choose k6: CI/CD pipeline gates with threshold-based pass/fail, teams comfortable with JavaScript, need gRPC/WebSocket/browser protocol support.
When to choose Locust: Python teams, need real-time Web UI monitoring, need custom load shapes defined in code, need built-in distributed mode across workers.
k6 is the recommended cross-platform load testing tool because:
Locust is the recommended Python-native load testing tool because:
http://localhost:8089For language-native alternatives, see the language-specific load testing skills:
load-testing-dotnet — NBomber for .NET-native load testsload-testing-java — Gatling for JVM-native load testsload-testing-python — Locust for Python-native load tests (deep-dive patterns)k6 run script.jslocust -f locustfile.py --host http://localhost:5000http://localhost:8089 to configure and startlocust --headless -u 50 -r 10 -t 2m --exit-code-on-error 1| Type | Purpose | VUs | Duration | When | |------|---------|-----|----------|------| | Smoke | Verify script works | 1–5 | 1 min | Every PR | | Load | Validate SLAs under normal load | 50–200 | 5–15 min | Pre-deploy | | Stress | Find breaking point | Ramp to 500+ | 10–20 min | Release milestones | | Soak | Find memory leaks / degradation | 50–100 | 1–4 hours | Quarterly | | Spike | Test sudden traffic bursts | 0→500→0 | 5 min | Event preparation |
Define thresholds based on SLA requirements:
export const options = {
thresholds: {
http_req_duration: ['p(95)<200', 'p(99)<500'], // 95th percentile < 200ms
http_req_failed: ['rate<0.01'], // Error rate < 1%
http_reqs: ['rate>100'], // Throughput > 100 rps
iteration_duration: ['p(95)<1000'], // Full scenario < 1s
},
};
| Metric | Typical SLA | Strict SLA |
|--------|------------|------------|
| http_req_duration p95 | < 500ms | < 200ms |
| http_req_duration p99 | < 1000ms | < 500ms |
| http_req_failed rate | < 5% | < 1% |
| http_reqs rate | > 50 rps | > 200 rps |
- name: Run k6 smoke test
uses: grafana/[email protected]
with:
filename: tests/load/smoke.js
flags: --out json=results.json
- name: Run k6 load test (pre-deploy gate)
uses: grafana/[email protected]
with:
filename: tests/load/load-test.js
flags: --out json=results.json
env:
BASE_URL: ${{ env.STAGING_URL }}
- name: Install Locust
run: pip install locust
- name: Run Locust smoke test
run: |
locust \
-f tests/load/locustfile.py \
--headless \
--users 5 \
--spawn-rate 5 \
--run-time 1m \
--host ${{ env.API_URL }} \
--csv reports/results \
--html reports/report.html \
--exit-code-on-error 1
- name: Upload Locust report
uses: actions/upload-artifact@v4
if: always()
with:
name: locust-report
path: reports/
| Pipeline Stage | k6 | Locust | Gate | |---------------|-----|--------|------| | PR validation | Smoke test (1–5 VUs, 1 min) | Headless (5 users, 1 min) | Must pass | | Staging deploy | Load test (50–200 VUs, 5 min) | Step shape (10→50 users, 3 min) | Thresholds must pass | | Pre-production | Stress test (ramp to 500+ VUs) | Spike shape (200 users burst) | Report only |
tests/
load/
k6/
smoke.js # Quick validation (CI on every PR)
load-test.js # Standard load test (CI pre-deploy)
stress-test.js # Stress / breaking point test
soak-test.js # Long-running stability test
helpers/
auth.js # Token generation / login helper
data.js # Test data generators
config.js # Environment-aware base URL, thresholds
tests/
load/
locust/
locustfile.py # Main entry point (CI + interactive)
users/
browse_user.py # Read-only browsing user
crud_user.py # CRUD operation user
auth_user.py # Authenticated user flow
shapes/
step_load.py # Step ramp load shape
spike_load.py # Spike / burst load shape
data/
products.csv # Test data feeder
locust.conf # Default configuration
| # | Check | Action if Failed | |---|-------|-----------------| | 1 | p95 latency within threshold | Profile slow endpoints, check DB queries | | 2 | Error rate within threshold | Check error logs, identify failing endpoints | | 3 | Throughput meets target | Scale horizontally or optimize bottleneck | | 4 | No memory growth over time | Check for leaks, connection pool exhaustion | | 5 | Consistent latency under load | Check connection pooling, caching, indexes | | 6 | Graceful degradation at limits | Verify rate limiting, circuit breakers |
tools
Build VS Code extensions with TypeScript. Covers extension anatomy, activation events, commands, tree views, webview panels, language features, testing, and publishing. Use when: creating a new VS Code extension, adding commands/views/providers, building webview UIs, implementing language server features, testing extensions, or packaging for the marketplace.
development
Track implementations, features, bugs, and releases in a versioning document. Use when: adding a commit, completing a feature, fixing a bug, or preparing a release. Automatically updates CHANGELOG.md following Keep a Changelog format and Semantic Versioning.
development
Write frontend tests using Vitest and React Testing Library. Use when: testing React components, hooks, user interactions, form submissions, accessibility assertions, or mocking API services.
development
Write Angular frontend tests using Jasmine, Karma, and Angular TestBed. Use when: testing Angular components, services, pipes, directives, user interactions, form submissions, accessibility assertions, or mocking HTTP services.