sys0Early access
Back to your course

Part 1 · Foundations

Part 2 · Distributed systems

  1. Overview6 lessons · 96 min
  2. 1Isolation levelsRead
  3. 2Outbox and change data captureRead
  4. 3Two-phase commitRead
  5. 4SagasRead
  6. 5Locks, leases and fencing tokensRead
  7. 6Lab: Order sagaLab

Part 3 · Under the hood

sys0Early access

Module 16 / Transactions across services / Overview

Module 16 6 lessons 96 min

Transactions across services

The payment is charged, then the restaurant service crashes before saving the order. The customer has paid, the restaurant doesn't know about the order, and each database is internally consistent.

In this module

5 Read · 1 Lab

  1. 16.1Isolation levelsLost updates and write skew within one database, before adding more.Read15 min
  2. 16.2Outbox and change data captureSave to the database and publish an event reliably, without losing either.Read12 min
  3. 16.3Two-phase commitCommit across two databases, why it can get stuck, and why services rarely use it.Read12 min
  4. 16.4SagasA sequence of local transactions with compensating steps: refund the payment if no restaurant accepts the order.Read15 min
  5. 16.5Locks, leases and fencing tokensDistributed locks with etcd or ZooKeeper, and fencing tokens to make them safe.Read12 min
  6. 16.6Lab: Order sagaRun an order across payment, restaurant and rider services, crash each one in turn, and make sure no customer is charged for an order that won't be delivered.Lab30 min
Start with 16.1 · Isolation levels
Then · Module 17Events and streams