# Runtime Health Performance Profile

Generated: 2026-05-17T18:34:58.764Z
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 (517.4 ms median, 13564 gzip bytes median).
- Slowest measured projection phases: scheduler snapshot 1412.1 ms; dispatcher summary 858.9 ms; runtime services 632.8 ms; leases 333.8 ms; wait graph 329.8 ms; lock graph 321.7 ms; dispatcher status 250.3 ms; operations 238.8 ms.

## Measurements

| Surface | Samples | Min | Median | Max | JSON bytes | Gzip bytes |
| --- | ---: | ---: | ---: | ---: | ---: | ---: |
| Runtime CLI health-snapshot | 3 | 332.8 ms | 517.4 ms | 546.9 ms | 60749 | 13564 |
| Backend /health | 3 | 0.9 ms | 1.3 ms | 15.8 ms | 15 | 35 |

## Projection Phase Timing

| Phase | OK | Elapsed | Error |
| --- | ---: | ---: | --- |
| governance validator | yes | 126.1 ms |  |
| audit snapshot | yes | 31.4 ms |  |
| pending work | yes | 4 ms |  |
| leases | yes | 333.8 ms |  |
| lock graph | yes | 321.7 ms |  |
| operations | yes | 238.8 ms |  |
| scheduler snapshot | yes | 1412.1 ms |  |
| wait graph | yes | 329.8 ms |  |
| consultant checkpoints | yes | 0.3 ms |  |
| dispatcher summary | yes | 858.9 ms |  |
| dispatcher status | yes | 250.3 ms |  |
| runtime services | yes | 632.8 ms |  |
| reconciliation | yes | 24.7 ms |  |
| debt summary | yes | 1.1 ms |  |
| timeline summary | yes | 2.3 ms |  |
| timeline bounded | yes | 1.6 ms |  |
| active generation | yes | 0.2 ms |  |
| build info | yes | 67.9 ms |  |
| build state | yes | 58.7 ms |  |
| work session | yes | 0.6 ms |  |
| journal status | yes | 3.7 ms |  |
| summary validation active chunk | yes | 0.2 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": 517.4,
    "json_bytes": 60749,
    "gzip_bytes": 13563,
    "status": 0
  },
  {
    "label": "Runtime CLI health-snapshot",
    "ok": true,
    "elapsed_ms": 546.9,
    "json_bytes": 60749,
    "gzip_bytes": 13564,
    "status": 0
  },
  {
    "label": "Runtime CLI health-snapshot",
    "ok": true,
    "elapsed_ms": 332.8,
    "json_bytes": 60749,
    "gzip_bytes": 13564,
    "status": 0
  },
  {
    "label": "Backend /health",
    "ok": true,
    "elapsed_ms": 15.8,
    "json_bytes": 15,
    "gzip_bytes": 35,
    "status": 200
  },
  {
    "label": "Backend /health",
    "ok": true,
    "elapsed_ms": 1.3,
    "json_bytes": 15,
    "gzip_bytes": 35,
    "status": 200
  },
  {
    "label": "Backend /health",
    "ok": true,
    "elapsed_ms": 0.9,
    "json_bytes": 15,
    "gzip_bytes": 35,
    "status": 200
  }
]
```
