Infinite Resources for Optimistic Concurrency Control with NOCC - - PowerPoint PPT Presentation

infinite resources for optimistic concurrency control
SMART_READER_LITE
LIVE PREVIEW

Infinite Resources for Optimistic Concurrency Control with NOCC - - PowerPoint PPT Presentation

Infinite Resources for Optimistic Concurrency Control with NOCC Theo Jepsen, Leandro Pacheco de Sousa, Masoud Moshref, Fernando Pedone, Robert Soul Universit della Svizzera italiana (USI) and Barefoot Networks Why Do We Need Concurrency


slide-1
SLIDE 1

Infinite Resources for Optimistic Concurrency Control with NOCC

Theo Jepsen, Leandro Pacheco de Sousa, Masoud Moshref, Fernando Pedone, Robert Soulé

Università della Svizzera italiana (USI) and Barefoot Networks

slide-2
SLIDE 2

Why Do We Need Concurrency Control?

Account Balance $50 Deposit $100 Deposit $100 50 + 100 50 + 100 Account Balance $150

Should be $250

2

slide-3
SLIDE 3

Pessimistic Concurrency Control

Account Balance $50 Deposit $100 Deposit $100 Account Balance $150 Account Balance $250 50 + 100 150 + 100

Locks hurt concurrency

3

slide-4
SLIDE 4

Optimistic Concurrency Control

Account Balance $50 Account Balance $150 Account Balance $250 50 + 100 (if balance is still $50) Read balance Read balance 50 + 100 (if balance is still $50)

Abort!

150 + 100 (if balance is still $150)

Retry

4

$50 $50

slide-5
SLIDE 5

Pessimistic is better! OCC is better!

Pessimistic vs Optimistic Concurrency Control

OCC is better! It depends...

5

slide-6
SLIDE 6

Pessimistic vs Optimistic Concurrency Control

Pessimistic Optimistic Low contention High contention

6

Aborts reduce throughput

slide-7
SLIDE 7

OCC: Aborts are Expensive

7

Ideal OCC

more clients→contention→more aborts→lower tput

slide-8
SLIDE 8

OCC With Infinite Resources

  • What if we had infinite CPUs to abort transactions?
  • Hardware can process aborts virtually instantly
  • This hardware is already in the network

8

slide-9
SLIDE 9

Network OCC (NOCC)

  • Offload transaction verification to the switch
  • High parallelism for high-contention workloads
  • Reduces server load for workloads (like TPC-C)

9

slide-10
SLIDE 10

System Model

Balance $50

R() R() CMP(), W() CMP(), W()

10

cache cache

slide-11
SLIDE 11
  • Update cache with write values
  • Update cache with ABORT values
  • Early abort invalid transactions

cache

The NOCC Approach

Update ABORT(X) CMP(X) Abort W(X) Update

11

slide-12
SLIDE 12

R() R() CMP(50), W(150) ABORT(50)

NOCC Example

Balance $50

12

Balance $150

CMP(50), W(150) 150

50 50

slide-13
SLIDE 13

NOCC Correctness

  • Strong consistency:

○ Reads are not handled by switch – no stale reads

  • Liveness:

○ Transactions eventually commit

13

slide-14
SLIDE 14

Implementation

14

slide-15
SLIDE 15

Switch Implementation: Key Challenges

  • Storing cached values on the switch
  • Processing packet headers containing transactions

15

slide-16
SLIDE 16

Processing Transactions

  • Each transaction contains one or more operations:

○ read(), cmp(), write()

  • The P4 program iterates over the operations:

○ If invalid cmp(), abort transaction ○ If write(), update cache

  • P4 doesn’t have iteration primitives

○ So we recirculate the packet

16

slide-17
SLIDE 17

Switch Cache

  • We use SRAM registers
  • Values (128 bits) are too large for a single register

○ So we shard the value across multiple registers

Reg1 Reg2 Reg3 Reg4 val[0...31] val[32...63] val[64...95] val[95...128]

17

slide-18
SLIDE 18

Evaluation on Hardware

18

slide-19
SLIDE 19

Experimental Setup

  • Clients and store run on seperate servers
  • Connected via a Barefoot Tofino switch running NOCC
  • Evaluated with microbenchmarks and TPC-C

Client

19

slide-20
SLIDE 20

NOCC has Higher Throughput

20

slide-21
SLIDE 21

NOCC Reduces End-to-End Latency

21

slide-22
SLIDE 22

NOCC Reduces Aborts from the Store

Commits all transactions

22

slide-23
SLIDE 23

NOCC Reduces Server Load for TPC-C

23

slide-24
SLIDE 24

Minimal Throughput Overhead for TPC-C

24

slide-25
SLIDE 25

In Conclusion, NOCC...

  • Offloads transaction verification logic to the network
  • Provides high throughput under high contention
  • Reduces CPU load on the server

https://github.com/usi-systems/nocc

25

slide-26
SLIDE 26

Extra Slides

26

slide-27
SLIDE 27

Packet Header Format

header_type nocc_hdr_t { fields { bit<1> msg_type; // REQ/RES bit<1> from_switch; bit<32> txn_id; bit<8> frag_seq; bit<8> frag_cnt; bit<8> status; bit<8> op_cnt; } } header_type nocc_op_t { fields { bit<8> op_type; bit<32> key; bit<1024> value; } } The nocc_hdr is followed by a nocc_op header for each operation Number of following nocc_op headers

27