# Runtime Health Performance Profile

Generated: 2026-05-19T16:27:14.214Z
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 (348.6 ms median, 21545 gzip bytes median).
- Slowest measured projection phases: governance validator 4358 ms; scheduler snapshot 2460.2 ms; dispatcher summary 1077.7 ms; runtime services 916.2 ms; leases 820.1 ms; wait graph 617.1 ms; operations 604 ms; lock graph 587.2 ms.

## Measurements

| Surface | Samples | Min | Median | Max | JSON bytes | Gzip bytes |
| --- | ---: | ---: | ---: | ---: | ---: | ---: |
| Runtime CLI health-snapshot | 1 | 348.6 ms | 348.6 ms | 348.6 ms | 83800 | 21545 |
| Backend /health | 1 | 16.9 ms | 16.9 ms | 16.9 ms | 15 | 35 |

## Projection Phase Timing

| Phase | OK | Elapsed | Error |
| --- | ---: | ---: | --- |
| governance validator | yes | 4358 ms |  |
| audit snapshot | yes | 33.9 ms |  |
| pending work | yes | 5.6 ms |  |
| leases | yes | 820.1 ms |  |
| lock graph | yes | 587.2 ms |  |
| operations | yes | 604 ms |  |
| scheduler snapshot | yes | 2460.2 ms |  |
| wait graph | yes | 617.1 ms |  |
| consultant checkpoints | yes | 0.6 ms |  |
| dispatcher summary | yes | 1077.7 ms |  |
| dispatcher status | yes | 352 ms |  |
| runtime services | yes | 916.2 ms |  |
| reconciliation | yes | 41.8 ms |  |
| debt summary | yes | 1.3 ms |  |
| timeline summary | yes | 2.4 ms |  |
| timeline bounded | yes | 1.7 ms |  |
| active generation | yes | 0.1 ms |  |
| build info | yes | 52.5 ms |  |
| build state | yes | 56.1 ms |  |
| work session | yes | 0.8 ms |  |
| journal status | yes | 6 ms |  |
| summary validation active chunk | yes | 0.4 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": 348.6,
    "json_bytes": 83800,
    "gzip_bytes": 21545,
    "status": 0
  },
  {
    "label": "Backend /health",
    "ok": true,
    "elapsed_ms": 16.9,
    "json_bytes": 15,
    "gzip_bytes": 35,
    "status": 200
  }
]
```
