It's a complex topic in itself. Sometimes even seasoned professionals misunderstand.
โข ๐ฎ๐ฃ๐ - atomic but blocking, commit or abort in two steps.
โข ๐ฏ๐ฃ๐ - splits commit into two, reduces blocking and handles partial failures.
โข ๐ฆ๐ฎ๐ด๐ฎ - a sequence of local transactions that breaks a transaction into multiple steps.
๐ช๐ต๐ฒ๐ป ๐๐ผ ๐๐๐ฒ ๐ฎ-๐ฃ๐ต๐ฎ๐๐ฒ ๐๐ผ๐บ๐บ๐ถ๐
โ When strict consistency is needed, all participants commit or abort.
โ For simple, low-latency systems with minimal crash risk.
๐๐
๐ฎ๐บ๐ฝ๐น๐ฒ: ๐๐ฎ๐ป๐ธ ๐๐๐ป๐ฑ ๐ง๐ฟ๐ฎ๐ป๐๐ณ๐ฒ๐ฟ ๐๐ฒ๐๐๐ฒ๐ฒ๐ป ๐๐ฐ๐ฐ๐ผ๐๐ป๐๐ ๐ถ๐ป ๐๐ต๐ฒ ๐ฆ๐ฎ๐บ๐ฒ ๐๐ฎ๐ป๐ธ
โข Transfer involves debiting one account and crediting another.
โข If one fails, the entire transaction must rollback.
โข Atomicity is a must, and latency is acceptable.
๐ช๐ต๐ฒ๐ป ๐๐ผ ๐๐๐ฒ ๐ฏ-๐ฃ๐ต๐ฎ๐๐ฒ ๐๐ผ๐บ๐บ๐ถ๐
โ When minimizing blocking is key, and partial failures must be avoided.
โ Where fault tolerance takes priority over message overhead and complexity.
๐๐
๐ฎ๐บ๐ฝ๐น๐ฒ: ๐๐ฟ๐ผ๐๐-๐ฅ๐ฒ๐ด๐ถ๐ผ๐ป ๐๐ฒ๐ฑ๐ด๐ฒ๐ฟ ๐ฆ๐๐ป๐ฐ๐ต๐ฟ๐ผ๐ป๐ถ๐๐ฎ๐๐ถ๐ผ๐ป
Synchronizing transaction records between European and Asian data centers.
โข Each region prepares and pre-commits.
โข Final commit is sent when all regions are ready.
โข Handles network partition or coordinator crash more gracefully than 2PC.
๐ช๐ต๐ฒ๐ป ๐๐ผ ๐๐๐ฒ ๐ฆ๐ฎ๐ด๐ฎ
โ Performance matter more than strict consistency
โ Long-running distributed transactions where full rollback isn't practical
๐๐
๐ฎ๐บ๐ฝ๐น๐ฒ: ๐๐ป๐๐ฒ๐ฟ๐ป๐ฎ๐๐ถ๐ผ๐ป๐ฎ๐น ๐๐๐ป๐ฑ ๐ง๐ฟ๐ฎ๐ป๐๐ณ๐ฒ๐ฟ (๐ฆ๐ช๐๐๐ง)
Transferring funds from a bank in Germany to one in Singapore via SWIFT or similar clearing systems.
โข Debit sender โ Local transaction
โข Notify intermediary โ Local transaction
โข Credit receiver โ Local transaction
โข If the final step fails, compensation (e.g., refund sender) is triggered.