# Runtime Health Performance Profile

Generated: 2026-05-17T18:16:11.286Z
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 (7305.1 ms median, 13600 gzip bytes median).
- Slowest measured projection phases: scheduler snapshot 1106.1 ms; dispatcher summary 666.6 ms; runtime services 631.5 ms; leases 382.4 ms; lock graph 333 ms; dispatcher status 300.3 ms; operations 288.2 ms; wait graph 276.4 ms.

## Measurements

| Surface | Samples | Min | Median | Max | JSON bytes | Gzip bytes |
| --- | ---: | ---: | ---: | ---: | ---: | ---: |
| Runtime CLI health-snapshot | 3 | 6090.2 ms | 7305.1 ms | 8136.5 ms | 60119 | 13600 |
| Backend /health | 3 | 0.8 ms | 1.8 ms | 17.5 ms | 15 | 35 |

## Projection Phase Timing

| Phase | OK | Elapsed | Error |
| --- | ---: | ---: | --- |
| governance validator | yes | 166.4 ms |  |
| audit snapshot | yes | 33.7 ms |  |
| pending work | yes | 4.5 ms |  |
| leases | yes | 382.4 ms |  |
| lock graph | yes | 333 ms |  |
| operations | yes | 288.2 ms |  |
| scheduler snapshot | yes | 1106.1 ms |  |
| wait graph | yes | 276.4 ms |  |
| consultant checkpoints | yes | 0.4 ms |  |
| dispatcher summary | yes | 666.6 ms |  |
| dispatcher status | yes | 300.3 ms |  |
| runtime services | yes | 631.5 ms |  |
| reconciliation | yes | 35.6 ms |  |
| debt summary | yes | 1.6 ms |  |
| timeline summary | yes | 4.5 ms |  |
| timeline bounded | yes | 4.8 ms |  |
| active generation | yes | 0.6 ms |  |
| build info | yes | 50.1 ms |  |
| build state | yes | 58.8 ms |  |
| work session | yes | 1 ms |  |
| journal status | yes | 10.5 ms |  |
| summary validation active chunk | yes | 1 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": 6090.2,
    "json_bytes": 60119,
    "gzip_bytes": 13595,
    "status": 0
  },
  {
    "label": "Runtime CLI health-snapshot",
    "ok": true,
    "elapsed_ms": 7305.1,
    "json_bytes": 60119,
    "gzip_bytes": 13600,
    "status": 0
  },
  {
    "label": "Runtime CLI health-snapshot",
    "ok": true,
    "elapsed_ms": 8136.5,
    "json_bytes": 60121,
    "gzip_bytes": 13603,
    "status": 0
  },
  {
    "label": "Backend /health",
    "ok": true,
    "elapsed_ms": 17.5,
    "json_bytes": 15,
    "gzip_bytes": 35,
    "status": 200
  },
  {
    "label": "Backend /health",
    "ok": true,
    "elapsed_ms": 1.8,
    "json_bytes": 15,
    "gzip_bytes": 35,
    "status": 200
  },
  {
    "label": "Backend /health",
    "ok": true,
    "elapsed_ms": 0.8,
    "json_bytes": 15,
    "gzip_bytes": 35,
    "status": 200
  }
]
```
