# Performance scripts (PRD §17.2)

Requires [k6](https://grafana.com/docs/k6/latest/set-up/install-k6/).

## Environment variables

| Variable | Required | Description |
| :--- | :--- | :--- |
| `BASE_URL` | yes | API origin, e.g. `http://127.0.0.1:8000` |
| `PLAYER_ID` | bet-qps, seal | `players.id` for `Bearer dev:{id}` |
| `DRAW_NO` | yes | Open draw `draw_no` (`YYYYMMDD-NNN`) |
| `PLAYER_IDS` | oversell | Comma-separated player ids |
| `HOT_NUMBER` | oversell | Shared number, default `8888` |
| `LINE_AMOUNT` | oversell | Per-request line amount, default `100` |

Staging must use `LOTTERY_RISK_POOL_USE_REDIS_LUA=true` and sufficient wallet balance.

## Commands

```bash
k6 run bet-qps.js
k6 run oversell-race.js
k6 run seal-after-close.js
```

Thresholds are defined in each script (`thresholds` block). Non-zero exit means failed acceptance.
