# Load Test Plan

## Scenario: {scenario_name}

### Description
{What user behavior or system load this scenario simulates.}

### Configuration

| Parameter | Value |
|-----------|-------|
| Virtual Users (VUs) | {number, e.g., 100} |
| Ramp-up Period | {duration, e.g., 2 minutes} |
| Sustained Duration | {duration, e.g., 10 minutes} |
| Ramp-down Period | {duration, e.g., 1 minute} |
| Total Duration | {total, e.g., 13 minutes} |

### Load Profile
```
VUs
 ^
 |        _______________
 |       /               \
 |      /                 \
 |     /                   \
 |    /                     \
 |___/                       \___
 +------------------------------> Time
  0   2min   12min   13min
      ramp   sustain  down
```

### Endpoints Under Test

| Endpoint | Method | Weight | Payload |
|----------|--------|--------|---------|
| {/path} | GET | {e.g., 60%} | — |
| {/path} | POST | {e.g., 25%} | {description of payload} |
| {/path} | GET | {e.g., 15%} | — |

### Thresholds (Pass/Fail Criteria)

| Metric | Target | Fail If |
|--------|--------|---------|
| Throughput | {e.g., >= 500 req/s} | {< 400 req/s} |
| Latency p50 | {e.g., < 100ms} | {>= 200ms} |
| Latency p95 | {e.g., < 500ms} | {>= 1000ms} |
| Latency p99 | {e.g., < 1000ms} | {>= 3000ms} |
| Error Rate | {e.g., < 0.1%} | {>= 1%} |
| CPU Usage | {e.g., < 70%} | {>= 90%} |
| Memory Usage | {e.g., < 80%} | {>= 95%} |

### Think Time
- Between requests: {e.g., 1-3 seconds, randomized}
- Simulates: {realistic user behavior / worst case / sustained pressure}

---

## Scenario: {stress_test_scenario_name}

### Description
{Push beyond normal capacity to find breaking points.}

### Configuration

| Parameter | Value |
|-----------|-------|
| Virtual Users (VUs) | {higher number, e.g., 500} |
| Ramp-up Period | {duration} |
| Sustained Duration | {duration} |

### Thresholds

| Metric | Target | Notes |
|--------|--------|-------|
| Breaking point | {identify VU count where errors exceed 5%} | Document the limit |
| Recovery time | {after load drops, how fast does the system recover?} | Should be < {time} |
| Graceful degradation | {system returns errors, does not crash} | No 5xx cascades |

---

## Scenario Summary

| Scenario | VUs | Duration | Purpose |
|----------|-----|----------|---------|
| {normal load} | {N} | {duration} | Verify baseline performance |
| {peak load} | {N} | {duration} | Verify peak handling |
| {stress test} | {N} | {duration} | Find breaking points |
| {soak test} | {N} | {long duration} | Check for memory leaks, connection exhaustion |

## Run Instructions

```bash
# Run with k6
k6 run --vus {N} --duration {time} {script.js}

# Run with specific scenario
k6 run --env SCENARIO={name} {script.js}
```

## Results Template

After running, fill in:

| Metric | Target | Actual | Status |
|--------|--------|--------|--------|
| Throughput | {target} | {actual} | PASS / FAIL |
| p50 Latency | {target} | {actual} | PASS / FAIL |
| p95 Latency | {target} | {actual} | PASS / FAIL |
| p99 Latency | {target} | {actual} | PASS / FAIL |
| Error Rate | {target} | {actual} | PASS / FAIL |
