#14897·dynamo

DEP: Standard engine gRPC health for Dynamo sidecars

Author: tmonty12Created Sep 15, 2026Updated Oct 1, 2026
Labelsenhancementlanguage::rustdynamo-runtimebackend::vllmdeployment::k8sbackend::sglangbackend::trtllmdep:draft

Summary

Require inference engines used with Dynamo sidecars to expose the standard grpc.health.v1.Health service and an RPC returning an engine lifetime ID. The sidecar uses Watch to manage worker registration and the engine ID to distinguish engine replacement from a transient connection loss. Kubernetes calls Check for engine readiness. Both health methods report the same engine state; cache resets within an engine lifetime remain handled by the indexer's existing AllBlocksCleared processing.

DEP #14657 covers container layout and operator changes. This proposal defines the health and engine identity contracts, which also apply outside Kubernetes.

Motivation

The engine and sidecar can restart independently. Health determines when to register or withdraw a worker. Engine identity determines whether retained KV index state belongs to the current engine. Separating these signals lets pause/resume preserve cache state and lets the sidecar detect an engine replacement even when it never observes NOT_SERVING.

Proposal

Engine health contract

Expose both standard RPCs on the engine's gRPC endpoint:

RPC Caller Behavior
Health.Check Kubernetes kubelet Returns the current status. Only SERVING passes the probe.
Health.Watch Dynamo sidecar Immediately sends the current status, then streams changes.

Use the same configured service name for both calls. The examples use inference; the engine must explicitly expose that name. It identifies inference readiness, including the model and engine ranks needed to serve that endpoint.

Engine condition Required status
Loading weights, initializing workers, or warming up NOT_SERVING if the health listener is available; the listener may still be unbound.
Ready to accept and process new inference requests SERVING
Paused, sleeping, or updating a model in a way that prevents serving NOT_SERVING
A required engine rank or executor is unhealthy NOT_SERVING
Shutdown has started NOT_SERVING while the health listener remains available.
Recovery or resume has completed SERVING
  • The first health response may be SERVING; consumers must not require an earlier NOT_SERVING. Normal request queuing and rejection of invalid requests do not make the engine unavailable.
  • Once bound, the health listener must remain responsive through initialization and recovery. On orderly shutdown, set NOT_SERVING before closing the listener; it need not remain open until process exit. Consumers must handle connection loss even without observing a final status.

Engine identity contract

  • Expose an RPC returning an engine ID that is stable and unique for the engine’s lifetime. An engine restart must return a different ID.
  • Health transitions do not imply a cache reset. Cache resets within an engine lifetime emit AllBlocksCleared, handled by the indexer’s existing ordered event processing.

Sidecar behavior

The sidecar connects to Health.Watch and uses engine status to manage registration with the Dynamo runtime. It compares engine IDs to decide whether retained KV state can belong to the current engine.

Observation Action
First connection Read the engine ID, establish KV sources, and recover the local KV index or start empty. Register the model and endpoint only after SERVING and KV preparation complete.*
NOT_SERVING Deregister the model and endpoint from the Dynamo runtime. Preserve the index and continue KV event ingestion while available.
SERVING Register the model and endpoint after confirming the current engine identity and completing any required KV recovery.
Unknown status, Watch error, or connection loss Deregister the model and endpoint from the Dynamo runtime if registered, retain the index provisionally, and reconnect with bounded backoff; exit when retries are exhausted.
Reconnect with a different engine ID Discard the previous engine's index, replay cursors, and source connections. Initialize the new engine's KV sources before registration.
Reconnect with the same engine ID Preserve the index if event continuity is intact, or restore continuity through replay. If continuity cannot be established, log a warning and continue.*

[!WARNING] * On a sidecar or engine restart, KV events emitted before the sidecar reconnects may already have been evicted from the engine's replay buffer. Recovery may therefore miss events and leave the local KV index incomplete or stale.

  • Make actions idempotent, and prevent recovery or queued events from a previous engine ID from affecting its replacement. On sidecar shutdown, deregister and exit without imposing an engine drain or grace period.
  • Startup and reconnect budgets must accommodate model loading and engine restart delays. Use bounded transport checks to detect broken connections; a healthy Watch may remain silent.
mermaid
sequenceDiagram
    participant K as Kubelet
    participant D as Dynamo sidecar
    participant E as Engine
    K->>D: Start native sidecar
    D->>D: Initialize runtime dependencies, then bind HTTP
    K->>D: GET /live (startup probe)
    D-->>K: Pass before engine starts
    K->>E: Start engine
    Note over E: Initialize and load model, listener may be absent
    Note over D,E: Sidecar retries within startup budget and remains deregistered
    K->>D: GET /health (readiness probe)
    D-->>K: Ready when its own runtime is operational
    E->>E: Bind health listener when available
    D->>E: Health.Watch(inference)
    E-->>D: SERVING when ready, may be the initial status
    D->>E: Read engine ID
    E-->>D: Engine ID A
    D->>D: Prepare KV sources and index for A, then register
    K->>E: Health.Check(inference)
    E-->>K: SERVING
    Note over K: Pod readiness requires both probes to pass
    E-->>D: NOT_SERVING during pause
    D->>D: Deregister, preserve index and ingest available events
    E-->>D: SERVING after resume
    D->>D: Register after identity and KV preparation checks
    E--xD: Watch connection lost
    D->>D: Deregister, retain index provisionally
    Note over E: Engine may restart and load before rebinding
    Note over D,E: Reconnect budget accommodates engine restart delays
    D->>E: Reconnect Watch and read engine ID
    E-->>D: Current health and engine ID
    alt Engine ID changed
        D->>D: Discard old index, cursors, and connections
        D->>D: Initialize new engine KV sources and index
    else Engine ID unchanged
        D->>D: Retain index, replay missing events when available
        Note over D: Incomplete continuity logs a warning and continues
    end
    D->>D: Register only if current engine is SERVING and preparation is complete
    Note over D: Healthy sidecar probes remain independent of engine state
    Note over E: Orderly shutdown sets NOT_SERVING. Listener may close before process exit

Sidecar readiness

HTTP path Kubernetes probe Semantics
/live Startup and liveness Static 200 while the HTTP listener is serving, including after loss of runtime connectivity and during orderly shutdown. Independent of engine state.
/health Readiness 200 when required Dynamo runtime dependencies are operational and sidecar shutdown has not started; otherwise 503 while the HTTP listener is serving. Independent of engine state and model registration.

Runtime dependencies include configured discovery and transport connections. Initialize these connections, then bind the HTTP listener before waiting for engine metadata or health. Until the listener binds, neither endpoint is available and the sidecar startup probe does not pass. Once bound, loss of required connectivity affects /health but not /live. Neither endpoint requires engine SERVING or model registration.

Kubernetes probes

The operator defaults the sidecar probes to /live and /health as defined in Sidecar readiness. Engine startup and readiness probes are set by the user and should call the unary gRPC Health.Check. The following Pod-spec fragment is an example, with images and launch arguments omitted; choose ports, service names, and probe timings for the deployment.

yaml
spec:
  initContainers:
    - name: dynamo
      restartPolicy: Always # probes are defaulted
  containers:
    - name: main
      startupProbe:
        grpc:
          port: 50051
          service: inference
        periodSeconds: 10
        failureThreshold: 120 # Example: allow 20 minutes for model loading.
      readinessProbe:
        grpc:
          port: 50051
          service: inference
        periodSeconds: 10
        failureThreshold: 3
  • Bind health listeners to the Pod IP, not only loopback.
  • Allow the sidecar startup probe budget to cover initial runtime dependency connections and HTTP listener startup.
  • Allow engine startup probes to cover delayed binding, model loading, and warmup. Configure sidecar startup/reconnect retry budgets separately.
  • Failed readiness probes keep the Pod unready without restarting containers. Discovery updates are asynchronous, so requests may remain in flight after health changes.

Engine and Sidecar Gaps

vLLM

  • Report NOT_SERVING during pause/sleep and SERVING after resume completes.

SGLang — native Rust gRPC

  • Expose standard Health.Check and continuous Health.Watch.
  • Make both report NOT_SERVING whenever pause, released memory, a model update, or an unhealthy required executor prevents inference; report SERVING once inference is available again.

TensorRT-LLM — OpenEngine

  • Expose standard Health.Check and continuous Health.Watch.
  • Report NOT_SERVING during sleep and SERVING after recovery completes.
  • Set NOT_SERVING when orderly shutdown begins.

Dynamo sidecars

  • Initialize runtime dependencies and start HTTP before waiting for the engine; keep /live at 200 while HTTP is serving, independent of subsequent connectivity changes and engine state.
  • Make /health reflect required runtime connectivity and sidecar shutdown, independent of engine state and model registration.
  • Continuously watch engine health and reconcile registration idempotently.
  • Compare engine IDs on connection/reconnection and prevent old state, recovery work, or queued events from affecting a replacement engine.
  • Recover KV state through available replay; warn and continue when continuity cannot be established.
  • Handle connection loss with immediate deregistration, bounded reconnect attempts, and exit on exhaustion.
  • Deregister and exit without imposing an engine drain or grace period.
  • Complete the TensorRT-LLM OpenEngine migration tracked by PR #14349.
  • Add KV-source discovery, ingestion, and recovery for the TensorRT-LLM OpenEngine path.

Standard Tests

Sidecar tests — CPU CI with a fake engine and runtime dependencies

  • Probe startup: Delay initial runtime dependency connections. Assert HTTP remains unbound until runtime initialization completes, then becomes available without an engine.
  • Probe independence: Start the sidecar with operational runtime dependencies and no engine. Assert both /live and /health return 200. Disconnect/reconnect required dependencies and assert /health changes between 503 and 200 while /live remains 200.
  • Sidecar shutdown: Start the sidecar against a fake engine reporting SERVING and wait for registration in discovery. Send SIGTERM to the sidecar; assert readiness fails while HTTP remains available, registrations are removed, and the process exits without requesting an engine drain or waiting an engine grace period.

Engine contract tests — per-engine CI

  • Startup health: Check health throughout initialization. Assert any health response while initialization is incomplete reports NOT_SERVING. As soon as health reports SERVING, send an inference request and assert it completes successfully.
  • Serving-state transitions: Exercise pause/resume, sleep/wake, blocking model updates, required-rank failure, and recovery where supported. Assert Check and Watch agree with inference availability. Normal queuing and invalid requests must not change health.
  • Identity and cache reset: Read the ID repeatedly, reset populated cache, then restart the engine at the same address. Assert the ID stays unchanged during the live-engine reset, AllBlocksCleared is emitted, and the full restart produces a different nonempty ID.
  • Orderly shutdown: Begin shutdown and assert health changes to NOT_SERVING before listener closure. Allow the listener to close before process exit.

Sidecar lifecycle tests — CPU CI with a fake engine and runtime dependencies

  • Startup and registration: Delay engine availability, then send initial SERVING. Assert the sidecar stays operational and deregistered until identity and KV preparation complete. Repeated statuses must not duplicate registration.
  • Pause and resume: Send NOT_SERVING, continue emitting KV events, then send SERVING. Assert deregistration during the pause, continued index updates, preserved state, and re-registration after preparation.
  • Connection loss and retries: Inject unknown status, Watch failure, and disconnection without a final status. Assert deregistration and provisional index retention. Exercise successful reconnection and retry-budget exhaustion.
  • Same-engine recovery: Reconnect or restart the sidecar against the same engine ID, with complete, truncated, and unavailable replay history. Assert available events—including cache clears—are applied; incomplete continuity logs a warning and still permits registration after preparation.
  • Engine replacement during recovery: Change the engine ID without an observed NOT_SERVING, while old recovery and events remain queued. Assert old state/cursors/connections are discarded, stale work cannot affect the replacement, and registration requires the replacement to be serving and prepared.

References

Code inspected at the latest main revisions resolved on 2026-09-15 15:29:59 PST (UTC−08:00). Timestamps below are committer timestamps in PST (fixed UTC−08:00).

Repository Inspected commit Commit timestamp (PST, UTC−08:00)
Dynamo sidecar b43c373fd7c5 2026-09-15 14:44:06
vLLM 031f5810c195 2026-09-15 15:29:13
SGLang fb91baedab3e 2026-09-15 14:48:51
TensorRT-LLM df569f4bbe90 2026-09-15 14:08:59

Additional engine identity and cache-reset source inspection on 2026-09-17 used these local checkouts. These revisions supplement the original health audit above; they were not all upstream main.

Repository / checkout Inspected commit Identity evidence
vLLM local main 2c88fb131c7ae0be01907cd8c276911db5e7aad4 GetServerInfo response, ID initialization
SGLang local pr-36718 65529541817f715d365e550fe7d343ce09cfe9cb GetServerInfo response, internal startup ID
TensorRT-LLM local main e72f70e99d11fea90bac7af94f6034e6ad3ffa28 OpenEngine identity, LLM ID lifetime, SMG metadata