Repository navigation
perf(runtime): clone only the selected instance during dispatch - #14545
jthomson04 wants to merge 2 commits into
Conversation
Signed-off-by: jthomson04 <jwillthomson19@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review. WalkthroughChangesInstance transport resolution
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to Transport resolution now retains only the selected discovered instance before dispatch, reducing unnecessary cloning while preserving existing lookup, fallback, and transport behavior. No current merge-blocking risk is identified. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment |
Signed-off-by: jthomson04 <jwillthomson19@gmail.com>
| assert_eq!(client.instance_by_id(1), Some(instances[0].clone())); | ||
| let selected = client.instance_by_id(2).unwrap(); | ||
| assert_eq!(selected, instances[1]); | ||
| assert!(client.instance_by_id(3).is_none()); |
There was a problem hiding this comment.
The never-present ID check is an extra missing-ID parameter that protects no distinct observable contract. instance_by_id only searches the current watch snapshot, so the later client.instance_by_id(2).is_none() after sending a snapshot without id 2 exercises the same no-match behavior while also preserving the current-snapshot removal regression; the id 2 equality assertion still protects selecting the requested non-first instance.
🤖 AI Fix
Remove the pre-update client.instance_by_id(3).is_none() assertion and keep the post-removal missing-ID assertion.
Incorporate the final change from PR #14545. Borrow the live discovery snapshot and clone only the selected instance, preserving transport fallback behavior and the existing lookup regression test. Signed-off-by: jthomson04 <jwillthomson19@gmail.com>
Incorporate the final change from PR #14545. Borrow the live discovery snapshot and clone only the selected instance, preserving transport fallback behavior and the existing lookup regression test. Signed-off-by: jthomson04 <jwillthomson19@gmail.com>
|
Closing as superseded by #14666, which merged into main on September 30, 2026 (99ae6e5). Every added and removed line from this PR is included in that merged patch: Client::instance_by_id(), its use in PushRouter::resolve_transport(), and the lookup test. Verified that these changes remain in main at 006e5f3. |
Overview:
Summary
Avoid cloning the complete discovered-instance list when resolving a worker's request transport. Clone only the selected instance.
Details:
Client::instance_by_idhelper that searches the current discovery snapshot and returns an owned instance.instances()API, fallback policy, transport metadata, and error behavior. Each lookup still reads a fresh snapshot.Where should the reviewer start?
Client::instance_by_idinlib/runtime/src/component/client.rs, then its use inPushRouter::resolve_transportinlib/runtime/src/pipeline/network/egress/push_router.rs.Validation
Initial validation on
fa68d17ced:cargo check --locked -p dynamo-runtimepassed.cargo clippy --locked -p dynamo-runtime --lib -- -D warningspassed.git diff --checkpassed.Review cleanup on
37bf2ae47f: the focused lookup test, changed-file formatting check, andgit diff --checkpassed. The follow-up removes only two redundant assertions and one doc comment; production logic is unchanged.No new benchmark or profile was run; this PR makes no measured throughput claim.
Related Issues
Summary by CodeRabbit