1. Home
  2. Explore
  3. Computer Science
  4. Paxos Consensus Algorithm

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Paxos Consensus Algorithm

  • 49Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Consensus Foundations
  • spaceFlip card
  • KI knew it
  • DI didn't know it
  • ←Previous card
  • →Next card

What is Paxos, and what does it mean that Paxos is a “family” of algorithms?

Tap to flipClick to flipspace

Paxos is a family of distributed algorithms used to reach consensus; the cards here describe vanilla Paxos.

Or swipe the card

49 cards

  1. What is Paxos, and what does it mean that Paxos is a “family” of algorithms?

    Paxos is a family of distributed algorithms used to reach consensus; the cards here describe vanilla Paxos.

  2. What does reaching consensus mean in Paxos?

    Consensus means agreeing on one result. In Paxos, a value is considered chosen when a majority of acceptors accepts it.

  3. Must a Paxos consensus value be one of the participants’ original preferred proposals?

    The participants need to agree on a result, not necessarily on any participant’s original proposal. They may change their minds to reach agreement.

  4. What role does a majority play in Paxos consensus?

    A majority is more than half of the acceptors. Once a majority accepts the same value, that value has reached consensus.

  5. Why is the fact that any two majorities overlap important in Paxos?

    Any two majorities overlap in at least one acceptor. This overlap helps prevent conflicting proposals from both succeeding.

  6. What does it mean for communication channels in Paxos to be faulty?

    Communication channels may be faulty: messages can be delayed or lost. Paxos must work despite such communication failures.

  7. Does every participant necessarily learn a Paxos consensus value immediately?

    Consensus may take time to reach and become known. Participants can learn the result by asking around or receiving information from other nodes.

  8. Why might a service move from one computer to a distributed system?

    A single computer has limited capacity. A growing service may need multiple nodes to share work and data, which introduces the need to coordinate their decisions.

  9. How does a leader-and-replicas system work, and when might it need consensus?

    A leader receives proposals, serializes them, and sends them to replicas. If the leader becomes unavailable, the nodes need consensus to elect a replacement.

  10. How does a peer-to-peer system differ from a leader-and-replicas system?

    In a peer-to-peer system, nodes have equivalent roles and coordinate proposals with one another so operations can be applied in the same order.

  11. Why do both leader-based and peer-to-peer systems need consensus?

    A leader-and-replicas system may need consensus to elect a new leader; a peer-to-peer system needs ongoing consensus to order operations consistently.

  12. What are the three Paxos roles?

    Proposers suggest values, acceptors participate in deciding whether a value is chosen, and learners find out the chosen value.

  13. What does a proposer do in Paxos?

    Proposers send proposals to try to reach consensus on a value.

  14. What does an acceptor do in Paxos?

    Acceptors respond to proposals and contribute to determining whether a value has been chosen.

  15. What does a learner do in Paxos?

    Learners receive accepted-value information and can determine the consensus value; they may later be queried for it.

  16. Must each Paxos node have exactly one role?

    A single node can act as proposer, acceptor, and learner, or take any combination of these roles.

  17. What persistence assumption does vanilla Paxos make about acceptors?

    Acceptors must persist what they have accepted. Vanilla Paxos assumes they do not forget accepted information, even if communication fails.

  18. Can one Paxos run repeatedly change its consensus value?

    A single Paxos run can choose only one value. To change the value over time, the system must run Paxos again.

  19. What is the difference between a Paxos proposal ID and its proposed value?

    The proposal ID identifies and orders a proposal; it is an internal Paxos artifact, not the consensus value exposed to the application.

  20. What property must Paxos proposal IDs have, and how could proposers help ensure it?

    Proposal IDs must be unique and never reused. For example, proposers can use separate sequences such as odd IDs for one proposer and even IDs for another.

  21. What is the first message a proposer sends in a Paxos run?

    A proposer sends a PREPARE message containing its ID to a majority or to all acceptors.

  22. How does an acceptor respond to an eligible PREPARE request?

    If an acceptor receives a prepare request with an ID it has not already promised to reject, it promises not to accept proposals with lower IDs and replies with PROMISE for that ID.

  23. What does an acceptor do when a PREPARE request conflicts with its existing promise?

    If an acceptor has already promised to reject a request with that ID, it ignores the request rather than making a new promise for it.

  24. Why can’t a lower-ID proposal obtain a majority after a higher-ID proposal has received a majority of promises?

    Once a majority has promised for an ID, no lower ID can receive promises from a majority: the two majorities would overlap, and at least one acceptor would reject the lower ID.

  25. What should a proposer do after a timeout?

    If a proposer times out, it retries with a new, higher proposal ID.

  26. What does a proposer do after obtaining a majority of promises?

    After receiving PROMISE responses from a majority, the proposer sends ACCEPT REQUEST with its proposal ID and a value to a majority or all acceptors.

  27. How may a proposer choose a value when none of its PROMISE responses reports a previously accepted value?

    If the proposer has received no previously accepted value in the promises, it may choose any value it wants to propose.

  28. How must a proposer choose its value when PROMISE responses include previously accepted values?

    If any PROMISE response reports an accepted value, the proposer must use the value associated with the highest accepted ID reported.

  29. If a proposer receives a promise for ID 666 that reports value “cat” accepted under ID 555, what value must it put in its ACCEPT REQUEST?

    The proposer uses its new proposal ID but carries forward the previously accepted value with the highest ID.

  30. How does an acceptor handle an ACCEPT REQUEST?

    An acceptor that has not promised to reject the request’s ID can accept it and send ACCEPT with that ID and value to the proposer and learners. Otherwise, it ignores the request.

  31. At what point is consensus reached in a Paxos run?

    Consensus is reached when a majority of acceptors accepts the same value.

  32. How can a proposer or learner know that consensus has been reached?

    A proposer or learner that receives ACCEPT messages from a majority for a value knows that value has reached consensus.

  33. What are the three sequential milestones of a Paxos run?

    A majority of acceptors promises for an ID; a majority accepts an ID and value, choosing the value; then a proposer or learner learns the result by receiving a majority of ACCEPT messages.

  34. Can a lower-ID proposer receive any PROMISE response after a higher ID has obtained a majority?

    If a higher-ID proposal has already obtained a majority of promises, a lower-ID proposal cannot obtain its own majority. It may receive an isolated promise, but cannot make it through.

  35. What value can a higher-ID proposal choose after another value has already reached consensus?

    After a value has been accepted by a majority, a later higher-ID proposal may still proceed, but it must carry forward that accepted value.

  36. What safety protections follow from the promise and acceptance majorities?

    A majority of promises for a higher ID blocks a lower-ID proposal from succeeding. A majority of accepts chooses a value, and later higher-ID proposals must preserve it.

  37. How can a proposer learn a consensus value if it missed the original majority of ACCEPT messages?

    A later proposer can discover a previously chosen value through the value piggybacked in PROMISE responses, then propose that value under its own higher ID.

  38. How can multiple proposers cause contention in a Paxos run?

    Concurrent proposers can repeatedly obtain promises with successively higher IDs, invalidating one another’s attempts before any proposal finishes.

  39. What can happen if competing proposals repeatedly supersede one another?

    Repeated contention can create hotspots and delay or stall the Paxos run because proposals keep superseding one another.

  40. How can exponential backoff help resolve Paxos contention?

    Exponential backoff makes a proposer wait progressively longer before retrying, giving another proposer a chance to complete its proposal.

  41. How can a lagging proposer catch up with a value already chosen by the Paxos group?

    A proposer that missed the earlier ACCEPT messages can issue a higher-ID PREPARE. Acceptors report the prior accepted value in their promises, forcing the proposer to carry that value forward.

  42. How can Paxos support data that changes over time despite choosing only one value per run?

    Paxos chooses only one value per run, so a changing state is represented by a replicated log with a separate consensus run for each successive log position.

  43. How can a replicated log represent a bank account’s initial state and later changes?

    Log position 000 can record the account’s initial state. Each later change, such as a deposit or withdrawal, is recorded at a new log position.

  44. How might a $50 deposit be represented in a replicated bank-account log?

    A deposit of $50 can be recorded as a new log entry, such as “User Luis: +$50.” The resulting balance may also be included as an efficiency measure.

  45. How can a later withdrawal be represented in a replicated bank-account log?

    A withdrawal is recorded at a later log position. For example, after a $50 deposit leaves the balance at $150, a $20 withdrawal can record a balance of $130.

  46. How does a client interact with the Paxos-based storage system?

    A client contacts a storage server to read data or propose a write. The server can act as proposer, while the replica servers act as acceptors and learners as well.

  47. In a three-replica storage system, how many acceptors must accept a value for consensus?

    With three acceptors, a majority is two. If two acceptors accept the proposed value, consensus is reached and the value can be written and propagated.

  48. Must every replica write a chosen value at the same time?

    All replicas do not have to write the value immediately. A lagging replica can later catch up through a recovery mechanism or learn the value during a later Paxos proposal.

  49. How can a lagging replica learn an earlier log value during a later Paxos run?

    A lagging replica can participate in a later proposal for the next log position. The earlier accepted value is reported in the promises, allowing the replica to learn and apply it.

Card 1 of 49
Card 1 of 49

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent