Fan out LWT replica RPCs concurrently#119
Open
mweiden wants to merge 1 commit into
Open
Conversation
The prepare, read, propose, and commit phases of execute_lwt each awaited replicas one at a time inside a loop, so every Paxos round cost the sum of all replica round-trip times. With a slow or distant replica, every lightweight transaction stalled behind it four times over. Each phase now issues its RPCs to all replicas concurrently via join_all and merges results afterwards, bounding per-phase latency by the slowest replica instead of the sum. Quorum accounting, ballot comparison, and the LWW read-merge rules are unchanged. https://claude.ai/code/session_01CJXWjB9ERGgV6B9mRqrdM9
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.
Problem
The prepare, read, propose, and commit phases of
Cluster::execute_lwteach awaited replicas one at a time inside aforloop, so every Paxos round cost the sum of all replica round-trip times — four times over per transaction. One slow or distant replica stalled every lightweight transaction on the coordinator.Fix
Each phase now issues its RPCs to all replicas concurrently via
futures::future::join_alland merges the results afterwards, bounding per-phase latency by the slowest replica instead of the sum. Quorum accounting, ballot comparison, and the LWW read-merge rules are byte-for-byte unchanged — only the await structure moved.Tests
concurrent_lwt_inserts_apply_exactly_once: 8 competingIF NOT EXISTSinserts for the same key fired in parallel; exactly one may win.lwt_test,cluster_lwt_test,lwt_orders_test,replication_grpc_test— including multi-node gRPC paths and the insufficient-replica error case) all pass unchanged.Found by codebase audit (medium severity: per-replica latency summing on the LWT hot path).
https://claude.ai/code/session_01CJXWjB9ERGgV6B9mRqrdM9
Generated by Claude Code