Three Phase Commit
Three-phase commit protocol to avoid blocking in 2PC.
Three Phase Commit
Three-Phase Commit (3PC) is a distributed transaction protocol that adds a Pre-Commit phase to Two-Phase Commit to reduce blocking and improve fault tolerance.
Payment Service
Order Service
Inventory Service
create order
Deduct inventory
Process payment
Phase 1 — Prepare Phase
Phase 2 - Pre-Commit Phase
Phase 3 - Pre-Commit Phase
why pre-commit? 1. PreCommit exists to inform participants that everyone has agreed to commit, so if the coordinator crashes they can safely decide what to do. 2. important - timeout mechanism