Repository navigation
refactor(kv-router): one session-affinity implementation for every selection host - #52
Closed
ishandhanani wants to merge 1 commit into
Closed
ishandhanani wants to merge 1 commit into
ishandhanani wants to merge 1 commit 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-8-affinity-table
branch
from
September 4, 2026 04:00
b070274 to
4d84150
Compare
ishandhanani
had a problem deploying
to
external_collaborator
September 4, 2026 04:00 — with
GitHub Actions
Failure
ishandhanani
had a problem deploying
to
external_collaborator
September 4, 2026 04:00 — with
GitHub Actions
Failure
ishandhanani
force-pushed
the
idhanani/up-8-affinity-table
branch
from
September 9, 2026 18:30
4d84150 to
64653cd
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
… host Move the session table out of lib/llm/src/session_affinity into dynamo_kv_router::services::selection::affinity: SessionAffinity (session id -> bound worker/rank, versioned, TTL reaper, entry and id limits), the AffinityInitialization / AffinityLease lifecycle (commit, rebind, invalidate, release on drop), hard and soft validation, and replica apply with the same outcome table. Replication becomes an AffinityReplicaSink the host installs; the table stays transport-free. The frontend AffinityCoordinator is now a thin wrapper: it converts the pipeline RouteTarget at the boundary, abandons an initialization wait when the request context stops, holds a lease for the life of a response stream, and keeps its runtime event-plane replica sync (same subject and wire format) behind the sink. SessionAffinityMode moves with the table; lib/llm re-exports it. All 37 session-affinity tests and the routing-host affinity tests run unchanged against the wrapper. Signed-off-by: Ishan Dhanani <[email protected]>
ishandhanani
force-pushed
the
idhanani/up-8-affinity-table
branch
from
September 9, 2026 19:06
64653cd to
f413da4
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 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 8 of 9 implementing ai-dynamo#14310 (one
SelectionCorefor the frontend, the standalone selection service, and the EPP). Base:idhanani/up-7-kv-index-source(PR 7 of this stack).Summary
Moves the session-affinity table from
lib/llminto the runtime-free selection package. Frontend and standalone hosts can then reuse the same binding, lease, expiry and replica-conflict semantics.Implementation
SessionAffinity, versioned bindings, TTL reaping and capacity limits intodynamo_kv_router::services::selection::affinity.AffinityReplicaSinkand weak table handles.Walkthrough
Binding and request lifetime
An unbound session acquires an initialization slot, which commits the dispatched worker or releases the slot when dropped. A bound session acquires a lease; dropping the lease refreshes its idle expiry. Soft mode can rebind and hard mode validates the bound target. Entry limits, ID limits and replica versions preserve their existing semantics.
Waiting returns a pinned, enabled
OwnedNotifiedregistered while the entry lock is held. The host can race that wait against request cancellation without a missed notification. The table contains no runtime transport and does not hold a lock across an await.Boundary within the stack
At this PR, the frontend still constructs its table and uses its runtime event-plane replica transport. The standalone service does not enable affinity until #53. That final PR makes affinity partition-owned for KV selection and lets the frontend borrow the partition's table, while builtin routing modes retain host-owned tables.
Weak table handles prevent replica tasks from keeping an unused table alive. Cross-crate test hooks preserve the existing table and frontend coordinator coverage.
Validation
Current stack boundary:
f413da4bd432bf6c1db31f3dd4fc2a05ccfa4da2; 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