Skip to content

feat(frontend): direct-mode infrastructure for stock engine gRPC servers - #102

Draft
ishandhanani wants to merge 3 commits into
mainfrom
idhanani/dyn-direct-common
Draft

ishandhanani wants to merge 3 commits into
mainfrom
idhanani/dyn-direct-common

Conversation

@ishandhanani

Copy link
Copy Markdown
Owner

First of a three-PR stack: this PR (infrastructure), then #99 (SGLang backend and CLI), then #100 (vLLM backend). Nothing here is reachable from the CLI yet; the backends in the next two PRs are what dial engines.

Summary

Lets the frontend route to inference engines it dials itself over their native gRPC API, with no Dynamo sidecar beside the engine and no discovery. The runtime stays; this changes only how the frontend talks to an engine. Everything above the dispatch seam (preprocessor, migration, prefill/decode hop, KV-aware routing, affinity) is unchanged.

  • runtime: TransportType::Grpc; DistributedRuntime::register_static_endpoint_instances(endpoint, watch<Vec<Instance>>) makes Endpoint::client() read a caller-owned instance list through a static EndpointDiscoverySource that synthesizes Added/Removed events from diffs, so PushRouter, prefill binding and affinity see the stream they see from etcd.
  • llm: EngineConfig::Direct { model, workers, dispatch }; entrypoint::input::direct::register_direct_model installs the workers as static instances, puts prefill engines on a committed prefill target, and builds the routed pipeline on a static client. ModelManager::set_direct_dispatch injects the final hop where build_preprocessed_routing and PrefillBinding::activate build their PushRouter. KvRouter takes ZmqDirectIngress in direct mode and reads the engines' KV-event and replay sockets from the worker card (direct_kv_events_endpoints, direct_kv_replay_endpoint).
  • sidecar-common: direct module with what every backend shares: DirectBackend (probe one URL, dispatch to it), DirectFleet (probe a URL list, assign roles from the operator's prefill list when an engine cannot report one, build EngineConfig::Direct), remap_transport_error (lifts transport faults to the top-level kinds that fire report_instance_down and migration), stable instance ids from the URL, and KV-event bookkeeping.

Trade-offs accepted up front: no snapshot recovery, no request-plane drain, no follower KV relay. This is the same shape as llm-d and SGLang's model gateway (static list or pod watch plus engine probe, engine events only).

Validation

  • cargo clippy -D warnings --tests clean on dynamo-runtime, dynamo-kv-router, dynamo-llm, dynamo-sidecar-common; Python bindings cargo check clean; cargo fmt --check clean.
  • Tests: dynamo-sidecar-common 22 (fleet role assignment, duplicate URLs, fault remap, KV-event bookkeeping), dynamo-runtime client 101 (static discovery source among them), dynamo-llm kv_router:: 447 and entrypoint:: 6.

End to end behavior is exercised by the mocker integration tests in #99 and the live SGLang and vLLM runs recorded on #99 and #100.

Add TransportType::Grpc for instances the frontend dials over an engine's
native gRPC API, and DistributedRuntime::register_static_endpoint_instances
so an Endpoint's client can read a caller-owned instance list instead of
discovery. The static source synthesizes Added and Removed events from
diffs of the watched list, so PushRouter, prefill binding and affinity see
the same event stream they see from etcd.

Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
EngineConfig::Direct carries a fixed worker list and a StreamingDispatch
that is the final hop under PushRouter. register_direct_model installs the
workers as static instances, puts prefill engines on a committed prefill
target, and builds the usual routed pipeline (preprocessor, migration,
prefill hop, KV routing) on top. ModelManager::set_direct_dispatch injects
the dispatch where the pipeline builds its PushRouter, and KvRouter reads
KV events over ZmqDirectIngress from the endpoints the worker card
advertises under direct_kv_events_endpoints and direct_kv_replay_endpoint.

Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
dynamo-sidecar-common::direct holds what every direct backend shares:
DirectBackend (probe one URL, dispatch to it), DirectFleet (probe a URL
list, assign roles from the operator's prefill list when an engine cannot
report one, build EngineConfig::Direct), the transport-fault remap that
lets the router mark an instance down and migrate, stable instance ids
from the URL, and the KV-event bookkeeping including the replay socket.

Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>

This branch had an error being deployed

1 failed deployment
external_collaborator — 17f96b0e Deployed Oct 23, 2026 by ishandhanani via ok-to-test #324
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant