<<

Salt Combining ACID and BASE! in a distributed

Chao Xie, Chunzhi Su, Manos Kapritsos, Yang Wang,! Navid Yaghmazadeh, Lorenzo Alvisi, Prince Mahajan

The University of Texas at Austin TRANSACTIONS ARE GREAT

Four properties in a single abstraction

Atomicity Consistency Isolation Durability (ACID)

• Ease of programming

• Easy to reason about

Transaction TRANSACTIONS ARE GREAT

Txn Manager Data Nodes ! Write(x) Phase 1 limits performance Write(y)

Commit 2PC protocol is costly Phase 2 THE ALTERNATIVE: BASE

Application Storage Interface Transaction ACID Storage Guarantees THE ALTERNATIVE: BASE

• Write custom code to get better performance

Application Storage Interface BASE Storage (e.g., put, get) THE ALTERNATIVE: BASE

• Write custom code to get better performance

• Complexity gets out of control

Implement ApplicationApplicationConsistency Storage Interface BASE Storage (e.g., put, get) A STARK CHOICE

Ease of programming & Performance Performance BASE

ACID

Ease of programming 20% of the causes! account for! 80% of the effects

Vilfredo Pareto NOT ALL TRANSACTIONS ARE CREATED EQUAL

20% of the causes! account for! 80% of the effects

•Many transactions are not run frequently •Many transactions are lightweight AN OPPORTUNITY

Txn 1 Txn 2 BASE •Identify critical transactions

•BASE-ify only critical transactions SALT

Motivation!

Base Transactions & Salt Isolation!

Achieving Salt Isolation!

Evaluation MORE CONCURRENCY !

Transfer Part1 Transfer Is c≥$10?

Is c≥$10? c=c-$10 c=c-$10 Part2 s=s+$10 s=s+$10 MORE CONCURRENCY !

Time Transfer Transfer Is c≥$10? Part1 c=c-$10 Is c≥$10? s=s+$10 c=c-$10 Transfer

Transfer Part2 Part1 Is c≥$10? Is c≥$10? s=s+$10 c=c-$10 c=c-$10

s=s+$10 Part2 s=s+$10 CORRECTNESS AT RISK

Transfer

Balance Is c≥$10? Read c c=c-$10 Read s s=s+$10 CORRECTNESS AT RISK

Transfer Part1 Is c≥$10?

Balance c=c-$10 Exposed ! Read c state Read s Part2 s=s+$10 CORRECTNESS AT RISK Part1 Is c≥$10? c=c-$10

Balance Finer Isolation for one transaction! Read c may affect all transactions!! Read s

Part2 s=s+$10 Performance vs Complexity

Better Performance

More Interleavings!

More Complexity Performance vs Complexity

Better Performance

More Interleavings ! (only among perf-critical txns)

Other Transactions Unaffected Transfer 1 Transfer 2

Is c≥$10? Is c≥$10? Balance c=c-$10 c=c-$10 Read c Read s s=s+$10 s=s+$10

Behaves differently when interacting with different transactions Time Transfer 1 Is c≥$10?

c=c-$10 Transfer 2

Is c≥$10? s=s+$10 c=c-$10

s=s+$10

Balance Read c Read s BASE TRANSACTION

BASE transaction alkaline txn

alkaline txn

Behaves differently when interacting with different transactions BASE INTERACT WITH BASE

BASE BASE 1 2

Fine Isolation granularity! between BASE transactions BASE INTERACT WITH BASE

Fine Isolation granularity! between BASE transactions BASE INTERACT WITH ACID

BASE ACID

BASE transactions provide coarse Isolation! granularity to ACID transactions BASE INTERACT WITH ACID ACID

BASE

BASE transactions provide coarse Isolation! granularity to ACID transactions SALT ISOLATION

BASE transactions: multiple granularities of Isolation

To BASE transactions:! To ACID transactions:! a sequence of small ! a single, monolithic ! ACID transactions ACID transaction Performance & Ease of Programming SALT

Motivation!

Base Transactions & Salt Isolation!

Achieving Salt Isolation!

Evaluation ONE MECHANISM

LOCKS

Three flavors

ACID locks! Alkaline locks! Saline locks ACID LOCKS

ACID 1 AC-R AC-W Write x AC-R √ X

ACID 2 AC-W X X Read x Lock Execute LOCKS?

BASE

Wx BASE Rx

Execute ACID Rx Execute LOCKS?

BASE alkaline lock Wx BASE saline lock Rx

Execute ACID Rx Execute ALKALINE LOCKS alkaline lock

BASE BASE ACID AC-R AC-W alk-R alk-W Wx Rx Rx AC-R √ X √ X AC-W X X X X Wait Wait alk-R √ X √ X alk-W X X X X

Lock Table Conflict with ACID & alkaline locks SALINE LOCKS saline lock

BASE AC-R AC-W alk-R alk-W sal-R sal-W AC-R √ X √ X √ X Wx AC-W X X X X X X alk-R √ X √ X √ √ ACID alk-W X X X X √ √ Rx sal-R √ X √ √ √ √ sal-W X X √ √ √ √ Wait Lock Table Conflict only with ACID locks A SUBTLE PROBLEM

BASE

W x BASE

R x y=x ACID R y Dirty Read!

ACID reads uncommitted value of x! A SUBTLE PROBLEM

BASE

W x BASE

R x y=x ACID R y Dirty Read!

For the solution, please read our paper THE BOTTOM LINE

Guarantee! Salt prevents all ACID transactions from being affected by BASE transactions either directly or indirectly. SALT

Motivation!

Base Transactions & Salt Isolation!

Achieving Salt Isolation!

Evaluation QUESTIONS TO ANSWER

What is the performance gain of Salt compared to ACID?

Can we get most performance gain compared to the BASE approach? EXPERIMENTAL SETUP

Configuration! • Emulab Cluster (Dell Power Edge R710)! • 10 shards, 3-way replicated! Workloads! • TPC-C! • Fusion Ticket! • Microbenchmarks PERFORMANCE GAIN Fusion Ticket 250 200 Salt 150 ACID 100

Latency (ms) Latency 6.5X 50

0 0 1000 2000 3000 4000 5000 6000 7000 8000 Throughput (transactions/sec) REAP MOST PERFORMANCE OF BASE

Fusion Ticket 10000 8000 6000 6.5X 7.2X 4000 … … 2000 0 Throughput(transactions/sec) ACID 1 2 3 Raw ops Number of BASE-ified transactions RELATED WORK

Optimizing ACID Performance! • H-Store, Granola, F1, Sagas, Transaction Chain, Calvin …!

! BASE with enhanced semantics (e.g., local transactions)! • ElasTras, G-Store, Megastore … SALT

Pain Point Key Abstraction! Promising! Transactional systems ! Base Transaction do not scale Results