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
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
Università della Svizzera italiana (USI) and Barefoot Networks
Account Balance $50 Deposit $100 Deposit $100 50 + 100 50 + 100 Account Balance $150
Should be $250
2
Account Balance $50 Deposit $100 Deposit $100 Account Balance $150 Account Balance $250 50 + 100 150 + 100
Locks hurt concurrency
3
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
Pessimistic is better! OCC is better!
OCC is better! It depends...
5
Pessimistic Optimistic Low contention High contention
6
Aborts reduce throughput
7
Ideal OCC
more clients→contention→more aborts→lower tput
8
9
Balance $50
R() R() CMP(), W() CMP(), W()
10
cache cache
cache
Update ABORT(X) CMP(X) Abort W(X) Update
11
R() R() CMP(50), W(150) ABORT(50)
Balance $50
12
Balance $150
CMP(50), W(150) 150
50 50
○ Reads are not handled by switch – no stale reads
○ Transactions eventually commit
13
14
15
○ read(), cmp(), write()
○ If invalid cmp(), abort transaction ○ If write(), update cache
○ So we recirculate the packet
16
○ 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
18
Client
19
20
21
Commits all transactions
22
23
24
https://github.com/usi-systems/nocc
25
26
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