Multi-Copy Cuckoo Hashing

Multi-Copy Cuckoo Hashing

Multi-copy Cuckoo Hashing Dagang Li*†, Rong Du* Ziheng Liu, Tong Yang, Bin Cui *SECE, Shenzhen Graduate School, Peking University Department of Computer Science †Shenzhen Key Lab of Info. Theory&Future Net. Arch. Peking University Shenzhen, China Beijing, China [email protected], [email protected] liuziheng, yant.tong, [email protected] Abstract—Cuckoo hashing is widely used for its worst-case ratios, the cost to resolve increased collisions inevitably constant lookup performance even at very high load. However becomes high, since now more item rearrangements may have at high load, collision resolution will involve lots of probes on to be probed before a working one can be finally found. This item relocation and may still fail in the end. To address the greatly affects the insertion delay, and the collision resolution problem, we propose an efficient Cuckoo hashing scheme called may still fail even after the costly relocating effort. Generally Multi-copy Cuckoo or McCuckoo. Different from the blind there are three main factors that determine the performance of kick-outs of standard Cuckoo hashing during a collision, we can Cuckoo hashing. foresee which way to successfully kick items by using multiple 1) The recursive kick-outs during an insertion. At high copies. Furthermore, with the knowledge of how many copies load ratio, the probability of collision becomes high when a each item has in the table, we can identify impossible buckets new item is inserted, and the probability of finding a solution and skip them during a lookup. In order to avoid expensive rehashing during insertion failures, McCuckoo also supports only after a few round of kick-outs also decreases [9]. more efficient stash strategy that minimizes stash checking. Moreover, because standard Cuckoo hashing cannot forsee McCuckoo uses simple logic and simple data structure, so it is which item has empty alternative buckets, it can only probe suitable for both software and hardware implementation on for one in BFS order or in a random fashion. The blindness platforms where intensive access to the slow and bandwidth in these trial-and-error probing approaches may take too limited off-chip external memory is the main bottleneck. much time to find a resolution or even end up in an endless loop [3], which is the main cause of insertion failures. A good Keywords—Cuckoo Hashing, Hashing algorithm, Multi-copy strategy should find a solution fast if such solution exists. 2) The cost to handle insertion/lookup failures. When a I. INTRODUCTION collision resolution cannot be reached during insertion, the Hash tables [1] are basic data structures that are widely traditional Cuckoo hashing suggests a costly rehashing used in various fields such as database, networking, storage, solution, reading out all inserted items and using a different security, etc. When working at low load, hash collisions rarely set of hash functions to put them into a bigger table, during happen; but when load increases, collisions will happen which the hash table is completely unusable. A more practical frequently. Traditional solutions such as chaining methods remedy is to allocate some small additional space to store all and linear probing [2] need extra time and resource to resolve the items that fail in insertion [22], but then if an item is not the collisions, affecting both insertion and lookup and losing found in the main table during a lookup, the stash needs to be the favorable performance bound. double checked. This extra checking not only affects lookup Unlike traditional hash structures that only provide one performance, but also limits the number of items it can hold candidate location for each item, Cuckoo hashing [3] uses d to handle very high load. To maximize the benefit of a stash, hash functions to provide multiple candidate buckets for each we should minimize its search cost, improve its scalability item to choose so as to reduce collision. Most importantly, and reduce unnecessary checkings. existing items can be “kicked out” and relocated to another 3) Multiple bucket checking for a single lookup. When candidate bucket if necessary to make room in search of an looking up an item in a Cuckoo hash table, multiple buckets overall arrangement for all items to settle down in their own may need to be visited because the item can be in any of them. buckets. This flexibility provided by multiple hashing and The additional visits affect the lookup performance and may relocation helps Cuckoo hashing achieve very high load ratio be a big drawback when the table is too large and need to be (more items under the same table size) while still keeping put in slow and bandwidth limited off-chip external memory. worst-case constant lookup, during which at most d buckets If we can narrow down the subset of buckets that may contain may need to be checked to find the item. Because of its the item beforehand and optimize the accessing pattern, we capability to provide worst-case O(1) lookup at very high may increase the possibility of finding it with fewer visits and load, Cuckoo hashing has been the preferred hash technique improve the lookup performance. in many fields such as storage systems[5], databases[6], For the first problem, normally a maxloop is defined to privacy & security[4][7][14], networking[8][10], architecture draw the insertion procedure out of an endless loop, but still [9][11], data processing [12][13], and so on. time and resource so far are already wasted. Proposals such as The favorable lookup performance comes at the cost of the SmartCuckoo [15] and Necklace [16] tried to identify loops hardship to resolve collisions during insertion. At high load beforehand, so we won’t run into an endless loop situation in the first place. MinCounter [17] tries to reduce repetitions in an item for sure, so we can skip checking them during a the recursive kick-out process, so more buckets will be lookup; and a counter value 0 from any candidate bucket can searched and the possibility of finding an empty one will save us from checking the table at all (similar to a Bloom increase. Other work such as blocked Cuckoo hash tables filter). Furthermore, because an item can always overwrite a (BCHT)[18][19][20][21] allocate multiple slots within each redundant copy to settle down, if a lookup fails with any bucket, and the set-associativeness among these slots provides candidate bucket having counter value larger than 1, we know another level of flexibility which help to reduce collisions and that item must have not been inserted before and skip checking reach an even higher load ratio. As long as the whole bucket the stash. These and other further observations on the behavior can be retrieved in one memory access [33], there will be no of the counters can enrich the operation rules to improve the sacrifice on lookup performance. effectiveness and performance of McCuckoo. For the second problem, most stash-based solutions such McCuckoo is mostly suitable for platforms that have a as Cuckoo hashing with a stash (CHS)[22] propose to put the hierarchical memory structure where the main table can only stash on-chip to minimize its impact on performance[7][23] be put to the abundant but slower second layer memory due to [13][24]. When the stash itself is full, items stored in it will the large size, so all the three problems mentioned earlier will take a try to the main table until some space is freed. A small become equally apparent and McCuckoo can handle them stash of size 4 is regarded as enough to achieve rather high altogether in an unified framework. In order to maximize the load (for example 95% in [24]) with high probability. benefit of the counters, the counters need to fit in the on-chip Checking multiple locations for every single lookup is embedded memory that is order-of-magnitude faster. We more of a problem if accessing the table buckets is slow or propose a compact on-chip counter array and specifically expensive, which is the case when platforms with only limited designed counter operations that only involve very simple fast on-chip memory need to handle very large lookup tables logic, so that McCuckoo can be easily implemented in both (for example the ASIC/FPGA/SOC based packet processing software and hardware. devices). A common practice is to use compact helping The contributions of this paper are as follows: structures such as Bloom filters that can fit in the on-chip 1) Introducing the idea of multi-copy into Cuckoo-based memory to do pre-screening, so as to minimize unnecessary hashing architecture, which helps minimize the blindness in visit to the main table in the slower off-chip memory, such as item relocation and improve bucket availability, improving DEHT [25] and EMOMA [24]. insertion speed and success rate. In this paper, we propose a simple and effective Cuckoo 2) A new compact on-chip helping structure is proposed hash mechanism to address all the three problems discussed above. The main idea is to store multiple copies of item in the that can minimize unnecessary off-chip memory access with table, so we don’t have to rashly choose one at insertion time less on-chip memory cost than current solutions. when more candidate buckets are available, so as to keep the 3) An efficient pre-screening mechanism is proposed to flexibility on placement as much and as long as possible. The support a large off-chip stash by minimizing stash checking level of redundancy provides explicit clue to the choice of during failed lookups.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    12 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us