SmartCuckoo: A Fast and Cost-Efficient Hashing Index Scheme for - - PowerPoint PPT Presentation

smartcuckoo a fast and cost efficient hashing index
SMART_READER_LITE
LIVE PREVIEW

SmartCuckoo: A Fast and Cost-Efficient Hashing Index Scheme for - - PowerPoint PPT Presentation

SmartCuckoo: A Fast and Cost-Efficient Hashing Index Scheme for Cloud Storage Systems Yuanyuan Sun, Yu Hua, Song Jiang*, Qiuyu Li, Shunde Cao, Pengfei Zuo Huazhong University of Science and Technology *University of Texas, Arlington Presented


slide-1
SLIDE 1

SmartCuckoo: A Fast and Cost-Efficient Hashing Index Scheme for Cloud Storage Systems

Yuanyuan Sun, Yu Hua, Song Jiang*, Qiuyu Li, Shunde Cao, Pengfei Zuo Huazhong University of Science and Technology *University of Texas, Arlington

1

Presented in the USENIX ATC 2017

slide-2
SLIDE 2

Indexing services in cloud storage

n Large amounts of data

Ø

From small hand-held devices to large-scale data centers

Ø

44ZB in total, 5.2TB for each user in 2020 (IDC' 2014)

n Fast query services are important to both users and systems

Ø

Returning accurate results in a real-time manner

Ø

Improving system performance and storage efficiency

2

slide-3
SLIDE 3

The importance of hash tables

n Hash tables are widely used in data stores and caches

Ø

Key-value stores, e.g., Memcached, Redis

Ø

Relational databases, e.g., MonetDB, HyPer

Ø

In-cache index (ICS 2014, MICRO 2015)

n Strengths:

Ø

Constant-scale addressing complexity ~O(1)

Ø

Fast query response

n Weakness:

Ø

Risk of high-latency for handling hashing collisions

n Cuckoo hashing

3

slide-4
SLIDE 4

Cuckoo hashing

n Kick-out operations: like cuckoo birds n Open addressing n Supporting fast lookups: O(1) time complexity n However, insertion latency can be very high and

unpredictable, especially

Ø when an endless loop occurs!

4

slide-5
SLIDE 5

How is an endless loop formed?

H1( ) a

1 2 3 4 5 6 7

5

slide-6
SLIDE 6

How is an endless loop formed?

a

1 2 3 4 5 6 7

H1( ) c

6

slide-7
SLIDE 7

How is an endless loop formed?

a

1 2 3 4 5 6 7

c H1( ) b H2( )

7

slide-8
SLIDE 8

How is an endless loop formed?

a

1 2 3 4 5 6 7

c T2 T1 b

8

slide-9
SLIDE 9

How is an endless loop formed?

a

1 2 3 4 5 6 7

c T2 T1 b d e H1( ) x H2( )

9

slide-10
SLIDE 10

How is an endless loop formed?

a

1 2 3 4 5 6 7

c T2 T1 b d e x

My alternative location

10

Kickout for empty buckets

slide-11
SLIDE 11

How is an endless loop formed?

a

1 2 3 4 5 6 7

c T2 T1 b d e x

My alternative location

11

Kickout for empty buckets

slide-12
SLIDE 12

How is an endless loop formed?

a

1 2 3 4 5 6 7

c T2 T1 b d e x

My alternative location

12

Kickout for empty buckets

slide-13
SLIDE 13

How is an endless loop formed?

a

1 2 3 4 5 6 7

c T2 T1 b d e x

My alternative location

13

a b d x

n An endless loop is formed. n Endless kickouts for any

insertion within the loop.

slide-14
SLIDE 14

Observations

n Endless loops widely exist in the Cuckoo hashing structures. Ø

More than 25% (cuckoo hashing with a stash)

n Loop ratio: the percentage of insertion failures due to loops

5 10 15 20 25 30 35 40 45 50 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 Loop Ratios (%) Load Factor RandomInteger MacOS DocWords

14

slide-15
SLIDE 15

Existing works

n ChunkStash @USENIX ATC’10

Ø

Collisions: resursive strategy to relocate one of keys in candidates

Ø

Loops: an auxiliary linked list (or, hash table)

n MemC3 @NSDI’13 Ø

Collisions: random and repeat relocation (500 times)

Ø

Loops: an expansion process

Ø

Stand-alone implementation: libcuckoo @ EuroSys’14

n Horton tables @USENIX ATC’16 Ø

Recursively evicting keys within a certain search tree height

15

slide-16
SLIDE 16

Motivations

n Due to endless loops:

Ø

Substantial resources consumption

u A large number of step-by-step kick-out operations Ø

Unbounded performance

u Fruitless effort

n Design Goal:

Ø

Predetermining and avoiding occurrence of endless loops

16

slide-17
SLIDE 17

Our approach: SmartCuckoo

n Tracking item placements in the hash table

Ø

Representing the hashing relationship as a directed pseudoforest

Ø

Classifying item insertions into three cases

Ø

Predetermining and avoiding loops during insertion without any kick-out attempts.

17

slide-18
SLIDE 18

n Pseudoforest: Ø

A graph: each vertex has an outdegree of at most one

Ø

Each connected component (subgraph) has at most one cycle (loop)

Ø

In a subgraph:

Loop #Vertices = #Edges

How to identify loop(s)?

e c d a k j n m l b i h f g e c d a k j n m b h f g Vacancy No loop #Vertices = #Edges + 1

18

Maximal Non-maximal

slide-19
SLIDE 19

Classification and predetermination

n Three cases depending on the number of vertices added to the graph n

v+0, v+1, and v+2

n

v+0: 5 possible scenarios based on the status of corresponding subgraph(s)

19

Three cases v+0 v+1 v+2

Two insert positions of a key Same subgraph Different subgraphs A new

  • ne

Two new

  • nes

Subgraph status Non- maximal Maximal Both non- maximal A maximal and a non- maximal Both maximal

  • Scenarios

(a) (e) (b) (c) (d)

slide-20
SLIDE 20

v+0: (a) One non-maximal subgraph

Pseudoforest

c b d

T1 T2 1 2 3 4 5

a

6 7

x1

H1( ) H2( )

a b c d H1(x1) H2(x1)

c b d

T1 T2 1 2 3 4 5

a

6 7

x1

a b c d x1

n One empty bucket n Success!

20

slide-21
SLIDE 21

v+0: (b) Two non-maximal subgraphs

c b d

T1 T2 1 2 3 4 5

a f g

6 7

x2

H1( ) H2( )

a b c d H1(x2) H2(x2) f g

c b d

T1 T2 1 2 3 4 5

a f g

6 7

x2

a b c d f g x2

n Two empty buckets n Success!

Pseudoforest

21

slide-22
SLIDE 22

a b c d e H1(x3) H2(x3) f g

v+0: (c) One maximal and one non-maximal

c b d

T1 T2 1 2 3 4 5

a f g

6 7

e x3

H2( ) H1( )

c g b d

T1 T2 1 2 3 4 5

a f x3

6 7

e

a b c d e f g x3

n One loop and one empty bucket n Conventional cuckoo hashing: taking a random walk

Ø T1: executing extra useless kick-out operations Ø T2: making a success Ø SmartCuckoo: directly selecting to enter from T2

n Success!

Pseudoforest

22

slide-23
SLIDE 23

v+0: (d) Two maximal subgraphs

c b d

T1 T2 1 2 3 4 5

a f

i

g

6 7

e x4

H1( ) H2( ) h

a b c d e H1(x4) H2(x4) f i h g

Failure!

n Two loops! n Execution:

Ø Conventional cuckoo hashing: sufficient attempts, then reporting a failure Ø SmartCuckoo: reporting a failure without any kick-out operations.

Pseudoforest

23

slide-24
SLIDE 24

v+0: (e) One maximal subgraph

c b d

T1 T2 1 2 3 4 5

a

6 7

e x5

H1( ) H2( )

a b c d e H1(x5) H2(x5)

Failure!

n One loop!

Pseudoforest

24

slide-25
SLIDE 25

Case: v+1

Pseudoforest

c b d

T1 T2 1 2 3 4 5

a

6 7

x6

H1( ) H2( )

a b c d H1(x6) H2(x6)

c b d

T1 T2 1 2 3 4 5

a

6 7

x6

a b c d x6

n A new vertex after the item's insertion n Success!

25

slide-26
SLIDE 26

Case: v+2

Pseudoforest

c b d

T1 T2 1 2 3 4 5

a

6 7

x7

H1( ) H2( )

a b c d H1(x7) H2(x7)

c b d

T1 T2 1 2 3 4 5

a

6 7

x7

a b c d x7

n Two new vertices after the insertion n Success!

26

slide-27
SLIDE 27

Evaluation methodology

n Comparisons:

Ø Baseline (Cuckoo hashing with a stash @ SIAM Journal on Computing'09) Ø libcuckoo @ EuroSys'14 Ø BCHT (bucketized cuckoo hash table)

n Traces:

Ø RandomInteger: random integer generator @ TOMACS'98 Ø MacOS: http://tracer.filesystems.org Ø DocWords: http://archive.ics.uci.edu/ml/datasets/Bag+of+Words Ø YCSB: https://github.com/brianfrankcooper/YCSB @ SOCC'11

n Metrics: in millions of operations per second

Ø

Insertion throughput

Ø

Lookup throughput: positive/negative

Ø

Throughput of workload with mixed queries (YCSB)

27

slide-28
SLIDE 28

Insertion throughput

0.5 1 1.5 2 2.5 3 3.5 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 Millions of Insertions Per Second Load Factor Baseline libcuckoo BCHT SmartCuckoo

n SmartCuckoo significantly increases insertion throughputs. n 0.5× to 5×speedups compared to Baseline.

28

5× 0.5×

slide-29
SLIDE 29

Lookup throughput

0.5 1 1.5 2 2.5 100% 0% Millions of Lookups Per Second Percentage of Existent Keys in the Lookup Requests Baseline libcuckoo BCHT SmartCuckoo

n 0%: all candidate positions for a key have to be accessed. n Almost the same lookup throughput with Baseline. n Significantly higher than libcuckoo and BCHT.

29

slide-30
SLIDE 30

Throughput of workload with mixed queries

0.4 0.8 1.2 1.6 2 2.4 YCSB-1 YCSB-2 YCSB-3 YCSB-4 YCSB-5

Millions of Operations Per Second Workloads

Baseline libcuckoo BCHT SmartCuckoo

n With the decrease of the percentage of insertions, all schemes increase the

throughputs.

n In each workload, SmartCuckoo produces higher throughput than other

three schemes.

30

Workload Insert Lookup Update

YCSB-1 100 YCSB-2 75 25 YCSB-3 50 50 YCSB-4 25 75 YCSB-5 95 5

slide-31
SLIDE 31

Conclusion and future work

n Cuckoo hashing is cost-efficient to offer O(1) query

performance.

n We address the problem of potential endless loops in item

insertion.

n SmartCuckoo helps improve predictable performance in

storage systems.

n To-do-list:

n

SmartCuckoo in hash tables with more than two hash functions;

n

The use of multiple slots in each bucket.

31

slide-32
SLIDE 32

Thanks and questions?

Open-source code: https://github.com/syy804123097/SmartCuckoo

32