# Runtime Health Performance Profile

Generated: 2026-05-19T16:41:39.089Z
Source: `node ai/runtime/dist/cli.js performance runtime-health-profile --json`

## Summary

- Runtime Health performance is measured before optimization.
- Admin Runtime Health source does not reference Prisma/DB access, so a GraphQL DB N+1 is not indicated by this path.
- Socket.IO remains invalidation-only; performance work must not move dashboard truth into socket payloads.
- Measured bottleneck category: Runtime Health snapshot generation/projection (668.3 ms median, 21510 gzip bytes median).
- Slowest measured projection phases: governance validator 4903.4 ms; scheduler snapshot 1321.8 ms; runtime services 925.7 ms; dispatcher summary 671.5 ms; wait graph 475.5 ms; dispatcher status 364 ms; operations 290 ms; leases 268.3 ms.

## Measurements

| Surface | Samples | Min | Median | Max | JSON bytes | Gzip bytes |
| --- | ---: | ---: | ---: | ---: | ---: | ---: |
| Runtime CLI health-snapshot | 1 | 668.3 ms | 668.3 ms | 668.3 ms | 83592 | 21510 |
| Backend /health | 1 | 233.2 ms | 233.2 ms | 233.2 ms | 15 | 35 |

## Projection Phase Timing

| Phase | OK | Elapsed | Error |
| --- | ---: | ---: | --- |
| governance validator | yes | 4903.4 ms |  |
| audit snapshot | yes | 18.4 ms |  |
| pending work | yes | 3.4 ms |  |
| leases | yes | 268.3 ms |  |
| lock graph | yes | 255.8 ms |  |
| operations | yes | 290 ms |  |
| scheduler snapshot | yes | 1321.8 ms |  |
| wait graph | yes | 475.5 ms |  |
| consultant checkpoints | yes | 0.4 ms |  |
| dispatcher summary | yes | 671.5 ms |  |
| dispatcher status | yes | 364 ms |  |
| runtime services | yes | 925.7 ms |  |
| reconciliation | yes | 49.3 ms |  |
| debt summary | yes | 2.2 ms |  |
| timeline summary | yes | 4.1 ms |  |
| timeline bounded | yes | 3 ms |  |
| active generation | yes | 0.2 ms |  |
| build info | yes | 78.4 ms |  |
| build state | yes | 76.6 ms |  |
| work session | yes | 1.8 ms |  |
| journal status | yes | 11.1 ms |  |
| summary validation active chunk | yes | 0.3 ms |  |

## DataLoader Decision

Do not add DataLoader: The measured Runtime Health path is dominated by Runtime snapshot generation and backend proxying, not repeated GraphQL database resolver access.

DataLoader/request batching remains deferred because this path is not a repeated nested GraphQL DB resolver path. The next optimization target should be Runtime snapshot generation, snapshot splitting, or sparse Runtime Health queries if operator-visible latency remains too high.

## GraphQL N+1

Admin Runtime Health resolver delegates to service methods and the measured service path does not use Prisma/DB queries.

## Raw Samples

```json
[
  {
    "label": "Runtime CLI health-snapshot",
    "ok": true,
    "elapsed_ms": 668.3,
    "json_bytes": 83592,
    "gzip_bytes": 21510,
    "status": 0
  },
  {
    "label": "Backend /health",
    "ok": true,
    "elapsed_ms": 233.2,
    "json_bytes": 15,
    "gzip_bytes": 35,
    "status": 200
  }
]
```
