Repository navigation
feat(router): re-host KvRouter scheduling on an embedded selection partition - #18
Closed
ishandhanani wants to merge 1 commit into
Closed
ishandhanani wants to merge 1 commit into
ishandhanani wants to merge 1 commit into
Conversation
…rtition Phase 1a of the runtime-optional frontend roadmap. Behind KvRouterConfig::router_embedded_selection (--router-embedded-selection / DYN_ROUTER_EMBEDDED_SELECTION, default off), the frontend KvRouter runs its scheduling and active-sequence accounting on one partition of an in-process SelectionService instead of the runtime-bound KvScheduler: - RouterScheduler enum in KvRouter dispatches statically to either backend; every router method (admitted and advisory scheduling, bookings, lifecycle, potential loads) goes through it. Request leases fence with the partition scheduler's booking_cleanup exactly as with KvScheduler. - kv_router/embedded.rs builds the service with the registry-resolved policy (or Dynamo's default scorer/picker under the router's metric label), the router's overload/availability providers and prefill estimator as host hooks, and the router's own indexer as the dequeue-time overlap refresh source. A catalog feeder mirrors the runtime-config watch into the partition's worker catalog (dp layout, capacities, taints, topology, KV-transfer, router-hint metadata). - The router keeps its indexer and request transport: it computes overlap against its indexer and hands the partition a fully formed ScheduleRequest. Selection-service additions used by the host: SelectionPartition handle, ensure_partition (create the scheduler before workers register), external_kv_events (host feeds KV state; no ZMQ listeners), a policy-factory override on the builder, and OverlapRefreshSource (partition indexer, external, or disabled). Not carried over in embedded mode: NATS active-sequence replica sync (router_replica_sync warns), per-class queue metrics, and scheduler load publication to the routing-load monitor. Tests: routing_host::embedded_selection_books_and_releases_like_the_runtime_scheduler mirrors the runtime preview/plan/abort/track/free flow on the embedded path; embedded::worker_request_mirrors_runtime_config covers the catalog mapping. All existing kv_router tests pass on the runtime path. Signed-off-by: Ishan Dhanani <[email protected]>
ishandhanani
had a problem deploying
to
external_collaborator
September 3, 2026 08:15 — with
GitHub Actions
Failure
This was referenced Sep 3, 2026
Closed
Owner
Author
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 1 of the runtime-optional frontend roadmap (1a: scheduler + active-sequence accounting re-hosted; the indexer stays on the router for now). Stacked on #16.
Summary
Behind
KvRouterConfig::router_embedded_selection(--router-embedded-selection/DYN_ROUTER_EMBEDDED_SELECTION, default off), the frontendKvRouterruns scheduling and active-sequence accounting on one partition of an in-processSelectionService(the same core as the standalone selection service) instead of the runtime-boundKvScheduler.RouterSchedulerenum inKvRouterdispatches statically to either backend; all 17 scheduler call sites go through it. Request leases fence with the partition scheduler'sbooking_cleanupexactly as before.kv_router/embedded.rs: builds the service with the registry-resolved policy (or Dynamo's default scorer/picker under the router's metric label, matchingDefaultWorkerSelector::new(config, metric_worker_type)), the router's overload/availability providers and prefill estimator as host hooks, and the router's own indexer as the dequeue-time overlap refresh source. A catalog feeder mirrors the runtime-config watch into the partition's worker catalog (dp layout, capacities, taints, topology, KV-transfer, router-hint metadata).ScheduleRequest.SelectionPartitionhandle,ensure_partition(scheduler exists before workers register),external_kv_events(host feeds KV state; no ZMQ listeners), builder policy-factory override,OverlapRefreshSource(partition indexer / external / disabled).KvRouterConfig(router_embedded_selection=),.pyi, Python arg group + CLI flag,frontend-configuration.mdx.Validation
cargo test -p dynamo-llm --lib -- kv_router: 332 passed (runtime path unchanged). Newrouting_host::embedded_selection_books_and_releases_like_the_runtime_schedulermirrors the runtime preview/plan/abort/track/free flow on the embedded path;embedded::worker_request_mirrors_runtime_configcovers the catalog mapping.cargo test -p dynamo-kv-router --features standalone-selection --lib: 1069 passed. Clippy clean on both crates (pre-existingregistry.rswarning only).pytest components/.../test_kv_router_args.py: 63 passed.maturin develop --releasebuilds;KvRouterConfig(router_embedded_selection=True)accepted.Benchmark gate (dynamo-frontend-benchmark, mock workers)
dynamo.frontend --router-mode kvpinned to cores 0-3, 4dynamo.mockerworkers + aiperf on cores 4-15, block size 64, Qwen3-0.6B tokenizer, aiperf closed loop concurrency 128, 1024 requests after 256 warmup, arms interleaved, teardown between runs (DYN_ROUTER_EMBEDDED_SELECTION=1for the embedded arm; confirmed via the frontend log marker each run).Medians: embedded 145.9 req/s vs runtime 137.2 (+6.3%); p50 latency 484 vs 549 ms; p99 1122 vs 1396 ms. No routing-quality or latency regression; the embedded partition is slightly faster (no NATS sequence publisher on the booking path). All 1024 requests completed in every run; no frontend errors or panics. The KV replay-parity campaign and
tests/routere2e on both paths remain to run before deleting the old wiring (exit gate for removingKvScheduler).