Repository navigation
feat(kv-router): session affinity for request-shaped hosts (EPP parity) - #44
Closed
ishandhanani wants to merge 2 commits into
Closed
ishandhanani wants to merge 2 commits into
ishandhanani wants to merge 2 commits into
Conversation
SelectionServiceBuilder::session_affinity(ttl) gives the core its own SessionAffinity table. A booked selection whose request carries a session id (session_id or session_context) and no explicit pin or affinity target acquires the session first: a bound session steers selection to its worker (exclusive for the default selector) and a new one is bound to the worker the scheduler chose. The lease is held with the booking and released by free_reservation; a bound worker that was not selected (it left) is invalidated and the session rebound. Advisory selects read the binding. Bindings replicate over the existing ZMQ peer mesh on their own topic (dynamo.session-affinity.v1) so peers that do not subscribe never see them; the active-sequence topic and wire format are untouched. The publisher multiplexes both channels onto one socket; PeerManager subscribes to the second topic only when a handler is given. SelectionServiceConfig carries the TTL for the standalone binary. Also fixes the slot tracker's setup_scoped_replica_sync call, which the standalone-slot-tracker feature had left uncompiled since the host replica channels landed. Signed-off-by: Ishan Dhanani <[email protected]>
DYN_EPP_SESSION_AFFINITY_TTL_SECS turns on the selector's session table. The EPP passes x-dynamo-session-id, the same header the frontend reads, as the request's session id, so repeat requests of a session land on the worker that served it and peer EPPs learn the binding over the replica mesh. Hard mode only: the EPP routes by headers and never observes where a request ran. The standalone selection binary and the Python SelectionService gain the same TTL setting (--session-affinity-ttl-secs, session_affinity_ttl_secs). Signed-off-by: Ishan Dhanani <[email protected]>
ishandhanani
had a problem deploying
to
external_collaborator
September 4, 2026 01:47 — with
GitHub Actions
Failure
Owner
Author
Gates at tip 64fef40
|
This was referenced Sep 4, 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.
Stack 1, group D, second slice: EPP session-affinity parity. Stacked on #43. DEP #33.
Summary
Two logical commits:
feat(kv-router): session affinity for request-shaped selection hosts—SelectionServiceBuilder::session_affinity(ttl)gives the core its ownSessionAffinitytable (the one refactor(kv-router): one session-affinity implementation for every selection host #42 moved into kv-router). A booked selection whose request carries a session id and no explicit pin or affinity target acquires the session first: a bound session steers selection to its worker, a new session is bound to the worker the scheduler chose, the lease is held with the booking and released byfree_reservation, and a bound worker that was not selected (it left) is invalidated and the session rebound. Advisory selects read the binding. Bindings replicate over the existing ZMQ peer mesh on their own topic (dynamo.session-affinity.v1); the active-sequence topic and wire format are untouched, and peers that do not subscribe never see the new topic. Also fixes asetup_scoped_replica_synccall in the slot tracker that thestandalone-slot-trackerfeature had left uncompiled since feat(router): embedded selection partition parity with the runtime scheduler #35.feat(epp): session affinity in the standalone EPP—DYN_EPP_SESSION_AFFINITY_TTL_SECSturns the table on; the EPP passesx-dynamo-session-id(the header the frontend reads) as the request's session id. Hard mode only, because the EPP routes by headers and never observes where a request ran. The standalone binary and the PythonSelectionServicegain the same TTL setting.Behavior
No change unless a TTL is configured. With it, the EPP gets what the frontend has had: repeat requests of a session land on the worker that served it, and peer replicas learn the binding.
Validation
cargo test -p dynamo-kv-router --features standalone-selection,standalone-slot-tracker --lib: 1107 passed, including two new core tests (a session stays on its first worker across bookings and reads; a replicated binding steers a new session and its lease frees with the booking).cargo test -p dynamo-ext-proc: 141 passed.cargo clippyfor kv-router (both features), ext-proc (tests): clean. Bindingscargo check: clean.Review notes (graham-code-review pass)
parking_lot::Mutex<HashMap<selection_id, AffinityLease>>keyed like the reservation index, soforget_reservationreleases both in one place. No lock is held across an await.ReplicaSyncConfiggained an optional affinity channel rather than a new event enum, so the slot tracker (which shares the type) is unaffected and the mesh wire stays compatible.AffinityError::ResourceExhausted(entry limit) maps toSelectionError::NotReadyso the HTTP surface reports it as back-pressure, not a bad request.