Top Banner
Fine-Grain Checkpointing with In-Cache-Line Logging Nachshon Cohen David T. Aksun Hillel Avni James R. Larus Previously published in Asplos 2019
19

with In-Cache-Line Logging Fine-Grain Checkpointing Hillel ...

Apr 05, 2022

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: with In-Cache-Line Logging Fine-Grain Checkpointing Hillel ...

Fine-Grain Checkpointing with In-Cache-Line Logging

Nachshon Cohen David T. AksunHillel Avni James R. Larus

Previously published in Asplos 2019

Page 2: with In-Cache-Line Logging Fine-Grain Checkpointing Hillel ...

Non-volatile

Background: Non-Volatile Memory (NVM)

Hard Disk

SSD

DRAM NVM

Processor

Page 3: with In-Cache-Line Logging Fine-Grain Checkpointing Hillel ...

Background: NVM Program Life Cycle

Run Crash Recover

NVM

Page 4: with In-Cache-Line Logging Fine-Grain Checkpointing Hillel ...

Non-volatile

Using NVM with Cache

NVM

Core

Cache

Caches are volatile!

Writes can be reordered!!!

Page 5: with In-Cache-Line Logging Fine-Grain Checkpointing Hillel ...

B+ tree

Building data structures for NVMput(key: 10, value 12)

B+ tree

valuesB+ node 3 7 4

keys8 10 12

valuesB+ node 3 12 4

key:10

Page 6: with In-Cache-Line Logging Fine-Grain Checkpointing Hillel ...

Non-volatile

Existing approaches● Checkpointing

○ seperate location○ long intervals

long interval

ex: x86 clflush/clflushopt instructionsfollowed by sfence/mfence

checkpointcheckpoint

● Logging○ log value during execution○ explicit persist instructions

snapshot

Page 7: with In-Cache-Line Logging Fine-Grain Checkpointing Hillel ...

A novel approach for library buildersGoal: Design a durable data structure with low durability overhead

avoid persist instructions in the critical path of the application

Faisal Nawab, et al., Dalí: A Periodically Persistent Hash Map, DISC 2017.

● In cache line log (our novel contribution)

● Fine-grained checkpointing (Periodic persistency)

Page 8: with In-Cache-Line Logging Fine-Grain Checkpointing Hillel ...

Non-volatileFine-grained Checkpointing● Flush entire cache hierarchy

○ checkpoint every 64ms (e.g., x86’s wbinvd instruction)

● Restore state to beginning of epoch (use log)

epoch 1 epoch 2 epoch 3

overhead: around % 2

snapshot

wbinvd wbinvd wbinvd

Page 9: with In-Cache-Line Logging Fine-Grain Checkpointing Hillel ...

Non-volatile

Use undo log for restoring state

put(key, value):entry = log(key, old value)persist(entry)update(key, value)

put(key: 10, value 12)

valuesB+ node 3 7 4

key:10

valuesB+ node 3 12 4

key:10 7

Can we do better?

Page 10: with In-Cache-Line Logging Fine-Grain Checkpointing Hillel ...

In cache line log (InCLL)

put(key: 10, value 12)

valuesB+ node 3 7 4

key:10 InCLL

valuesB+ node 3 7 4

key:10

7

InCLL

Put the log inside the same cache line as the modified data

valuesB+ node 3 12 4

key:10

7

InCLL

put(key, value):log(key, old value)update(key, value)

Page 11: with In-Cache-Line Logging Fine-Grain Checkpointing Hillel ...

How does InCLL avoid explicit persist instructions?

NVMCache

3 12 4

key:10

7

InCLL 3 7 4

key:10 InCLL

Case 2: Cache line is propagated to NVM

3 12 4

key:10

7

InCLL

Case 1: Cache line is lost

Page 12: with In-Cache-Line Logging Fine-Grain Checkpointing Hillel ...

InCLL Limitations● Limited size

3 12 4 7

InCLLput(key: 10, value 12)put(key: 12, value 6)put(key: 8, value 2)

Page 13: with In-Cache-Line Logging Fine-Grain Checkpointing Hillel ...

Non-volatile

External Undo Log● Deal with cases where InCLL is not enough● Log the entire node

○ the node will be modified within the epoch○ no need to log the same node more than once within an epoch○ requires explicit persist instructions to NVM

put(key: 12, value 6)put(key: 8, value 2)

3 12 4 7

InCLL

3 12 4 7

InCLL

Page 14: with In-Cache-Line Logging Fine-Grain Checkpointing Hillel ...

First modification: use InCLL

Effective when modifications are sparse

● large tree● uniform key distribution

2+ modifications: use external undo log

Effective when modifications are dense

● node split● range of keys

InCLL and External Undo Log - Per Node Per Epoch

3 12 4 7

8 5

23 12

node 1

node 1M

node 1K

Non-volatile

3 12 4

Page 15: with In-Cache-Line Logging Fine-Grain Checkpointing Hillel ...

Best case

● Single popular key● Skewed key distribution

Worst case

● Updating two values only once● One persist operation per two

modifications

InCLL and External Undo Log - Per Node Per Epoch

Additional details in[Cohen et al., ASPLOS 2019]

Page 16: with In-Cache-Line Logging Fine-Grain Checkpointing Hillel ...

Evaluation● Modified Masstree [Mao et al., EuroSys 2012] internals

○ make Masstree durable (durable API: insert, get, remove, scan)○ make allocator durable (prevents dangling pointers, durable memory leaks)

● YCSB Workloads (Uniform and Zipfian Distribution)○ YCSB A (50% insert, 50% get)○ YCSB B (5% insert, 95% get)○ YCSB C (100% get)○ YCSB E (5% insert, 95% scan)

Page 17: with In-Cache-Line Logging Fine-Grain Checkpointing Hillel ...

YCSB Workload on Masstree (Persistent vs Volatile)

7%

8%6%

10%

8%

15% 14% 12%

Page 18: with In-Cache-Line Logging Fine-Grain Checkpointing Hillel ...

Effect of Tree Size on Performance

Page 19: with In-Cache-Line Logging Fine-Grain Checkpointing Hillel ...

ConclusionUse In Cache Line Log to avoid persist instructions

● fine-grained checkpointing● external log

● durability with small overhead

Questions?