二相コミット(Two-Phase Commit)とは?
Two-phase commit は、コーディネーターがまず各参加者に prepare を依頼して commit できるかどうかを投票させ、次のフェーズで投票に基づいて全員に commit または全員に abort を指示する分散プロトコルです。参加者が同じ結果に到達することを保証します。トレードオフは、参加者が待機中に lock を保持しなければならず、コーディネーターの障害が彼らをブロックさせ得ることです。
なぜ重要か
Two-phase commit は別々のデータベースやサービスをまたぐアトミシティを提供しますが、ブロッキングな性質とコーディネーターへの依存により重くなります。多くのシステムは、そのコストを避けるために saga や結果整合性を好みます。
関連ガイド
What Is a Distributed Transaction?A distributed transaction spans multiple databases or services and must either commit everywhere or roll back…
What Is the Saga Pattern?The saga pattern manages a long-running business process across services as a sequence of local transactions,…
What Is a Transaction Isolation Level?An isolation level sets how much one transaction can see of others in progress, trading consistency guarantee…