请教Multi-Paxos学习资源及减少Prepare RPC的深层原理
Hey there! Since you already have solid Raft experience (great job on finishing the MIT 6.824 implementation!) and understand basic Paxos, let’s dive straight into the deep logic of why Multi-Paxos slashes Prepare RPCs, then share resources that’ll fill those detail gaps you’re hitting.
Core Logic Behind Multi-Paxos' Prepare RPC Reduction
Let’s start by contrasting with basic Paxos to highlight the optimization:
- In basic Paxos, every single log entry (instance) requires a full Prepare-Accept-Learn cycle. This means repeated Prepare RPCs that re-establish node commitments each time.
- Multi-Paxos fixes this by leaning into two key mechanisms, tied together:
1. Stable Leader Leverage
Once a leader is elected and confirms it has the highest proposal number (via an initial Prepare phase), all nodes have already committed to not accepting any proposals with a lower number than the leader’s. As long as the leader stays in power, this commitment remains valid for all subsequent instances. There’s no need to re-run Prepare for each new entry—since the leader’s proposal number is still the highest, nodes will honor any Accept RPCs it sends.
2. noMoreAccepted Response Optimization
During the initial Prepare phase, the leader asks each node if it has ever accepted a proposal (noMoreAccepted). Here’s how this cuts down on future Prepares:
- If a node replies
noMoreAccepted(it has never accepted any proposal), the leader can permanently skip Prepare for this node in all future instances. The node has no existing accepted entries to conflict with, and it’s already committed to the leader’s proposal number. - If a node has accepted a proposal, the leader only needs to fetch the highest-numbered accepted entry once during the initial Prepare. After that, it can directly send Accept RPCs for new entries, safe in the knowledge that the node won’t accept anything lower than the leader’s number.
The big takeaway: Multi-Paxos replaces per-instance Prepare RPCs with a single, global Prepare per leader term. Only when a leader fails and a new election happens does the cycle restart—this is where the massive reduction in Prepare traffic comes from.
Recommended Learning Resources
Since you’ve already gone through the classic papers and Diego’s talk, here’s targeted content to fill in the details:
- Book: Designing Data-Intensive Applications by Martin Kleppmann. The Paxos chapter breaks down Multi-Paxos step-by-step, compares it directly to Raft (which you know well), and uses real-world context to explain when and why the Prepare-skipping logic works. It’s far more accessible than dense papers for connecting theory to practice.
- Deep Dive Blogs: Look for blogs that focus on Multi-Paxos’ state transitions and leader stability mechanics. Posts with titles like “Multi-Paxos: How Skipping Prepares Actually Works” often include diagrams of node states during stable leadership vs. leader failures, which make the logic concrete.
- Open Source Code Examples:
- Apache ZooKeeper’s ZAB protocol: ZAB is a Multi-Paxos variant, and its codebase has clear comments explaining how the leader skips Prepare phases once it’s stabilized. You can trace the logic for handling
noMoreAcceptedresponses and how subsequent Accept RPCs are sent without Prepares. - University Course Labs: Stanford’s CS244b and Berkeley’s CS262 have public Multi-Paxos implementation labs. These include skeleton code with hints for implementing the Prepare-skipping logic, which will help you solidify your understanding through practice (similar to how you learned Raft in 6.824).
- Apache ZooKeeper’s ZAB protocol: ZAB is a Multi-Paxos variant, and its codebase has clear comments explaining how the leader skips Prepare phases once it’s stabilized. You can trace the logic for handling
- Supplementary Paper: Fast Paxos isn’t exactly Multi-Paxos, but it explores related optimizations around skipping Prepare phases, which will give you a broader perspective on how Paxos variants optimize RPC overhead.
内容的提问来源于stack exchange,提问作者stickers

