42
Write-Optimized Dynamic Hashing for Persistent Memory โธธ , โ„Ž โธน , ๏ผ โ„Ž โธธ , . โ„Ž โธธ , โธน UNIST (Ulsan National Institute of Science and Technology) โธธ Sungkyunkwan University () โธน 1

Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

  • Upload
    others

  • View
    12

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

Write-Optimized Dynamic Hashing for Persistent Memory

๐‘ด๐’๐’๐’‰๐’š๐’†๐’๐’ ๐‘ต๐’‚๐’Žโธธ, ๐ป๐‘œ๐‘˜๐‘’๐‘ข๐‘› ๐ถโ„Ž๐‘Žโธน, ๐‘Œ๐‘œ๐‘ข๐‘›๐‘”๏ผ๐‘Ÿ๐‘– ๐ถโ„Ž๐‘œ๐‘–โธธ, ๐‘†๐‘Ž๐‘š ๐ป.๐‘๐‘œโ„Žโธธ, ๐ต๐‘’๐‘œ๐‘š๐‘ ๐‘’๐‘œ๐‘˜ ๐‘๐‘Ž๐‘šโธน

UNIST (Ulsan National Institute of Science and Technology)โธธ

Sungkyunkwan University (๐‘†๐พ๐พ๐‘ˆ)โธน

1

Page 2: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

Backgroundโ€ข Static Hashing

โ€ข Extendible Hashing

โ€ข Persistent Memory

Cacheline-Conscious Extendible Hashingโ€ข Challenges and Contributions

โ€ข 3-Level Structure of CCEH

โ€ข Failure-atomic Directory Update

Evaluation

Conclusion

2

Outline

Page 3: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

โ€ข Hash key collision โ†’ Full table rehashingโ€ข The most expensive operation in hash table

Background:

Static Hashing

0011

&val3

H(key) =

key % size

[0]

[1]

[2]

[3]

[4]

[5]

[6]

[7]

1001 &val9

1011 &val11

0100 &val4

1101 &val13

0111 &val7

3

[0]

[1]

[2]

[3]

[4]

[5]

[6]

[7]

0011 &val3

0100 &val4

0111 &val7

[8]

[9]

[A]

[B]

[C]

[D]

[E]

[F]

1001 &val9

1001 &val11

1101 &val13

Rehash

Hash Collision

Page 4: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

Linear Probing

โ€ข To avoid full table rehashing: โ€ข Linear probingโ€ข Chainingโ€ข Double hashing such as Cuckoo hashing

Background:

Static Hashing

0011

&val3

H(key) =

key % size

4

[0]

[1]

[2]

[3]

[4]

[5]

[6]

[7]

1001 &val9

1011 &val11

0100 &val4

1101 &val13

0011 &val3

0111 &val7

Page 5: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

Chaining

โ€ข To avoid full table rehashing: โ€ข Linear probingโ€ข Chainingโ€ข Double hashing such as Cuckoo hashing

Background:

Static Hashing

0011

&val3

H(key) =

key % size

5

0011 &val3

[0]

[1]

[2]

[3]

[4]

[5]

[6]

[7]

1001 &val9

1011 &val11

0100 &val4

1101 &val13

0111 &val7

Page 6: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

โ€ข To avoid full table rehashing:โ€ข Linear probingโ€ข Chainingโ€ข Double hashing such as Cuckoo hashing

Background:

Static Hashing

0011

&val3

H(key) =

key % size

6

Cuckoo Displacement

[0]

[1]

[2]

[3]

[4]

[5]

[6]

[7]

1001 &val9

0011 &val3

0100 &val4

1101 &val13

1011 &val11

0111 &val7

Cuckoo Hashing

Page 7: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

7

Insertion Latency CDF

Flat Horizontal Lines

Because of the expensive full-table rehashing

Page 8: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

0001 &val1

0111 &val7

1111 &val15

0101 &val5

โ€ข Dynamically splits one bucket or merges two buckets at a time

0010 &val2

0110 &val6

002 012 102 112

Background:

Disk-based Extendible Hashing

8

0000 &val0

1000 &val8

Directory

(G=2)

Buckets

L=2

Hash Function: H(key) = key % 2G

L=2 L=1

Page 9: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

0001 &val1

0111 &val7

1111 &val15

0101 &val5

0010 &val2

0110 &val6

002 012 102 112

Background:

Extendible Hashing โ€“ Insertion

0011

&val3

H(key) =

key % 2G

9

0000 &val0

1000 &val8Key

Value

Directory

(G=2)

Buckets

Hash Collision

L=2 L=1 L=2

Page 10: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

0001 &val1

0101 &val5

0111 &val7

1111 &val15

0001 &val1

0111 &val7

1111 &val15

0101 &val5

โ€ข Only overflown bucket is modified

0010 &val2

0110 &val6

002 012 102 112

Background:

Extendible Hashing โ€“ Bucket Split

0011

&val3

H(key) =

key % 2G

10

0000 &val0

1000 &val8Key

Value

Directory

(G=2)

Buckets

Bucket SplitL=2 L=1 L=2

Page 11: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

0010 &val2

0110 &val6

0001 &val1

0101 &val5

0111 &val7

1111 &val15

002 012 102 112

Background:

Extendible Hashing โ€“ Bucket Split

0011

&val3

H(key) =

key % 2G

11

0000 &val0

1000 &val8

0011 &val3

Key

Value

Directory

(G=2)

Buckets

Update Directory

โ€ข Update Directoryโ€ข At least two pointers need to be updated

012 112

L=2 L=2

L=2 L=2

Page 12: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

0111 &val7

1011 &val11

1111 &val15

0011 &val3

002 012 102 112

Background:

Extendible Hashing โ€“ Directory doubling

โ€ข If a single pointer points to overflow bucketโ†’ Directory Doubling

11011

&val27

H(key) =

key % 2G

12

0000 &val0

1000 &val8

0001 &val1

0101 &val5Key

Value

Buckets

Directory

(G=2)

Hash Collision

L=1 L=2 L=2

Page 13: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

1011 &val11

0011 &val3

0111 &val7

1111 &val15

0111 &val7

1011 &val11

1111 &val15

0011 &val3

002 012 102 112

Background:

Extendible Hashing โ€“ Directory doubling

โ€ข If a single pointer points to overflow bucketโ†’ Directory Doubling

11011

&val27

H(key) =

key % 2G

13

0000 &val0

1000 &val8

0001 &val1

0101 &val5Key

Value

Buckets

Directory

(G=2)

Bucket Split

L=1 L=2

L=2

Page 14: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

โ€ข If a single pointer points to overflow bucketโ†’ Directory Doubling

0111 &val7

1011 &val11

1111 &val15

0011 &val3

1011 &val11

0011 &val3

002 012 102 112002 012 102 1120002 0012 0102 0112 1002 1012 1102 1112

Background:

Extendible Hashing โ€“ Directory doubling

11011

&val27

H(key) =

key % 2G

14

0000 &val0

1000 &val8

0001 &val1

0101 &val5Key

Value

Buckets

Directory

(G=2)

Directory

(G=3)

Directory Doubling

0111 &val7

1111 &val15

L=1 L=2

L=3 L=3

Page 15: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

โ€ข If a single pointer points to overflow bucketโ†’ Directory Doubling

1011 &val11

0011 &val3

Directory

(G=3)0002 0012 0102 0112 1002 1012 1102 1112

Background:

Extendible Hashing โ€“ Directory doubling

11011

&val27

H(key) =

key % 2G

15

0000 &val0

1000 &val8

0001 &val1

0101 &val5

11011 &val27

Key

Value

Buckets

Update Directory

0111 &val7

1111 &val15

L=1 L=2

L=3 L=3

Page 16: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

Persistent Memory

Characteristicsโ€ข High performance โ€“ Comparable to DRAM

โ€ข Byte-addressability โ€“ As DRAM

โ€ข Persistence โ€“ As storage devices (HDD/SSD)

Challengesโ€ข Atomic unit of writes โ†’ 8-bytes

โ€ข Data transfer unit between CPU cache and PM โ†’ 64 byte cacheline

โ€ข Order of memory writes is not guaranteed

16

Page 17: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

Backgroundโ€ข Static Hashing

โ€ข Extendible Hashing

โ€ข Persistent Memory

Cacheline-Conscious Extendible Hashingโ€ข Challenges and Contributions

โ€ข 3-Level Structure of CCEH

โ€ข Failure-atomic Directory Update

Evaluation

Conclusion

17

Outline

Page 18: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

Challenge in In-Memory Extendible Hashing

18

Problems

- Page-sized bucket โ†’ 64 cacheline accesses per bucket

Directory

(G=2)

Bucket

002 012 102 112

0000 &val0

1000 &val8

โ€ฆ โ€ฆ

โ€ฆ โ€ฆ

โ€ฆ โ€ฆ

โ€ฆ โ€ฆ

0110 &val6

0010 &val2

โ€ฆ

Cacheline 1

Cacheline 2

Cacheline 64

Cacheline 3

Cacheline 1

Cacheline 2

Cacheline 64

Cacheline 3

Cacheline 1

Cacheline 2

Cacheline 64

Cacheline 3

Page 19: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

Directory

(G=20)

Challenge in In-Memory Extendible Hashing

19

00..00Buckets

Problems

Cacheline-sized small bucket โ†’ a large directory (8 byte pointer per cacheline)

โ€ฆ

Cacheline-Size

โ€ฆโ€ฆ

โ€ฆ โ€ฆ โ€ฆ

โ€ฆ โ€ฆ โ€ฆโ€ฆ โ€ฆ

Page 20: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

Directory

(G=2)0002 0012 0102 0112

1001 &val11

0001 &val3

0111 &val7

1111 &val15

Challenge in Extendible Hashing on PM

20

0000 &val0

1000 &val8

0010 &val1

0110 &val5

11001 &val27

Buckets

Problems

Split operation updates multiple pointers โ†’ Not Failure-Atomic

Page 21: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

3-Level Structure โ†’ Introduces an intermediate level, Segment

โ†’ Lookup via only two cacheline accesses

Failure-atomic Directory Updatesโ†’ Introduces the split buddy tree to manage split history

Failure-atomic Segment Split โ†’ Lazy deletion scheme to minimize dirty writes

21

Contributions

Page 22: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

โ€ข A group of multiple cacheline-sized buckets = Segment

22

Segment: Intemediate Level

Directory

(G=20)

00..00Buckets โ€ฆ

Cacheline-Size

โ€ฆโ€ฆ

โ€ฆ โ€ฆโ€ฆ โ€ฆ

โ€ฆ โ€ฆ โ€ฆโ€ฆ โ€ฆ

Page 23: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

3-Level StructureDirectory โ†’ Segment โ†’ Cacheline-sized Bucket

23

Segment: Intemediate Level

Directory

(G=2)

00..00Buckets โ€ฆ

Cacheline-Size

โ€ฆโ€ฆ

โ€ฆ โ€ฆ

Using intermediate level โ€œSegmentโ€,

CCEH reduces directory size while keeping bucket size small

โ€ฆ โ€ฆ โ€ฆโ€ฆ โ€ฆ

Page 24: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

Q: With large segments, how can we minimize cacheline accesses?

24

Minimize Cacheline Accesses in Segment

002 012 102 112Directory

(G=2)

1000 &val8 Bucket 002

1001 &val9 Bucket 012

1010 &val10 Bucket 102

1011 &val11 Bucket 112

Segment 102

1100 &val12 Bucket 002

1101 &val13 Bucket 012

1110 &val14 Bucket 102

1111 &val15 Bucket 112

Segment 112

0000 &val0 Bucket 002

0001 &val1 Bucket 012

0010 &val2 Bucket 102

0011 &val3 Bucket 112

Segment 002

10012

Hash Key

Page 25: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

Q: With large segments, how can we minimize cacheline accesses?

25

Minimize Cacheline Accesses in Segment

002 012 102 112Directory

(G=2)

1000 &val8 Bucket 002

1001 &val9 Bucket 012

1010 &val10 Bucket 102

1011 &val11 Bucket 112

Segment 102

1100 &val12 Bucket 002

1101 &val13 Bucket 012

1110 &val14 Bucket 102

1111 &val15 Bucket 112

Segment 112

0000 &val0 Bucket 002

0001 &val1 Bucket 012

0010 &val2 Bucket 102

0011 &val3 Bucket 112

Segment 002

10 012

Hash Key

Page 26: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

26

Minimize Cacheline Accesses in Segment

002 012 102 112Directory

(G=2)

1000 &val8 Bucket 002

1001 &val9 Bucket 012

1010 &val10 Bucket 102

1011 &val11 Bucket 112

Segment 102

1100 &val12 Bucket 002

1101 &val13 Bucket 012

1110 &val14 Bucket 102

1111 &val15 Bucket 112

Segment 112

0000 &val0 Bucket 002

0001 &val1 Bucket 012

0010 &val2 Bucket 102

0011 &val3 Bucket 112

Segment 002

10 012

Hash Key

Segment Index

Bucket Index

Q: With large segments, how can we minimize cacheline accesses?

Page 27: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

27

Minimize Cacheline Accesses in Segment

002 012 102 112Directory

(G=2)10 012

Hash Key

1000 &val8 Bucket 002

1001 &val9 Bucket 012

1010 &val10 Bucket 102

1011 &val11 Bucket 112

Segment 012

1100 &val12 Bucket 002

1101 &val13 Bucket 012

1110 &val14 Bucket 102

1111 &val15 Bucket 112

Segment 112

0000 &val0 Bucket 002

0001 &val1 Bucket 012

0010 &val2 Bucket 102

0011 &val3 Bucket 112

Segment 002Use hash key as index for both directory and segment

โ†’ No need to access irrelevant buckets

Page 28: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

3-Level Structure โ†’ Introduces an intermediate level, Segment

โ†’ Lookup via only two cacheline accesses

Failure-atomic Directory Updatesโ†’ Introduces the split buddy tree to manage split history

Failure-atomic Segment Split โ†’ Lazy deletion scheme to minimize dirty writes

28

Contributions

Page 29: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

(G=3)Directory

L=1

L=1

L=1

L=1

L=2

L=2

L=2

L=2

L=2

L=2

L=3

L=3

29

S1 S1

S2

S1

S2

S3 S3

S4

Depth: 0 1 2 3

Global Depth:

S1

S1

S1

S2

S3

S4

S2

SPLITS5

(1) Update a directory entry

(2) Update a directory entry

(3) Update local depth of S1

S5

S5

S1

Using MSB segment index, split segments are pointed by adjacent directory entries

Recovery: Split History Buddy Tree in CCEH

Page 30: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

L=1L=2

(G=3)Directory

L=1

L=1

L=1

L=2

L=2

L=3

L=3

S1S5

S1

Suppose a system crashes while S5 splits

30

Recovery: Split History Buddy Tree in CCEH

S1 S1

S2

S1

S2

S2

S3

S1

S3

S4

S1

S2

S3

S4

S5

Depth: 0 1 2 3

Global Depth:

S2

Page 31: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

L=2

L=1

L=1

L=1

L=2

L=2

L=3

L=3

(G=3)Directory

S1S5

S1

31

S1 S1

S2

S1

S2

S2

S3

S1

S3

S4

S1

S2

S3

S4

S5

Depth: 0 1 2 3

Global Depth:

S2

๐‘บ๐’•๐’“๐’Š๐’…๐’† = ๐Ÿ๐†โˆ’๐‹

โ€ข Each segment must be pointed by ๐Ÿ๐†โˆ’๐‹ directory entries

โ€ข If not, rollback the split

Global Depth G = 3

Local Depth L = 1

Stride = 4

Recovery: Split History Buddy Tree in CCEH

Page 32: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

L=2L=1

L=1

L=1

L=1

L=2

L=2

L=3

L=3

(G=3)Directory

S1S5

S1

32

S1 S1

S2

S1

S2

S2

S3

S1

S3

S4

S1

S2

S3

S4

S5

Depth: 0 1 2 3

Global Depth:

S2

S1

๐‘บ๐’•๐’“๐’Š๐’…๐’† = ๐Ÿ๐†โˆ’๐‹

Global Depth G = 3

Local Depth L = 1

Stride = 4

Recovery: Split History Buddy Tree in CCEH

โ€ข Each segment must be pointed by ๐Ÿ๐†โˆ’๐‹ directory entries

โ€ข If not, rollback the split

Page 33: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

3-Level Structure โ†’ Introduces an intermediate level, Segment

โ†’ Lookup via only two cacheline accesses

Failure-atomic Directory Updatesโ†’ Introduces the split buddy tree to manage split history

Failure-atomic Segment Split โ†’ Lazy deletion scheme to minimize dirty writes

33

Contributions

Page 34: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

002 012 102 112

Segment Split: Legacy CoW

Directory

34

Copy-on-Write Split

โ†’ Lock-Free Search is enabled 002 012

Local Depth = 1

002 01000 &val8

012 00001 &val1

102 01010 &val10

112 00011 &val3Segment 02

Local Depth = 2

002

012

102

112

Segment 002

Local Depth = 2

002

012

102

112

Segment 012

01000 &val8

00001 &val1

01010 &val10

00011 &val3

Page 35: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

Local Depth = 2

002

012

102

112

Segment 012

Local Depth = 1

002 01000 &val8

012 00001 &val1

102 01010 &val10

112 00011 &val3Segment 02

&val801000

01010 &val10

002 012 102 112

Segment Split: Lazy Deletion

Directory

35

Lazy Deletion

โ†’ Minimizes dirty writes002 012

Single

Cacheline-flush

invalidates all the

migrated data

Segment 002

Local Depth = 2

002 01000 &val8

012 00001 &val1

102 01010 &val10

112 00011 &val3

01000 &val8

01010 &val10

Page 36: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

Backgroundโ€ข Static Hashing

โ€ข Extendible Hashing

โ€ข Persistent Memory

Cacheline-Conscious Extendible Hashingโ€ข Challenges and Contributions

โ€ข 3-Level Structure of CCEH

โ€ข Failure-atomic Directory Update

Evaluation

Conclusion

36

Outline

Page 37: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

Experimental Setup

37

64GB of DDR3 DRAM

2x Intel Xeon Haswell-Ex E7-4809 v3โ†’ 8 cores, 2.0 GHz

โ†’ 20MB L3 cache

Quartz: A DRAM-based PM latency emulator

* To emulate write latency, we inject stall cycle after

each clflush instructions

CPU

Memory

PM

Workload 160 Million random number dataset

Page 38: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

CCEH VS Legacy Extendible Hash

38

0

200

400

600

800

1000

1200

1400

256B 1KB 4KB 16KB 64KB 256KB

Th

rou

gh

pu

t (O

ps/m

sec)

Segment Size for CCEH/Bucket Size for Extendible Hash

0

0.5

1

1.5

2

2.5

3

3.5

4

256B 1KB 4KB 16KB 64KB 256KB

Segment Size for CCEH/Bucket Size for Extendible Hash

Avg

. # o

f clf

lush

CCEH Extendible Hashing

CCEH compared to legacy Extendible Hashing

Cons: Low utilization and more cacheline flushes due to hash collisions

Pros: Constant number of cacheline accesses with varying directory size

Page 39: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

Insertion Performance Breakdown

39

0

0.5

1

1.5

2

2.5

3

3.5

4

CCEH CCEH(C) CUCK LEVL PATH

0

0.5

1

1.5

2

2.5

3

3.5

4

CCEH CCEH(C) CUCK LEVL PATH

Write Rehash Cuckoo Displacement

R:120ns/W:120ns

(DRAM)

R:240ns/W:700ns

Avg

. E

xec.

Tim

e (

usec)

CCEH is 70% faster than Level Hashing (OSDIโ€™18) on PM

Fewer # of cacheline accesses

Lazy deletion โ†’ Efficient segment split

Page 40: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

0

10

20

30

40

50

60

70

80

90

100

0 100 200 300 400 500 600 700 800 900

40

Load Factor

Number of Records (k)

Lo

ad

Facto

r (%

)CCEH (K=4) CCEH (K=64) Level Hashing

Level Hashing

Suffer from full table rehashing like the other static hashing

CCEH

Dynamic allocation of small segments โ†’ Smooth curves

CCEH (Optimization)

K = Linear probing distance in Segment

Page 41: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

Cacheline-Conscious Extendible Hashing (CCEH) โ€ข 3-Level Structure

โ€ข Introduced an intermediate level, Segment

โ€ข Constant Lookup: Only two cacheline accesses โ†’ Write-Optimal

โ€ข Failure-Atomic Write-Optimal Lazy Deletion โ†’ Minimize I/O

โ€ข Failure-Atomic Directory Updates โ†’ Log-less directory update

Disk-based hashing needs to be modified for PM to make effective use of cachelines.

Source Codes: http://github.com/DICL/CCEH

Conclusion

41

Page 42: Write-Optimized Dynamic Hashing for Persistent Memory...Write-Optimized Dynamic Hashing for Persistent Memory ๐’š ๐’‚ , ๐ป ๐‘˜๐‘’๐‘ข โ„Ž๐‘Ž , ๐‘Œ ๐‘ข ๐‘”๏ผ ๐‘– โ„Ž ๐‘–

Question?