Recall & Review
beginner
What is the Two-phase commit protocol?
Two-phase commit is a method used to ensure all parts of a distributed system agree to commit a transaction or all abort, maintaining data consistency.
Click to reveal answer
beginner
What are the two phases in the Two-phase commit protocol?
Phase 1: Prepare phase where all participants vote to commit or abort. Phase 2: Commit phase where the coordinator tells all participants to commit or abort based on votes.
Click to reveal answer
intermediate
Why is Two-phase commit considered a blocking protocol?
Because if the coordinator crashes after participants vote to commit but before sending the final decision, participants wait indefinitely, blocking resources.
Click to reveal answer
intermediate
Name one major drawback of using Two-phase commit in microservices.
It reduces system availability and scalability because services must lock resources and wait for the coordinator, causing delays and potential deadlocks.
Click to reveal answer
intermediate
What are some alternatives to Two-phase commit in microservices?
Alternatives include eventual consistency patterns like Saga, event-driven architectures, and compensating transactions to avoid blocking and improve scalability.
Click to reveal answer
What does the coordinator do in the first phase of Two-phase commit?
✗ Incorrect
In phase one, the coordinator asks all participants if they are ready to commit.
Why can Two-phase commit cause system blocking?
✗ Incorrect
Participants hold locks and wait for the coordinator's final commit or abort decision, causing blocking.
Which of the following is NOT a reason to avoid Two-phase commit in microservices?
✗ Incorrect
Two-phase commit reduces scalability, it does not improve it.
What is a common alternative to Two-phase commit for distributed transactions?
✗ Incorrect
Saga pattern manages distributed transactions with compensating actions and eventual consistency.
In Two-phase commit, what happens if a participant votes to abort during the prepare phase?
✗ Incorrect
If any participant votes to abort, the coordinator instructs all participants to abort the transaction.
Explain the Two-phase commit protocol and why it can cause problems in microservices.
Think about how waiting for a coordinator affects distributed services.
You got /4 concepts.
Describe alternatives to Two-phase commit and how they improve distributed transaction handling in microservices.
Consider patterns that avoid locking and blocking.
You got /4 concepts.