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.