Repository navigation
perf(kv-router): append decode stores at the leaf tail under one lock - #18108
Conversation
Most KV events are one-block decode stores whose parent is the tail of the worker's own leaf. Each went through parent planning: an EdgeIndex probe for the parent, then four more shape-gate round trips before the append, an Arc clone, and a node-address lookup for the new entries. When the worker's lookup entry for the parent names a leaf that ends with it and the worker covers that tail, append there under one exclusive gate and point the new entries at the held node id. Every other store takes the general path unchanged. Removal run grouping now prefetches lookup slots ahead, as upserts and deletes already do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
/ok to test 51f7b17 |
|
@coderabbitai full review |
|
No actionable comments were generated in the recent review. WalkthroughStores now attempt to append blocks directly to an eligible compressed leaf tail when the worker’s lookup holds the parent. The change adds lookup support for this path, preserves the existing insertion flow when it does not apply, and adds tests for success and fallback cases. ChangesTail append store path
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk:
|
Action performed
|
Main's tests already fail when the internal or tail-hash guard is removed, or when removal grouping miscounts. Keep the anchor and uncovered-tail tests, which nothing else covers, and assert the fast path is taken in the existing decode-extension test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
/ok to test b5acc50 |
…04/crtc-decode-append
|
/ok to test 28c7f64 |
Fourth upstream merge for the split v2 PR: the five commits past 02331f0. Four conflicts, all from ai-dynamo#18009, placed in the owner crates; upstream behavior whole, the stack's moves intact, no shims. - ai-dynamo#18009 keep prepared rows when ranks are past the reject thresholds: is_worker_full(dp_size)/skips_full_workers in the kernel's filter.rs; the actor keeps prepared rows and the kernel's select_with_policy drops the rows of workers whose every rank is full before the policy adopts them (PreparedRows::retain in worker-selection; the policy recounts the best cached prefix from the rows it adopts and reports whether any is left); prepared rows carry dp_size (u16, so the 128-byte row holds) set in the kernel's CandidatePreparerExt::prepare; the three new kernel queue tests and the relocated test helpers updated. - ai-dynamo#18108 CRTC decode stores appended at the leaf tail under one lock: lib/router/kv-indexer concurrent_radix_tree_compressed (auto-merged). - ai-dynamo#16258 vLLM backend defaults for omitted token limits: lib/llm preprocessor, lib/sidecar/vllm, components, docs, tests (auto-merged). - ai-dynamo#18152 planner ARIMA forecasts, ai-dynamo#16426 operator crash-loop: outside the router (auto-merged). Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
Overview
Most KV events the router applies are one-block decode stores whose parent is the tail of the worker's own leaf: about 80% of events in the selection replay's agentx workload and 87% in its chat workload. Each went through parent planning: an
EdgeIndexprobe for the parent, then four more shape-gate round trips beforetry_extend_leaf_with_versionappended. Now, when the worker's lookup entry for the parent names a leaf that ends with the parent and the worker covers that tail, the store is checked and appended under one exclusive shape gate, and the new lookup entries reuse the lane's node id. Every other store takes the existing path unchanged. Removal run grouping also prefetches lookup slots ahead, as upserts and deletes already do.mooncake_benchwrite capacitymooncake_benchkeep-upfind_matchesand update p50/p99Tyche Grace node. Selection replay:
selection_replay_bench(#17959) at saturation, agentx 3 alternating runs per arm and chat 1 run per arm, with cycles from window-bracketed profiles.mooncake_bench: 6 paired rounds, glibc, 95% bootstrap CIs.Both arms run at about 12.1k req/s, the scheduler actor's ceiling. With this change the 4 event threads nearly keep up at that rate, instead of falling millions of events behind.
Key Changes
Node::try_append_at_tail: the decode-extension checks (not internal, not an anchor, tail is the parent, worker covers the tail) and the append, under one exclusive gate.apply_storedtries it first, through the lane's entry for the parent (LaneLookup::held, borrowed, noArcclone), and points the new entries at that node id (LaneLookup::upsert_all_held).BlockLookup::leading_holdingreplaces the unprefetchedgetloop inLaneLookup::leading_naming.This adds a commit path that relies on the exclusive gate instead of a shape version. The leaf-extension conditions, including sticky
internal, are unchanged.Validation
cargo test -p dynamo-kv-router --libcargo clippy -p dynamo-kv-router --all-targets -- -D warnings, with and without--features benchIssues and Ongoing Work
Pull Request Checklist
/pr-checklistskill.🤖 Generated with Claude Code
Summary by CodeRabbit
Performance
Bug Fixes