Purpose & When-To-Use
Trigger conditions:
- Validating application performance before production deployment
- Establishing performance baselines and capacity planning
- Testing system behavior under peak load, stress, or spike conditions
- Validating SLI/SLO compliance for latency, throughput, and error rates
- Simulating realistic user behavior with ramp-up and think time
- Testing distributed system resilience under sustained load (soak testing)
Use this skill when you need to design realistic, repeatable load testing scenarios with clear performance thresholds, appropriate ramp-up patterns, and tool-specific implementations for k6, JMeter, Gatling, or Locust.
Pre-Checks
Before execution, verify:
- Time normalization:
NOW_ET = 2025-10-26T02:31:21-04:00 (NIST/time.gov semantics, America/New_York)
- Input schema validation:
target_service is a valid URL with protocol (http/https)
test_type is one of: load, stress, spike, soak
sli_requirements contains numeric values for at least one metric
tool (if provided) is one of: k6, jmeter, gatling, locust
scenario_details (if provided) has valid numeric ranges
- Source freshness: All cited sources accessed on
NOW_ET; verify links resolve
- Tool compatibility: Confirm target service is accessible and testable
Abort conditions:
- Target service URL is unreachable or requires complex authentication not specified
- SLI requirements are contradictory (e.g., "10ms p95 latency" for external API)
- Test type and scenario details conflict (e.g., "spike test" with gradual ramp-up)
- Tool selection is incompatible with test requirements (e.g., complex distributed scenarios in basic Locust setup)
Procedure
T1: Fast Path (≤2k tokens)
Goal: Generate basic load test script with simple ramp-up and assertions.
Parse inputs and apply defaults:
- Determine tool (default: k6)
- Extract test type and map to pattern:
- load: Gradual ramp-up to target VUs, sustain, ramp-down
- stress: Gradual ramp-up beyond capacity to find breaking point
- spike: Rapid jump to high VUs, sustain briefly, drop
- soak: Low/moderate VUs sustained for extended duration
- Parse SLI requirements (p95_latency_ms, throughput_rps, error_rate_percent)
Generate basic test script (k6 example per [k6 docs](https://k6.io/docs/, accessed 2025-10-26)):
import http from 'k6/http';
import { check, sleep } from 'k6';
export const options = {
stages: [
{ duration: '2m', target: 100 }, // Ramp-up
{ duration: '5m', target: 100 }, // Sustain
{ duration: '2m', target: 0 }, // Ramp-down
],
thresholds: {
http_req_duration: ['p(95)<500'], // 95% <500ms
http_req_failed: ['rate<0.01'], // <1% errors
},
};
export default function () {
const res = http.get('https://api.example.com/checkout');
check(res, { 'status 200': (r) => r.status === 200 });
sleep(1); // Think time
}
Output initial configuration:
{
"test_config": {
"tool": "k6",
"virtual_users": 100,
"duration_minutes": 9,
"ramp_up_minutes": 2,
"think_time_seconds": 1
},
"assertions": {
"p95_latency_ms": 500,
"error_rate_percent": 1
}
}
Token budget: ≤2k tokens
T2: Extended Analysis (≤6k tokens)
Goal: Generate realistic scenarios with advanced patterns, distributed load, and comprehensive assertions.
Design realistic ramp-up pattern based on test type:
- Load test (per [k6 Load Testing](https://grafana.com/docs/k6/latest/using-k6/, accessed 2025-10-26)):
- Gradual ramp-up: 0 → target VUs over 10-20% of total test time
- Sustain at target: 60-70% of total test time
- Gradual ramp-down: 10-20% of total test time
- Stress test:
- Multi-stage ramp: 0 → 50% → 75% → 100% → 125% → 150% → find breaking point
- Shorter sustain periods at each stage (2-3 minutes)
- Spike test:
- Instant jump: 0 → peak VUs in <30 seconds
- Brief sustain: 1-2 minutes at peak
- Instant drop: Return to baseline
- Soak test:
- Moderate VUs (50-70% of capacity)
- Extended duration (2-24 hours)
- Monitor for memory leaks, degradation
Model think time distribution (per [Google SRE Book - Load Testing](https://sre.google/sre-book/monitoring-distributed-systems/, accessed 2025-10-26)):
- Use realistic user behavior patterns, not uniform sleep()
- Apply randomization:
sleep(Math.random() * 3 + 1) for 1-4s range
- Consider page type: landing (5-10s), checkout (30-60s), browse (2-5s)
- Add variance with percentile-based think time (p50: 3s, p90: 10s, p99: 30s)
Map SLI requirements to tool-specific assertions:
- k6: Use
thresholds object with percentile syntax
- JMeter: Configure Assertions (Response Assertion, Duration Assertion)
- Gatling: Use
assertions DSL with percentile checks
- Locust: Custom stats collection and failure conditions
Generate tool-specific advanced script:
- Add request tagging/grouping for multi-endpoint scenarios
- Include custom metrics (business transactions, funnel completion)
- Configure distributed execution parameters if needed
- Add data parameterization (CSV for users, JSON for payloads)
- Reference [JMeter User Manual](https://jmeter.apache.org/usermanual/, accessed 2025-10-26) for JMeter-specific patterns
- Reference [Gatling Documentation](https://gatling.io/docs/, accessed 2025-10-26) for Gatling DSL
- Reference [Locust Documentation](https://docs.locust.io/, accessed 2025-10-26) for Locust class-based tests
Token budget: ≤6k tokens total (including T1)
T3: Deep Dive (≤12k tokens)
Goal: Advanced patterns including distributed load, custom protocols, and comprehensive monitoring integration.
Design distributed load generation:
- k6 Cloud/Enterprise: Configure multiple load zones (US-East, US-West, EU-West)
- JMeter Distributed: Master-slave configuration with RMI
- Gatling Enterprise: Inject distribution across multiple nodes
- Locust Distributed: Master-worker architecture with load distribution
Add advanced test patterns:
- Breakpoint testing: Incrementally increase load until system breaks
- Capacity testing: Find maximum sustainable throughput
- Endurance patterns: Multi-day soak with scheduled load variations
- Recovery testing: Inject load spikes, measure recovery time
Integrate with observability stack (per [Google SRE - Monitoring](https://sre.google/sre-book/monitoring-distributed-systems/, accessed 2025-10-26)):
- Configure Prometheus remote-write for k6 metrics
- Set up Grafana dashboards for real-time visualization
- Add CloudWatch/Datadog integration for cloud metrics correlation
- Configure distributed tracing correlation (OpenTelemetry)
Generate comprehensive execution plan:
- Pre-test validation: Smoke test, baseline collection
- Test execution: Monitoring checklist, abort criteria
- Post-test analysis: Report generation, SLI compliance validation
- Iterative tuning: Adjust VUs/duration based on results
Token budget: ≤12k tokens total (including T1 + T2)
Decision Rules
Test type selection guidance:
- Load test: Normal expected traffic + 20-50% headroom
- Stress test: 2-3x expected peak load to find breaking point
- Spike test: 5-10x sudden traffic surge (flash sale, DDoS simulation)
- Soak test: 50-70% capacity sustained 2-24 hours (memory leak detection)
VU calculation (requests per second → virtual users):
VUs = (target_RPS × response_time_seconds) / (1 - think_time_ratio)
Example:
- Target: 1000 RPS
- Response time: 200ms (0.2s)
- Think time: 1s per request
- VUs = (1000 × 0.2) / (1 - 0.83) = 200 / 0.17 ≈ 1176 VUs
Tool selection matrix:
| Feature |
k6 |
JMeter |
Gatling |
Locust |
| Ease of use |
High |
Medium |
Medium |
High |
| Protocol support |
HTTP/WebSocket/gRPC |
Any (plugins) |
HTTP/WebSocket/JMS |
HTTP/Custom |
| Distributed |
Cloud/Enterprise |
Built-in (RMI) |
Enterprise |
Built-in |
| Scripting |
JavaScript |
GUI + Groovy |
Scala DSL |
Python |
| Best for |
Modern APIs, DevOps |
Legacy/complex protocols |
JVM apps, high load |
Python devs, simple APIs |
SLI threshold recommendations (from [Google SRE Book](https://sre.google/sre-book/monitoring-distributed-systems/, accessed 2025-10-26)):
- Latency: p50 <100ms, p95 <500ms, p99 <1s (API endpoints)
- Throughput: Based on capacity planning (RPS per instance × instance count)
- Error rate: <0.1% (four nines reliability), <1% (three nines)
- Availability: 99.9% (43.2 min/month downtime), 99.95% (21.6 min/month)
Stop conditions:
- If target service returns 5xx errors during smoke test: abort and fix service
- If SLI requirements are unattainable (require <10ms p95 for external API): renegotiate
- If test script complexity exceeds tool capabilities: recommend tool change
Output Contract
Required fields (all outputs):
interface LoadTestScript {
tool: "k6" | "jmeter" | "gatling" | "locust";
script_content: string; // Executable test script
script_language: string; // "javascript", "xml", "scala", "python"
entry_point: string; // How to execute (e.g., "k6 run script.js")
}
interface TestConfig {
tool: string;
test_type: "load" | "stress" | "spike" | "soak";
virtual_users: number | object; // Number or stages array
duration_minutes: number;
ramp_up_pattern: Array<{
stage: number;
duration_seconds: number;
target_vus: number;
}>;
think_time_config: {
min_seconds: number;
max_seconds: number;
distribution: "uniform" | "normal" | "exponential";
};
distributed_config?: {
enabled: boolean;
load_zones?: string[];
workers?: number;
};
}
interface Assertions {
latency_thresholds: {
p50_ms?: number;
p95_ms: number;
p99_ms?: number;
};
throughput_threshold?: {
min_rps: number;
};
error_rate_threshold: {
max_percent: number;
};
custom_checks?: Array<{
metric: string;
operator: "lt" | "lte" | "gt" | "gte" | "eq";
value: number;
}>;
}
interface ExecutionPlan {
prerequisites: string[]; // Required setup steps
smoke_test_command: string; // Pre-flight validation
full_test_command: string; // Main execution
monitoring_checklist: string[]; // What to observe during test
abort_criteria: string[]; // When to stop test early
success_criteria: string[]; // How to validate results
report_generation?: string; // Post-test analysis steps
}
Format:
test_script: Valid code for specified tool (JavaScript for k6, XML for JMeter, Scala for Gatling, Python for Locust)
test_config: Valid JSON
assertions: Valid JSON with numeric values
execution_plan: Markdown with code blocks for commands
Validation:
- Script is syntactically valid for target tool
- VU counts and durations are positive integers
- Thresholds are achievable (p95 < p99, error_rate <100%)
- Think time min < max
Examples
Example 1: k6 E-Commerce Checkout Load Test (T2)
import http from 'k6/http';
import { check, sleep } from 'k6';
export const options = {
stages: [
{ duration: '3m', target: 1000 },
{ duration: '10m', target: 1000 },
{ duration: '2m', target: 0 },
],
thresholds: {
http_req_duration: ['p(95)<800'],
http_req_failed: ['rate<0.005'],
http_reqs: ['rate>500'],
},
};
export default function () {
const payload = JSON.stringify({
cart_id: '123',
payment: 'card'
});
const res = http.post(
'https://api.example.com/checkout',
payload,
{ headers: { 'Content-Type': 'application/json' } }
);
check(res, {
'status 200': (r) => r.status === 200,
'checkout success': (r) => r.json('success')
});
sleep(Math.random() * 3 + 2);
}
Quality Gates
Token budgets (mandatory):
- T1 ≤ 2k tokens (basic script + simple assertions)
- T2 ≤ 6k tokens (realistic scenarios + think time modeling)
- T3 ≤ 12k tokens (distributed load + monitoring integration)
Safety checks:
Auditability:
Determinism:
Validation checklist:
Resources
Primary sources (accessed 2025-10-26):
k6 Documentation: https://k6.io/docs/
Official k6 load testing tool documentation with test lifecycle, scripting, and thresholds.
k6 Using Guide: https://grafana.com/docs/k6/latest/using-k6/
Comprehensive guide on test types, scenarios, executors, and distributed testing with k6.
Gatling Documentation: https://gatling.io/docs/
Gatling load testing framework docs covering Scala DSL, simulation design, and reports.
JMeter User Manual: https://jmeter.apache.org/usermanual/
Apache JMeter user manual with test plan creation, distributed testing, and protocols.
Locust Documentation: https://docs.locust.io/
Locust Python-based load testing framework docs with distributed mode and custom tasks.
Google SRE Book - Monitoring Distributed Systems: https://sre.google/sre-book/monitoring-distributed-systems/
Google SRE principles for SLI/SLO definition, load testing strategies, and performance validation.
Additional templates:
- See
examples/load-test-example.js for complete k6 workflow example
- See
resources/jmeter-template.jmx for JMeter test plan template
- See
resources/gatling-template.scala for Gatling simulation template
Related skills:
observability-slo-calculator (for defining SLI/SLO before load testing)
testing-chaos-designer (for resilience testing under load)
observability-stack-configurator (for monitoring during load tests)
End of SKILL.md
1---2name: load-testing-scenario-designer3description: Design load testing scenarios using k6, JMeter, Gatling, or Locust with ramp-up patterns, think time modeling, and performance SLI validation.4license: MIT5---67## Purpose & When-To-Use89**Trigger conditions:**1011- Validating application performance before production deployment12- Establishing performance baselines and capacity planning13- Testing system behavior under peak load, stress, or spike conditions14- Validating SLI/SLO compliance for latency, throughput, and error rates15- Simulating realistic user behavior with ramp-up and think time16- Testing distributed system resilience under sustained load (soak testing)1718**Use this skill when** you need to design realistic, repeatable load testing scenarios with clear performance thresholds, appropriate ramp-up patterns, and tool-specific implementations for k6, JMeter, Gatling, or Locust.1920---2122## Pre-Checks2324**Before execution, verify:**25261. **Time normalization**: `NOW_ET = 2025-10-26T02:31:21-04:00` (NIST/time.gov semantics, America/New_York)272. **Input schema validation**:28 - `target_service` is a valid URL with protocol (http/https)29 - `test_type` is one of: load, stress, spike, soak30 - `sli_requirements` contains numeric values for at least one metric31 - `tool` (if provided) is one of: k6, jmeter, gatling, locust32 - `scenario_details` (if provided) has valid numeric ranges333. **Source freshness**: All cited sources accessed on `NOW_ET`; verify links resolve344. **Tool compatibility**: Confirm target service is accessible and testable3536**Abort conditions:**3738- Target service URL is unreachable or requires complex authentication not specified39- SLI requirements are contradictory (e.g., "10ms p95 latency" for external API)40- Test type and scenario details conflict (e.g., "spike test" with gradual ramp-up)41- Tool selection is incompatible with test requirements (e.g., complex distributed scenarios in basic Locust setup)4243---4445## Procedure4647### T1: Fast Path (≤2k tokens)4849**Goal**: Generate basic load test script with simple ramp-up and assertions.50511. **Parse inputs and apply defaults**:52 - Determine tool (default: k6)53 - Extract test type and map to pattern:54 - **load**: Gradual ramp-up to target VUs, sustain, ramp-down55 - **stress**: Gradual ramp-up beyond capacity to find breaking point56 - **spike**: Rapid jump to high VUs, sustain briefly, drop57 - **soak**: Low/moderate VUs sustained for extended duration58 - Parse SLI requirements (p95_latency_ms, throughput_rps, error_rate_percent)59602. **Generate basic test script** (k6 example per [k6 docs](https://k6.io/docs/, accessed 2025-10-26)):61 ```javascript62 import http from 'k6/http';63 import { check, sleep } from 'k6';6465 export const options = {66 stages: [67 { duration: '2m', target: 100 }, // Ramp-up68 { duration: '5m', target: 100 }, // Sustain69 { duration: '2m', target: 0 }, // Ramp-down70 ],71 thresholds: {72 http_req_duration: ['p(95)<500'], // 95% <500ms73 http_req_failed: ['rate<0.01'], // <1% errors74 },75 };7677 export default function () {78 const res = http.get('https://api.example.com/checkout');79 check(res, { 'status 200': (r) => r.status === 200 });80 sleep(1); // Think time81 }82 ```83843. **Output initial configuration**:85 ```json86 {87 "test_config": {88 "tool": "k6",89 "virtual_users": 100,90 "duration_minutes": 9,91 "ramp_up_minutes": 2,92 "think_time_seconds": 193 },94 "assertions": {95 "p95_latency_ms": 500,96 "error_rate_percent": 197 }98 }99 ```100101**Token budget**: ≤2k tokens102103---104105### T2: Extended Analysis (≤6k tokens)106107**Goal**: Generate realistic scenarios with advanced patterns, distributed load, and comprehensive assertions.1081094. **Design realistic ramp-up pattern** based on test type:110 - **Load test** (per [k6 Load Testing](https://grafana.com/docs/k6/latest/using-k6/, accessed 2025-10-26)):111 - Gradual ramp-up: 0 → target VUs over 10-20% of total test time112 - Sustain at target: 60-70% of total test time113 - Gradual ramp-down: 10-20% of total test time114 - **Stress test**:115 - Multi-stage ramp: 0 → 50% → 75% → 100% → 125% → 150% → find breaking point116 - Shorter sustain periods at each stage (2-3 minutes)117 - **Spike test**:118 - Instant jump: 0 → peak VUs in <30 seconds119 - Brief sustain: 1-2 minutes at peak120 - Instant drop: Return to baseline121 - **Soak test**:122 - Moderate VUs (50-70% of capacity)123 - Extended duration (2-24 hours)124 - Monitor for memory leaks, degradation1251265. **Model think time distribution** (per [Google SRE Book - Load Testing](https://sre.google/sre-book/monitoring-distributed-systems/, accessed 2025-10-26)):127 - Use realistic user behavior patterns, not uniform sleep()128 - Apply randomization: `sleep(Math.random() * 3 + 1)` for 1-4s range129 - Consider page type: landing (5-10s), checkout (30-60s), browse (2-5s)130 - Add variance with percentile-based think time (p50: 3s, p90: 10s, p99: 30s)1311326. **Map SLI requirements to tool-specific assertions**:133 - **k6**: Use `thresholds` object with percentile syntax134 - **JMeter**: Configure Assertions (Response Assertion, Duration Assertion)135 - **Gatling**: Use `assertions` DSL with percentile checks136 - **Locust**: Custom stats collection and failure conditions1371387. **Generate tool-specific advanced script**:139 - Add request tagging/grouping for multi-endpoint scenarios140 - Include custom metrics (business transactions, funnel completion)141 - Configure distributed execution parameters if needed142 - Add data parameterization (CSV for users, JSON for payloads)143 - Reference [JMeter User Manual](https://jmeter.apache.org/usermanual/, accessed 2025-10-26) for JMeter-specific patterns144 - Reference [Gatling Documentation](https://gatling.io/docs/, accessed 2025-10-26) for Gatling DSL145 - Reference [Locust Documentation](https://docs.locust.io/, accessed 2025-10-26) for Locust class-based tests146147**Token budget**: ≤6k tokens total (including T1)148149---150151### T3: Deep Dive (≤12k tokens)152153**Goal**: Advanced patterns including distributed load, custom protocols, and comprehensive monitoring integration.1541558. **Design distributed load generation**:156 - **k6 Cloud/Enterprise**: Configure multiple load zones (US-East, US-West, EU-West)157 - **JMeter Distributed**: Master-slave configuration with RMI158 - **Gatling Enterprise**: Inject distribution across multiple nodes159 - **Locust Distributed**: Master-worker architecture with load distribution1601619. **Add advanced test patterns**:162 - **Breakpoint testing**: Incrementally increase load until system breaks163 - **Capacity testing**: Find maximum sustainable throughput164 - **Endurance patterns**: Multi-day soak with scheduled load variations165 - **Recovery testing**: Inject load spikes, measure recovery time16616710. **Integrate with observability stack** (per [Google SRE - Monitoring](https://sre.google/sre-book/monitoring-distributed-systems/, accessed 2025-10-26)):168 - Configure Prometheus remote-write for k6 metrics169 - Set up Grafana dashboards for real-time visualization170 - Add CloudWatch/Datadog integration for cloud metrics correlation171 - Configure distributed tracing correlation (OpenTelemetry)17217311. **Generate comprehensive execution plan**:174 - Pre-test validation: Smoke test, baseline collection175 - Test execution: Monitoring checklist, abort criteria176 - Post-test analysis: Report generation, SLI compliance validation177 - Iterative tuning: Adjust VUs/duration based on results178179**Token budget**: ≤12k tokens total (including T1 + T2)180181---182183## Decision Rules184185**Test type selection guidance:**186187- **Load test**: Normal expected traffic + 20-50% headroom188- **Stress test**: 2-3x expected peak load to find breaking point189- **Spike test**: 5-10x sudden traffic surge (flash sale, DDoS simulation)190- **Soak test**: 50-70% capacity sustained 2-24 hours (memory leak detection)191192**VU calculation** (requests per second → virtual users):193194```195VUs = (target_RPS × response_time_seconds) / (1 - think_time_ratio)196197Example:198- Target: 1000 RPS199- Response time: 200ms (0.2s)200- Think time: 1s per request201- VUs = (1000 × 0.2) / (1 - 0.83) = 200 / 0.17 ≈ 1176 VUs202```203204**Tool selection matrix:**205206| Feature | k6 | JMeter | Gatling | Locust |207|---------|-----|---------|---------|--------|208| Ease of use | High | Medium | Medium | High |209| Protocol support | HTTP/WebSocket/gRPC | Any (plugins) | HTTP/WebSocket/JMS | HTTP/Custom |210| Distributed | Cloud/Enterprise | Built-in (RMI) | Enterprise | Built-in |211| Scripting | JavaScript | GUI + Groovy | Scala DSL | Python |212| Best for | Modern APIs, DevOps | Legacy/complex protocols | JVM apps, high load | Python devs, simple APIs |213214**SLI threshold recommendations** (from [Google SRE Book](https://sre.google/sre-book/monitoring-distributed-systems/, accessed 2025-10-26)):215216- **Latency**: p50 <100ms, p95 <500ms, p99 <1s (API endpoints)217- **Throughput**: Based on capacity planning (RPS per instance × instance count)218- **Error rate**: <0.1% (four nines reliability), <1% (three nines)219- **Availability**: 99.9% (43.2 min/month downtime), 99.95% (21.6 min/month)220221**Stop conditions:**222223- If target service returns 5xx errors during smoke test: abort and fix service224- If SLI requirements are unattainable (require <10ms p95 for external API): renegotiate225- If test script complexity exceeds tool capabilities: recommend tool change226227---228229## Output Contract230231**Required fields** (all outputs):232233```typescript234interface LoadTestScript {235 tool: "k6" | "jmeter" | "gatling" | "locust";236 script_content: string; // Executable test script237 script_language: string; // "javascript", "xml", "scala", "python"238 entry_point: string; // How to execute (e.g., "k6 run script.js")239}240241interface TestConfig {242 tool: string;243 test_type: "load" | "stress" | "spike" | "soak";244 virtual_users: number | object; // Number or stages array245 duration_minutes: number;246 ramp_up_pattern: Array<{247 stage: number;248 duration_seconds: number;249 target_vus: number;250 }>;251 think_time_config: {252 min_seconds: number;253 max_seconds: number;254 distribution: "uniform" | "normal" | "exponential";255 };256 distributed_config?: {257 enabled: boolean;258 load_zones?: string[];259 workers?: number;260 };261}262263interface Assertions {264 latency_thresholds: {265 p50_ms?: number;266 p95_ms: number;267 p99_ms?: number;268 };269 throughput_threshold?: {270 min_rps: number;271 };272 error_rate_threshold: {273 max_percent: number;274 };275 custom_checks?: Array<{276 metric: string;277 operator: "lt" | "lte" | "gt" | "gte" | "eq";278 value: number;279 }>;280}281282interface ExecutionPlan {283 prerequisites: string[]; // Required setup steps284 smoke_test_command: string; // Pre-flight validation285 full_test_command: string; // Main execution286 monitoring_checklist: string[]; // What to observe during test287 abort_criteria: string[]; // When to stop test early288 success_criteria: string[]; // How to validate results289 report_generation?: string; // Post-test analysis steps290}291```292293**Format**:294295- `test_script`: Valid code for specified tool (JavaScript for k6, XML for JMeter, Scala for Gatling, Python for Locust)296- `test_config`: Valid JSON297- `assertions`: Valid JSON with numeric values298- `execution_plan`: Markdown with code blocks for commands299300**Validation**:301302- Script is syntactically valid for target tool303- VU counts and durations are positive integers304- Thresholds are achievable (p95 < p99, error_rate <100%)305- Think time min < max306307---308309## Examples310311### Example 1: k6 E-Commerce Checkout Load Test (T2)312313```javascript314import http from 'k6/http';315import { check, sleep } from 'k6';316export const options = {317 stages: [318 { duration: '3m', target: 1000 },319 { duration: '10m', target: 1000 },320 { duration: '2m', target: 0 },321 ],322 thresholds: {323 http_req_duration: ['p(95)<800'],324 http_req_failed: ['rate<0.005'],325 http_reqs: ['rate>500'],326 },327};328export default function () {329 const payload = JSON.stringify({330 cart_id: '123',331 payment: 'card'332 });333 const res = http.post(334 'https://api.example.com/checkout',335 payload,336 { headers: { 'Content-Type': 'application/json' } }337 );338 check(res, {339 'status 200': (r) => r.status === 200,340 'checkout success': (r) => r.json('success')341 });342 sleep(Math.random() * 3 + 2);343}344```345346---347348## Quality Gates349350**Token budgets** (mandatory):351352- T1 ≤ 2k tokens (basic script + simple assertions)353- T2 ≤ 6k tokens (realistic scenarios + think time modeling)354- T3 ≤ 12k tokens (distributed load + monitoring integration)355356**Safety checks**:357358- [ ] No hardcoded credentials or API keys in test scripts359- [ ] No production data in test payloads (use synthetic/anonymized data)360- [ ] Load test targets are non-production environments (unless explicitly approved)361- [ ] Distributed tests include rate limiting to prevent accidental DDoS362363**Auditability**:364365- [ ] All sources cited with access date = `NOW_ET`366- [ ] VU calculations include methodology and assumptions367- [ ] SLI thresholds tied to business requirements or SRE standards368- [ ] Test results are reproducible with same script + config369370**Determinism**:371372- [ ] Same inputs produce same script structure (±10% VU variance acceptable)373- [ ] Ramp-up patterns follow documented heuristics374- [ ] Think time distributions use seeded randomness where possible375376**Validation checklist**:377378- [ ] Script executes without syntax errors379- [ ] Assertions align with SLI requirements380- [ ] VU count and duration are realistic for target infrastructure381- [ ] Think time modeling prevents unrealistic "robot" traffic382383---384385## Resources386387**Primary sources** (accessed 2025-10-26):3883891. **k6 Documentation**: https://k6.io/docs/390 Official k6 load testing tool documentation with test lifecycle, scripting, and thresholds.3913922. **k6 Using Guide**: https://grafana.com/docs/k6/latest/using-k6/393 Comprehensive guide on test types, scenarios, executors, and distributed testing with k6.3943953. **Gatling Documentation**: https://gatling.io/docs/396 Gatling load testing framework docs covering Scala DSL, simulation design, and reports.3973984. **JMeter User Manual**: https://jmeter.apache.org/usermanual/399 Apache JMeter user manual with test plan creation, distributed testing, and protocols.4004015. **Locust Documentation**: https://docs.locust.io/402 Locust Python-based load testing framework docs with distributed mode and custom tasks.4034046. **Google SRE Book - Monitoring Distributed Systems**: https://sre.google/sre-book/monitoring-distributed-systems/405 Google SRE principles for SLI/SLO definition, load testing strategies, and performance validation.406407**Additional templates**:408409- See `examples/load-test-example.js` for complete k6 workflow example410- See `resources/jmeter-template.jmx` for JMeter test plan template411- See `resources/gatling-template.scala` for Gatling simulation template412413**Related skills**:414415- `observability-slo-calculator` (for defining SLI/SLO before load testing)416- `testing-chaos-designer` (for resilience testing under load)417- `observability-stack-configurator` (for monitoring during load tests)418419---420421**End of SKILL.md**