Presentation is loading. Please wait.

Presentation is loading. Please wait.

Segmented Hash: An Efficient Hash Table Implementation for High Performance Networking Subsystems Sailesh Kumar Patrick Crowley.

Similar presentations


Presentation on theme: "Segmented Hash: An Efficient Hash Table Implementation for High Performance Networking Subsystems Sailesh Kumar Patrick Crowley."— Presentation transcript:

1 Segmented Hash: An Efficient Hash Table Implementation for High Performance Networking Subsystems Sailesh Kumar Patrick Crowley

2 2 - Sailesh Kumar - 11/26/2015 Overview n Overview of Hash Tables and Segmented Hash Table n Analysis and Limitations »Increased memory references n Adding Bloom Filters per segment n Selective Filter Insertion Algorithm n Simulation Results and Analysis n Conclusion

3 3 - Sailesh Kumar - 11/26/2015 Hash Tables n Consider the problem of searching an array for a given value »If the array is not sorted, the search requires O(n) time »If the array is sorted, we can do a binary search –O(lg n) time »Can we do in O(1) time –It doesn’t seem like we could do much better

4 4 - Sailesh Kumar - 11/26/2015 Hash Tables n Suppose we were to come up with a “magic function” that, given a value to search for, would tell us exactly where in the array to look »If it’s in that location, it’s in the array »If it’s not in that location, it’s not in the array n If we look at the function’s inputs and outputs, they probably won’t “make sense” n This function is called a hash function because it “makes hash” of its inputs

5 5 - Sailesh Kumar - 11/26/2015 Hash Tables n How can we come up with this magic function? n In general, we cannot--there is no such magic function »In a few specific cases, where all the possible values are known in advance, it has been possible to compute a perfect hash function n What is the next best thing? »A perfect hash function would tell us exactly where to look »In general, the best we can do is a function that tells us where to start looking!

6 6 - Sailesh Kumar - 11/26/2015 Hash Tables n Suppose our hash function gave us the following values: »hash("apple") = 5 hash("watermelon") = 3 hash("grapes") = 8 hash("cantaloupe") = 7 hash("kiwi") = 0 hash("strawberry") = 9 hash("mango") = 6 hash("banana") = 2 »hash("honeydew") = 6 n This is called collision »Now what kiwi banana watermelon apple mango cantaloupe grapes strawberry 01234567890123456789

7 7 - Sailesh Kumar - 11/26/2015 Collision Resolution Policies n Linear Probing »Successively search for the first empty subsequent table entry n Linear Chaining »Link all collided entries at any bucket as a linked-list n Double Hashing »Uses a second hash function to successively index the table

8 8 - Sailesh Kumar - 11/26/2015 Performance Analysis n Average performance is O(1) n However, worst-case performance is O(n) n In fact the likelihood that a key is at a distance > 1 is pretty high These keys will take twice time to be probed These will take thrice the time to be probed Pretty high probability that throughput is half or three times lower than the peak throughput

9 9 - Sailesh Kumar - 11/26/2015 Segmented Hashing n Uses power of multiple choices »has been proposed earlier by Azar et al n A N-way segmented hash »Logically divides the hash table array into N equal segments »Maps the incoming keys onto a bucket from each segment »Picks the bucket which is either empty or has minimum keys k i h( ) k i is mapped to this bucket k i+1 h( ) k i+1 is mapped to this bucket 211121212 A 4-way segmented hash table 1 2

10 10 - Sailesh Kumar - 11/26/2015 Segmented Hash Performance n More segments improves the probabilistic performance »With 64 segments, probability that a key is inserted at distance > 2 is nearly zero even at 100% load »Improvement in average case performance is still modest

11 11 - Sailesh Kumar - 11/26/2015 An obvious Deficiency n Even though distance of keys are one, every query requires at least N memory probes »Average probes are O(N) compared to O(1) of a naive table –If things are bandwidth limited, N times lower throughput n In order to ensure O(1) operations, segmented hash table uses on-chip Bloom filters »On-chip memory requirements are quite modest, 1-2 bytes per hash table bucket n Each segment has a Bloom filter, which supports membership queries »These on-chip filters are queried before actually making an off-chip hash table memory reference

12 12 - Sailesh Kumar - 11/26/2015 Adding per Segment Filters 0 1 0 2111201212 k i h( ) k i can go to any of the 3 buckets 1 0 0 0 0 1 1 0 1 h 1 (kiki ) h 2 (kiki ) h k (kiki ) : m b bits We can select any of the above three segments and insert the key into the corresponding filter

13 13 - Sailesh Kumar - 11/26/2015 False Positive Rates n With Bloom Filters, there is likelihood of false positives »A filter might say that the key is present in its segment, while key is actually not present n With N segments, clearly the false positive rates will be at least N times higher »In fact, it will be even higher, because we have to also consider several permutations of false positives n We propose Selective Filter Insertion algorithm, which reduces the false positive rates by several orders of magnitudes

14 14 - Sailesh Kumar - 11/26/2015 Selective Filter Insertion Algorithm 0 1 0 k i h( ) 2111201212 k i can go to any of the 3 buckets 1 0 0 0 0 1 1 0 1 h 1 (kiki ) h 2 (kiki ) h k (kiki ) : m b bits Insert the key into segment 4, since fewer bits are set. Fewer bits are set => lower false positive With more segments (or more choices), our algorithm sets far fewer bits in the Bloom filter

15 15 - Sailesh Kumar - 11/26/2015 Selective Filter Insertion Results

16 16 - Sailesh Kumar - 11/26/2015 Selective Filter Insertion Details n First we build the set of segments where the arriving key can be inserted, we call it {minSet} »i.e. these segments will have minimum and equal collision chain length at the corresponding hash index n A naive or greedy algorithm will choose the segment, where least number of bits are set in the Bloom filter »Leads to unbalanced segments »An already loaded segment is likely to receive further keys because its filter array is more likely to have fewer transitions »Our simulations suggest that an enhancement in the insertion algorithm reduces the false positive further by up to an order of magnitude

17 17 - Sailesh Kumar - 11/26/2015 Selective Filter Insertion Enhancement n Our aim is to try to keep the segments balanced while also trying to reduce the bit transitions in the Bloom filters 1. Label segments in the set {minSet} eligible if its occupancy is less than (1+δ) times the occupancy of the least occupied segment. Parameter δ is typically set at 0.1 to 0.01. 2. If no segment remains eligible, select the least occupied segment from {minSet} 3. Otherwise choose a segment from {minSet}, which has minimum bit transitions 4. If multiple such segments exist, choose the least occupied one 5. If multiple such segments are again found, break the tie with a round-robin arbitration policy

18 18 - Sailesh Kumar - 11/26/2015 Simulation Results n 64K buckets, 32 bits/entry Bloom filter. n Simulation runs for 500 phases. »During every phase, 100,000 random searches are performed. Between every phase 10,000 random keys are deleted and inserted.

19 19 - Sailesh Kumar - 11/26/2015 Effectiveness of Modified Bloom Filters n Plotting average memory references at different successful search rates. »Lower memory references reflects the effectiveness of filters. Load is kept at 80%.

20 20 - Sailesh Kumar - 11/26/2015 Questions?


Download ppt "Segmented Hash: An Efficient Hash Table Implementation for High Performance Networking Subsystems Sailesh Kumar Patrick Crowley."

Similar presentations


Ads by Google