# Runtime Health Performance Profile

Generated: 2026-05-21T13:57:34.596Z
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 (595.5 ms median, 24401 gzip bytes median).
- Slowest measured projection phases: governance validator 5058.4 ms; scheduler snapshot 2079.6 ms; runtime services 835.2 ms; leases 828.1 ms; wait graph 778.5 ms; dispatcher summary 771.2 ms; lock graph 549.7 ms; operations 372.4 ms.

## Measurements

| Surface | Samples | Min | Median | Max | JSON bytes | Gzip bytes |
| --- | ---: | ---: | ---: | ---: | ---: | ---: |
| Runtime CLI health-snapshot | 5 | 517.3 ms | 595.5 ms | 12533.6 ms | 113117 | 24401 |
| Backend /health | 5 | 0.9 ms | 1.1 ms | 138.4 ms | 15 | 35 |

## Projection Phase Timing

| Phase | OK | Elapsed | Error |
| --- | ---: | ---: | --- |
| governance validator | yes | 5058.4 ms |  |
| audit snapshot | yes | 24.6 ms |  |
| pending work | yes | 3.7 ms |  |
| leases | yes | 828.1 ms |  |
| lock graph | yes | 549.7 ms |  |
| operations | yes | 372.4 ms |  |
| scheduler snapshot | yes | 2079.6 ms |  |
| wait graph | yes | 778.5 ms |  |
| consultant checkpoints | yes | 0.9 ms |  |
| dispatcher summary | yes | 771.2 ms |  |
| dispatcher status | yes | 267.8 ms |  |
| runtime services | yes | 835.2 ms |  |
| reconciliation | yes | 54.7 ms |  |
| debt summary | yes | 3.7 ms |  |
| timeline summary | yes | 2.9 ms |  |
| timeline bounded | yes | 3.2 ms |  |
| active generation | yes | 0.1 ms |  |
| build info | yes | 92.2 ms |  |
| build state | yes | 96.3 ms |  |
| work session | yes | 0.8 ms |  |
| journal status | yes | 11.8 ms |  |
| summary validation active chunk | yes | 0.5 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": 12533.6,
    "json_bytes": 113117,
    "gzip_bytes": 24401,
    "status": 0
  },
  {
    "label": "Runtime CLI health-snapshot",
    "ok": true,
    "elapsed_ms": 595.5,
    "json_bytes": 113117,
    "gzip_bytes": 24401,
    "status": 0
  },
  {
    "label": "Runtime CLI health-snapshot",
    "ok": true,
    "elapsed_ms": 680.2,
    "json_bytes": 113117,
    "gzip_bytes": 24403,
    "status": 0
  },
  {
    "label": "Runtime CLI health-snapshot",
    "ok": true,
    "elapsed_ms": 587.7,
    "json_bytes": 113117,
    "gzip_bytes": 24402,
    "status": 0
  },
  {
    "label": "Runtime CLI health-snapshot",
    "ok": true,
    "elapsed_ms": 517.3,
    "json_bytes": 113117,
    "gzip_bytes": 24401,
    "status": 0
  },
  {
    "label": "Backend /health",
    "ok": true,
    "elapsed_ms": 138.4,
    "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": 1.1,
    "json_bytes": 15,
    "gzip_bytes": 35,
    "status": 200
  },
  {
    "label": "Backend /health",
    "ok": true,
    "elapsed_ms": 1,
    "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
  }
]
```
