Horton Tables: Fast Hash Tables for In-Memory Data-Intensive Computing Alex D

Horton Tables: Fast Hash Tables for In-Memory Data-Intensive Computing Alex D

Horton Tables: Fast Hash Tables for In-Memory Data-Intensive Computing Alex D. Breslow, AMD Research and University of California, San Diego; Dong Ping Zhang, Joseph L. Greathouse, and Nuwan Jayasena, AMD Research; Dean M. Tullsen, University of California, San Diego https://www.usenix.org/conference/atc16/technical-sessions/presentation/breslow This paper is included in the Proceedings of the 2016 USENIX Annual Technical Conference (USENIX ATC ’16). June 22–24, 2016 • Denver, CO, USA 978-1-931971-30-0 Open access to the Proceedings of the 2016 USENIX Annual Technical Conference (USENIX ATC ’16) is sponsored by USENIX. Horton Tables: Fast Hash Tables for In-Memory Data-Intensive Computing Alex D. Breslow∗ Dong Ping Zhang Joseph L. Greathouse Nuwan Jayasena Dean M. Tullsen AMD Research AMD Research AMD Research AMD Research UC San Diego Abstract rehashed to its alternate candidate using the remaining hash function. If the alternate bucket for KV is full, KV Hash tables are important data structures that lie at the evicts yet another element and the process repeats until heart of important applications such as key-value stores the final displaced element is relocated to a free slot. and relational databases. Typically bucketized cuckoo Although these relocations may appear to incur large hash tables (BCHTs) are used because they provide high- performance overheads, prior work demonstrates that throughput lookups and load factors that exceed 95. most elements are inserted without displacing others and, Unfortunately, this performance comes at the cost of re- accordingly, that BCHTs trade only a modest increase in duced memory access efficiency. Positive lookups (key average insertion and deletion time in exchange for high- is in the table) and negative lookups (where it is not) on throughput lookups and load factors that often exceed average access 1.5 and 2.0 buckets, respectively, which 95 with greater than 99 probability [19], a vast im- results in 50 to 100 more table-containing cache lines provement over the majority of other techniques [60,64]. to be accessed than should be minimally necessary. BCHTs, due to this space efficiency and unparalleled To reduce these surplus accesses, this paper presents throughput, have enabled recent performance break- the Horton table, a revamped BCHT that reduces the ex- throughs in relational databases and key-value stores pected cost of positive and negative lookups to fewer than on server processors [20, 60, 64] as well as on ac- 1.18 and 1.06 buckets, respectively, while still achiev- celerators such as GPUs [71], the Xeon Phi [15, 60], ing load factors of 95. The key innovation is remap and the Cell processor [34, 64]. However, although entries, small in-bucket records that allow (1) more el- BCHTs are higher-performing than other open address- ements to be hashed using a single, primary hash func- ing schemes [60, 64], we find that as the performance of tion, (2) items that overflow buckets to be tracked and modern computing systems becomes increasingly con- rehashed with one of many alternate functions while strained by memory bandwidth [1, 11, 52, 70], they too maintaining a worst-case lookup cost of 2 buckets, and suffer from a number of inefficiencies that originate from (3) shortening the vast majority of negative searches to 1 how data is fetched when satisfying queries. bucket access. With these advancements, Horton tables Carefully coordinating table accesses is integral to outperform BCHTs by 17 to 89. throughput in hash tables. Because of the inherent ran- 1 Introduction domness of hashing, accesses to hash tables often ex- hibit poor temporal and spatial locality, a property that Hash tables are fundamental data structures that are causes hardware caches to become increasingly less ef- ubiquitous in high-performance and big-data applica- fective as tables scale in size. For large tables, cache tions such as in-memory relational databases [12,17,40] lines containing previously accessed hash table buckets and key-value stores [20, 24]. Typically these workloads are frequently evicted due to capacity misses before they are read-heavy [4, 62]: the hash table is built once and are touched again, degrading performance and causing is seldom modified in comparison to total accesses. A applications to become memory-bandwidth-bound once hash table that is particularly suited to this behavior is a the table’s working set cannot be cached on-chip. Given bucketized cuckoo hash table (BCHT), a type of open- these concerns, techniques that reduce accesses to addi- addressed hash table.1 BCHTs group their cells into tional cache lines in the table prove invaluable when op- buckets: associative blocks of two to eight slots, with timizing hash table performance and motivate the need each slot capable of storing a single element. to identify and address the data movement inefficiencies When inserting an element, BCHTs typically select that are prevalent in BCHTs. between one of two independent hash functions, each of Consider a BCHT that uses two independent hash which maps the key-value pair, call it KV, to a differ- functions to map each element to one of two candidate ent candidate bucket. If one candidate has a free slot, buckets. To load balance buckets and attain high load KV is inserted. In the case where neither has spare factors, recent work on BCHT-based key-value stores slots, BCHTs resort to cuckoo hashing, a technique that inserts each element into the candidate bucket with the resolves collisions by evicting and rehashing elements least load [20,71], which means that we expect half of the when too many elements vie for the same bucket. In elements to be hashed by each function. Consequently, this case, to make room for KV, the algorithm selects an on positive lookups, where the queried key is in the ta- element, call it KV , from one of KV’s candidate buck- ble, 1.5 buckets are expected to be examined. Half of ets, and replaces it with KV. KV is then subsequently 1Under open addressing, an element may be placed in more than ∗This author is also a PhD student at UC San Diego. Send corre- one location in the table. Collisions are resolved by relocating elements spondence regarding the work to abreslowcs.ucsd.edu. within the table rather than spilling to table-external storage. USENIX Association 2016 USENIX Annual Technical Conference 281 the items can be retrieved by examining a single bucket, expected data movement and storage overheads. and the other half require accessing both. For negative We investigate additional optimizations for inser- lookups, where the queried key is not in the table, 2 • tions and deletions that further reduce data move- lookups are necessary. Given that the minimum num- ment when using multiple hash functions, reclaim- ber of buckets that might need to be searched (for both ing remap entries once their remapped elements are positive and negative lookups) is 1, this leaves a very sig- deleted, even when they are shared by two or more nificant opportunity for improvement. table elements. To this end, this paper presents Horton tables,2 a care- fully retrofitted bucketized cuckoo hash table, which This paper is organized as follows: In Section 2 we trades a small amount of space for achieving positive and elaborate on the interplay between BCHTs and single in- negative lookups that touch close to 1 bucket apiece. Our struction multiple data (SIMD) processors, in Section 3 scheme introduces remap entries, small and succinct in- we describe BCHTs, in Section 4 we provide a high-level bucket records that enable (1) the tracking of past hash- overview of Horton tables, in Section 5 we describe the ing decisions, (2) the use of many hash functions for lit- lookup, insertion, and deletion algorithms for Horton ta- tle to no cost, and (3) most lookups, negative and posi- bles, and then in Section 6 we present our models for tive alike, to be satisfied with a single bucket access and Horton tables that include the cost of insertions, dele- at most 2. Instead of giving equal weight to each hash tions, and remap entry storage. Section 7 covers our ex- function, which leads to frequent fetching of unneces- perimental methodology, and Section 8 contains our per- sary buckets, we employ a single primary hash func- formance and model validation results. Related work is tion that is used for the vast majority of elements in the described in Section 9 and Section 10 concludes. table. By inducing such heavy skew, most lookups can be satisfied by accessing only a single bucket. To permit 2 The Role of SIMD this biasing, we use several secondary hash functions (7 In key places in this paper, we make references to in our evaluations) to rehash elements to alternate buck- SIMD and GPU architectures. Although not necessary ets when their preferred bucket lacks sufficient capacity for understanding our innovations, these references are to directly store them. Rather than forgetting our choice present due to SIMD’s importance for high-throughput of secondary hash function for remapped elements, we implementations of in-memory hash tables and BCHTs convert one of the slots in each bucket that overflows into in particular. a remap entry array that encodes which hash function Recent work in high-performance databases that lever- was used to remap each of the overflow items. It is this ages BCHTs has shown that SIMD implementations ability to track all remapped items at low cost, both in of BCHTs, as well as larger data processing primi- terms of time and space, that permits the optimizations tives, are often more than 3 faster than the highest that give Horton tables their performance edge over the performing implementations that× use scalar instructions prior state-of-the-art.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    15 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