Skip to content

refactor(router): delete the runtime-bound KV router scheduler - #48

Closed
ishandhanani wants to merge 2 commits into
idhanani/up-3-embed-corefrom
idhanani/up-4-delete-kvscheduler
Closed

ishandhanani wants to merge 2 commits into
idhanani/up-3-embed-corefrom
idhanani/up-4-delete-kvscheduler

Conversation

@ishandhanani

@ishandhanani ishandhanani commented Sep 4, 2026 •

Copy link
Copy Markdown
Owner

PR 4 of 9 implementing ai-dynamo#14310 (one SelectionCore for the frontend, the standalone selection service, and the EPP). Base: idhanani/up-3-embed-core (PR 3 of this stack).

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

Summary

Deletes the runtime-bound KvScheduler after the frontend has switched to the embedded selection partition. The frontend now has one scheduling implementation, including callers that supply a custom selector.

Implementation

  • Removes the runtime scheduler, runtime sequence publisher, direct-ZMQ active-sequence ingress and two-backend dispatch wrapper.
  • Keeps runtime-free scheduler re-exports and routes frontend scheduling through the embedded partition.
  • Temporarily adapts custom WorkerSelector<ModelRuntimeConfig> callers through DelegatedWorkerSelector and ErasedWorkerConfig.
  • Deprecates and ignores the embedded-selection opt-out flag, and moves the registered-worker gauge to the catalog feeder.
  • Removes the unused LoRA scheduler-polling path.
Walkthrough
flowchart LR
  Router[KvRouter] --> Partition[Embedded selection partition]
  Custom[Custom selector] --> Adapter[Delegated policy adapter]
  Adapter --> Partition
  Partition --> Booking[Scheduling and booking lifecycle]
Loading

Removed scheduler and retained behavior

The default path already used the partition after #47. Explicitly disabling embedded selection now logs a deprecation warning and uses the partition as well. Runtime-free sequence accounting remains in dynamo-kv-router; the frontend's discovery and transport responsibilities remain in lib/llm.

Temporary custom-selector bridge

KvRouter<Sel> retains its type parameter for this boundary. Arbitrary injected selectors receive an erased worker-config map converted back to ModelRuntimeConfig by the adapter. That conversion is confined to custom-selector callers; registry policies use their existing path. #49 removes the generic and adapter together in favor of an explicit policy source.

The rebase keeps the current request-lifecycle call sites compiling. The final series' deferred replica request-lease observer and frontend-owned expiry restoration are covered in #53.

Validation

Current stack boundary: 2c3a1e6f8a51ff0b2abf81c968dc7309d03d4367; 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 (this PR) 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 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

The frontend router now always schedules on an embedded selection-service
partition. Remove `KvScheduler` (kv_router/scheduler.rs keeps only its
runtime-free re-exports), the runtime sequence publisher and its
constructors, the direct-ZMQ active-sequence ingress, the two-variant
`RouterScheduler` dispatch, and the LoRA load estimator's uncalled
scheduler polling. `KvRouter<Sel>` keeps its type parameter for API
compatibility (`PhantomData<fn() -> Sel>`).

A caller-injected `WorkerSelector<ModelRuntimeConfig>` that is neither the
default selector nor a registry `WorkerSelectionPolicy` now runs inside the
partition: `WorkerSelectionPolicy::delegated` (new `DelegatedWorkerSelector`
trait in dynamo-kv-router) hands the selector the scheduling request and a
config-erased view of the eligible workers (`ErasedWorkerConfig`), which the
embedded host projects back onto `ModelRuntimeConfig`. The unit tests that
inject fake selectors run unchanged on that path.

The per-worker `router_worker_registered` gauge is now maintained by the
embedded catalog feeder. `router_embedded_selection` is deprecated and
ignored; `false` logs a warning. Four sequence-level tests that built the
runtime sequences directly are removed; their behavior is covered by the
replica-lifecycle and session-affinity e2e tests on the embedded path.

Signed-off-by: Ishan Dhanani <[email protected]>
(cherry picked from commit 71cea67)

This branch had an error being deployed

1 failed deployment
external_collaborator — 2c3a1e6f Deployed Sep 9, 2026 by ishandhanani via ok-to-test #135
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 refactor router

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant