0
0
Microservicessystem_design~10 mins

Two-phase commit (and why to avoid it) in Microservices - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to identify the coordinator's first step in two-phase commit.

Microservices
The coordinator sends a [1] request to all participants to prepare for commit.
Drag options to blanks, or click blank then click option'
Aabort
Backnowledge
Cprepare
Dcommit
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 'commit' instead of 'prepare' as the first step.
2fill in blank
medium

Complete the code to describe what participants send back after prepare.

Microservices
Participants respond with a [1] message indicating if they can commit or not.
Drag options to blanks, or click blank then click option'
Aready
Bvote
Cacknowledge
Dcommit
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing 'acknowledge' with 'vote'.
3fill in blank
hard

Fix the error in the statement about two-phase commit's blocking problem.

Microservices
If the coordinator crashes after sending commit, participants may [1] indefinitely waiting for the final decision.
Drag options to blanks, or click blank then click option'
Aabort
Brollback
Ctimeout
Dblock
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 'abort' which is an action, not the problem.
4fill in blank
hard

Fill both blanks to describe why two-phase commit is often avoided in microservices.

Microservices
Two-phase commit is avoided because it [1] system availability and [2] complexity in distributed systems.
Drag options to blanks, or click blank then click option'
Areduces
Bincreases
Csimplifies
Dignores
Attempts:
3 left
💡 Hint
Common Mistakes
Saying it 'simplifies' complexity, which is incorrect.
5fill in blank
hard

Fill all three blanks to complete the alternative approach to two-phase commit.

Microservices
Instead of two-phase commit, microservices often use [1] which relies on [2] and [3] to maintain data consistency.
Drag options to blanks, or click blank then click option'
Aeventual consistency
Bsagas
Casynchronous messaging
Dtwo-phase locking
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing two-phase locking with two-phase commit.