Skip to content

feat(kv-router): one worker-membership path for frontend and EPP - #50

Closed
ishandhanani wants to merge 5 commits into
idhanani/up-5-policy-sourcefrom
idhanani/up-6-membership
Closed

ishandhanani wants to merge 5 commits into
idhanani/up-5-policy-sourcefrom
idhanani/up-6-membership

Conversation

@ishandhanani

@ishandhanani ishandhanani commented Sep 4, 2026 •

Copy link
Copy Markdown
Owner

PR 6 of 9 implementing ai-dynamo#14310 (one SelectionCore for the frontend, the standalone selection service, and the EPP). Base: idhanani/up-5-policy-source (PR 5 of this stack).

Fork staging copy of the upstream PR, rebased onto ai-dynamo/main. Replaces fork #38, which stay open for review history.

Summary

Uses one WorkerCatalogSource and CatalogReconciler contract for frontend discovery and EPP pod discovery. This makes worker registration, retries and removal consistent and fixes EPP registration of data-parallel worker ranks.

Implementation

  • Adds runtime-free snapshot and observer interfaces plus a common catalog reconciler.
  • Replaces the frontend-local catalog feeder with RuntimeDiscoverySource and retains registration metrics through an observer.
  • Replaces EPP-local reconcile state with PodReflectorSource.
  • Registers EPP KV-event endpoints per DP rank using the configured parallel size and port stride.
  • Updates membership tests to the reconciler API at the rebased boundary.
Walkthrough
flowchart LR
  Runtime[Runtime discovery watch] --> Reconciler[CatalogReconciler]
  Pods[EPP pod reflector] --> Reconciler
  Reconciler --> Core[SelectionCore catalog]
  Reconciler --> Observer[Host registration metrics]
Loading

Snapshot application

A source yields complete desired WorkerRequest snapshots. The reconciler checks duplicate IDs before mutation, upserts new or changed records, retries records the core reports as unschedulable, and deletes workers absent from the next snapshot. The convergence cache avoids cloning unchanged records into repeated upserts.

The frontend now retries an incomplete registration on subsequent snapshots even when its runtime metadata has not changed. This lets registration converge after a transient readiness failure.

Closure and ownership

Source closure does not itself clear the catalog. The EPP source yields one empty snapshot before closing on reflector loss, preserving its fail-closed behavior; the runtime watch has its own closure semantics. The reconciler spawns no task, so each host controls execution and cancellation.

Runtime discovery remains in lib/llm, Kubernetes discovery remains in ext-proc, and the shared reconciler has no dynamo-runtime dependency. Preservation of live bookings and unchanged KV listeners during metadata updates is a later correction in #53.

Validation

Current stack boundary: 945b4aea2f4f41914dd78fbb729911b727115d1b; the series is based on Dynamo main ab58558c2dff28f4ff1ea4e219030eac5da3f48f.

  • Passed cargo check -p dynamo-kv-router -p dynamo-llm -p dynamo-ext-proc --no-default-features --features dynamo-kv-router/standalone-selection,dynamo-kv-router/standalone-slot-tracker --all-targets for this stack boundary.
  • Python bindings passed cargo check --manifest-path lib/bindings/python/Cargo.toml --features select-service --all-targets at this boundary.
  • The complete series was tested at feat(kv-router): session affinity for the standalone service and EPP #53; its description records the Rust/Python suites, aggregated GPU correctness probes and paired main/final benchmarks. Those end-to-end results apply to the final stack, not to a separate deployment of this intermediate PR.

GitHub CI is not green across this series. Recurring failures are the missing fork Fastchecker runner group, helm-tester image and approval-bot token, plus published-docs composition and an unchanged external documentation link. The local compilation and final-stack validation above are recorded separately from those CI failures.

Stack

# Branch Title Fork PRs it replaces
1 idhanani/up-1-host-hooks feat(kv-router): host-supplied inputs for SelectionService parity with the frontend scheduler #8 to #12
2 idhanani/up-2-core-indexing feat(kv-router): approximate, remote, and hint-aware indexing in SelectionService #14 to #16
3 idhanani/up-3-embed-core feat(router): re-host KvRouter scheduling on an embedded selection partition #18, #35
4 idhanani/up-4-delete-kvscheduler refactor(router): delete the runtime-bound KV router scheduler #36
5 idhanani/up-5-policy-source refactor(router): selection policy source, SelectionHost, and dead-flag removal #37
6 (this PR) idhanani/up-6-membership feat(kv-router): one worker-membership path for frontend and EPP #38
7 idhanani/up-7-kv-index-source refactor(kv-router): one Indexer type and one KV-event ingress for every selection host #39, #41, #43
8 idhanani/up-8-affinity-table refactor(kv-router): one session-affinity implementation for every selection host #42
9 idhanani/up-9-epp-affinity feat(kv-router): session affinity for the standalone service and EPP #44

Phase 4 of the runtime-optional frontend roadmap: the EPP pod reflector is the
Kubernetes catalog feeder, and it registered every pod as a single
data-parallel rank (the hardcoded data_parallel_size: 1 in selector.rs).

- EppStandaloneConfig gains DYN_EPP_DATA_PARALLEL_SIZE (default 1) and
  DYN_EPP_KV_EVENT_PORT_STRIDE (default 1). Rank r publishes KV events on
  kv_event_port + r * stride; the reflector emits one KV-event endpoint per
  rank (RawWorker.kv_events_endpoints) and the registration carries
  data_parallel_size, which the selector passes through with
  data_parallel_start_rank 0.

Tests: strided per-rank endpoints for a 3-rank pod; existing reflector,
adapter, and selector tests updated to the per-rank shape (144 pass).

Signed-off-by: Ishan Dhanani <[email protected]>
… membership

A host owns discovery and exposes it as a WorkerCatalogSource: a stream of
complete desired membership snapshots. CatalogReconciler applies each snapshot
to a SelectionCore: it upserts new or changed records, retries records the core
reported not schedulable, deletes workers that left (including ones that never
converged), rejects duplicate ids before mutating anything, and clears the
catalog when the source closes so selection fails closed. A CatalogObserver
lets a host keep per-worker metrics in step.

This is the reconcile loop the EPP standalone selector and the frontend's
embedded partition each carried; both switch to it in the next commits.
SelectionService exposes its core for hosts that drive the catalog directly.

Signed-off-by: Ishan Dhanani <[email protected]>
…ogReconciler

The runtime-config watch becomes a WorkerCatalogSource (RuntimeDiscoverySource)
and the partition's catalog is driven by the shared CatalogReconciler instead of
the router-local CatalogFeeder. The per-worker router_worker_registered gauge is
kept through a CatalogObserver. Behavior is unchanged except that a worker the
core reports not schedulable is now retried on every membership snapshot
rather than only when its runtime config changes.

Signed-off-by: Ishan Dhanani <[email protected]>
The standalone EPP's topology adapter yields the reflector's Ready pods as
WorkerRequest snapshots (PodReflectorSource) and lets CatalogReconciler own
the desired-versus-actual diff. Selector::reconcile, WorkerRegistration, and
the EPP-local reconcile state are removed; their tests moved to
dynamo-kv-router with the reconciler. A closed reflector channel still yields
one empty snapshot so selection fails closed, as before.

Signed-off-by: Ishan Dhanani <[email protected]>

This branch had an error being deployed

1 failed deployment
external_collaborator — 945b4aea Deployed Sep 9, 2026 by ishandhanani via ok-to-test #139
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation feat router

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant