1 of 28

Distributed Transaction

Case Study @

101

2 of 28

Why Change the Topic?

Billing/Payment Systems

3 of 28

Scope

  • Microservices
  • Distributed Storages
  • Machine Learning

4 of 28

Prerequisite

  • What is transactions in RDBMS
  • What is consensus algorithms

5 of 28

Content

  • What is dist transactions?
  • Challenges in distributed transactions
  • Solutions 0 - 4
  • Cases Study

6 of 28

Transaction

A transaction is a single unit of logic or work, sometimes made up of multiple operations -

  • To provide reliable units of work.
  • To provide isolation between programs accessing a database concurrently.

7 of 28

Transaction

A transaction is a single unit of logic or work, sometimes made up of multiple operations -

  • To provide reliable units of work.
  • To provide isolation between programs accessing a database concurrently.

8 of 28

Transaction

A database transaction, by definition, must be -

ACID

9 of 28

ACID

  • Atomicity - Transaction steps are indivisible
  • Consistency - A transaction should only bring the database from one valid state to another valid state
  • Isolation - Multiple concurrently transactions should be able to run without interference
  • Durability - Persisted and survive failures

10 of 28

Isolation Levels - Serializability

11 of 28

Dist Transaction

12 of 28

How about the timing?

Serializability is a property of multiple operations executed in arbitrary order.

How about the timing?

13 of 28

Timing is not important

14 of 28

Timing is important!

15 of 28

Timing is important!

16 of 28

Solutions 0

2 Phase Commit -

17 of 28

Solutions - 1

Base -

  • Basically Available
  • Soft State
  • Eventually Consistent

18 of 28

Solutions - TCC

TCC

19 of 28

Solutions - SAGA

SAGA

20 of 28

Solutions - 2

Dist SQL

21 of 28

Solutions - Spanner

Spanner

22 of 28

Dist SQL

  • TiDB - TiDB Cloud
  • Cockroach - Cockroach Serverless
  • Yugabyte
  • NoSQL etc.

23 of 28

Solutions - 3

Deterministic Database

24 of 28

Solutions

Calvin

25 of 28

Solutions - 4?

Machine Learning

26 of 28

Solutions

Polyjuice

27 of 28

Case Study

28 of 28

Thank You!