Try
↑ ↓ move↵ openesc close

Interview prep / Two-phase commit

Senior · Two-phase commit · System design interview question

Why is three-phase commit rarely used, even though it avoids blocking?

Sketch your own answer first, then compare it with the one below.

A strong answer

Three-phase commit adds a pre-commit round, so no participant is ever unsure in a way that forces it to wait. If the coordinator fails, the others can elect a new one and finish, using timeouts to decide.

The protocol assumes a network that does not partition and timeouts that are always correct. In a real network a slow link looks like a crash. Two groups can reach different decisions, so it can break atomicity. It also adds a round trip to every commit.

Paxos-based commit gets the nonblocking behaviour with a sound assumption. The commit decision is stored in a replicated log that survives the failure of a minority. That is the line of work to cite.

Sources

Learn it by running it

The two-phase commit lesson explains the mechanism behind this question, and its lab lets you change the parameters and watch the effect.

Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms