Repository navigation
refactor(kv-router): one Indexer type and one KV-event ingress for every selection host - #51
Closed
ishandhanani wants to merge 5 commits into
Closed
ishandhanani wants to merge 5 commits into
ishandhanani wants to merge 5 commits into
Conversation
ishandhanani
had a problem deploying
to
external_collaborator
September 4, 2026 03:18 — with
GitHub Actions
Failure
ishandhanani
force-pushed
the
idhanani/up-7-kv-index-source
branch
from
September 4, 2026 04:00
24afce4 to
11e8c9b
Compare
ishandhanani
had a problem deploying
to
external_collaborator
September 4, 2026 04:00 — with
GitHub Actions
Failure
ishandhanani
force-pushed
the
idhanani/up-7-kv-index-source
branch
from
September 9, 2026 18:30
11e8c9b to
7960c50
Compare
ishandhanani
had a problem deploying
to
external_collaborator
September 9, 2026 18:30 — with
GitHub Actions
Failure
ishandhanani
had a problem deploying
to
external_collaborator
September 9, 2026 18:30 — with
GitHub Actions
Failure
…ex comes from
Replace three knobs that together described the same thing (the builder's
external_kv_events() and remote_indexer(), and SelectionHost's
OverlapRefreshSource) with one KvIndexSource on HostCache:
- Owned: the core owns the index and subscribes to worker KV events over ZMQ
(the standalone default; workers need KV-event endpoints).
- External { refresh }: the host owns and feeds the index; workers need no
KV-event metadata; refresh optionally lets the core re-score queued
requests against the host's index (the frontend's embedded partition).
- Remote(url): a standalone indexer serves the primary index.
The listener decision, schedulability metadata, and dequeue-time refresh all
derive from this one value. SelectionServiceBuilder::kv_index sets it;
SelectionServiceConfig and the Python bindings map remote_indexer_url onto
Remote. No behavior change.
Signed-off-by: Ishan Dhanani <[email protected]>
…ion service lib/llm and lib/kv-router each carried an Indexer enum with the same Single/Concurrent/Remote shape (primary, lower tiers, predict-on-route side overlay, primary_records_routing_decisions) and diverging method sets. Fold the frontend's richer implementation into dynamo_kv_router::services::indexer: - lookup.rs: the borrowed/owned HashInput lookup pipeline (primary, lower tiers seeded from confirmed primary matches, side overlay merged by per-worker max), find_matches_by_tier[_ref][_with_options], find_primary_*. - recording.rs: routing-decision recording targets (side overlay, approximate primary, remote primary) and the per-request ApproximateRequestLease. - backend.rs: the merged enum gains None, residency projection setters, try_apply_event (the backpressure-aware admit with a completion barrier on Cleared that recovery relies on), reset_worker_dp_rank_and_wait, and the approximate-LRU capacity and stats API. apply_event_routed and remove_worker[_dp_rank] stay as the standalone listener's path. Remote primaries go behind RemotePrimary so the HTTP standalone client here and the request-plane RemoteIndexer in lib/llm plug into the same enum. dump_events returns KvRouterError like the rest of the surface. - The frontend keeps only construction (indexer::build from KvRouterConfig with component metrics and the request-plane remote), the served-indexer service, and recovery. Its 16 indexer tests move with the code. No behavior change: both hosts run the exact code they ran before for their own paths; TieredMatchProvider keeps the capability-gated variant. Signed-off-by: Ishan Dhanani <[email protected]>
KvIndexSource::External { refresh } gave the core only a refresh handle onto
an index the host kept elsewhere. Replace it with Provided(Arc<Indexer>): the
host builds and feeds the index, and the core holds it as every partition's
index, reading it for selection and dequeue-time refresh (when the index
supports refresh) and never writing to it. The frontend's embedded partition
now shares the KvRouter's Indexer object instead of a TieredMatchProvider
view of it. RefreshProvider loses its External variant.
Signed-off-by: Ishan Dhanani <[email protected]>
KvIndexSource::Owned carries the ingress that feeds the core-built index. The trait decides what metadata a worker needs to be schedulable, attaches its ranks when the worker becomes schedulable, and detaches them when it leaves. ZmqDirectIngress is the existing standalone behavior moved out of SelectionCore: endpoint validation, one ZMQ listener per rank on the registry, replay endpoint, deregistration on delete. The core keeps the lifecycle decisions (when to attach, how to mark Incomplete) and no longer knows about ZMQ endpoints. Signed-off-by: Ishan Dhanani <[email protected]>
…tend KvEventIngress now builds the partition's index (open) as well as feeding it, so KvIndexSource::Owned covers both hosts and Provided goes away: - ZmqDirectIngress opens the registry's index and, on detach, deregisters the worker's listeners or, when there are none (events off or a remote primary), drops the worker from the index: the two behaviors SelectionCore used to branch on itself. - RuntimeIngress (lib/llm/src/kv_router/indexer/ingress.rs) builds the frontend's index from the router config, starts the event-plane subscription with per-rank recovery and the served-indexer endpoint, and hands the index to the partition. Its per-worker hooks are no-ops because membership comes from the KV-source watch. KvRouter::new shrinks to constructing it; task guard and shutdown go through it. The core no longer special-cases a host-fed index anywhere: every Owned index is opened by and detached through its ingress. Signed-off-by: Ishan Dhanani <[email protected]>
ishandhanani
force-pushed
the
idhanani/up-7-kv-index-source
branch
from
September 9, 2026 19:06
7960c50 to
9aa0971
Compare
ishandhanani
had a problem deploying
to
external_collaborator
September 9, 2026 19:06 — with
GitHub Actions
Failure
ishandhanani
had a problem deploying
to
external_collaborator
September 9, 2026 19:06 — with
GitHub Actions
Failure
This was referenced Sep 10, 2026
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.
PR 7 of 9 implementing ai-dynamo#14310 (one
SelectionCorefor the frontend, the standalone selection service, and the EPP). Base:idhanani/up-6-membership(PR 6 of this stack).Summary
Makes the frontend and selection core share one
Indexerimplementation and an explicit KV-event ingress interface. Selection, dequeue-time refresh and routing-decision recording then use the same partition index.Implementation
KvIndexSourcereplaces the separate external-events, refresh-provider and remote-indexer configuration knobs.dynamo-kv-router::services::indexer.RemotePrimaryto support both HTTP standalone clients and the frontend's request-plane client.KvEventIngressopens a partition index and owns its metadata requirements and worker attach/detach behavior.ZmqDirectIngresssupplies standalone event subscriptions;RuntimeIngresssupplies frontend subscriptions, recovery and the served-indexer endpoint.Walkthrough
One index and its producer
KvIndexSource::Ownedasks its ingress to open and feed the index;Remotereads a standalone primary without local worker subscriptions. The temporary externally provided index variant is removed. Shared lookup and recording code retains tiered match information, capability-gated retention and the approximate request-lease API.The frontend prepares its runtime subscription before partition initialization and returns the same index handle from
open. Its ingress owns the subscription guard and drains it at shutdown. Recovery still runs inlib/llmthrough the ingress boundary; this PR does not move the recovery state machine into the core.Worker lifecycle
Standalone ingress checks required per-rank endpoints, attaches listeners and removes their state when a worker leaves. Frontend membership and rank resets remain managed by runtime recovery, so its catalog attach/detach hooks are no-ops. Both hosts use the shared index methods rather than parallel enum implementations.
#53 removes the remaining single-variant refresh wrapper and fixes empty-partition index retention and metadata-update reconciliation. Those corrections are part of the tested final stack, not this intermediate boundary.
Validation
Current stack boundary:
9aa0971d66a30ffb6ef9f71b44dc94dbb56b7178; the series is based on Dynamo mainab58558c2dff28f4ff1ea4e219030eac5da3f48f.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-targetsfor this stack boundary.cargo check --manifest-path lib/bindings/python/Cargo.toml --features select-service --all-targetsat this boundary.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
idhanani/up-1-host-hooksidhanani/up-2-core-indexingidhanani/up-3-embed-coreidhanani/up-4-delete-kvscheduleridhanani/up-5-policy-sourceidhanani/up-6-membershipidhanani/up-7-kv-index-sourceidhanani/up-8-affinity-tableidhanani/up-9-epp-affinity