Fast and Space-Efficient Maps for Large Data Sets
Total Page:16
File Type:pdf, Size:1020Kb
Fast and Space-Efficient Maps for Large Data Sets A Dissertation presented by Prashant Pandey to The Graduate School in Partial Fulfillment of the Requirements for the Degree of Doctor of Philosophy in Computer Science Stony Brook University December 2018 Stony Brook University The Graduate School Prashant Pandey We, the dissertation committee for the above candidate for the Doctor of Philosophy degree, hereby recommend acceptance of this dissertation Michael A. Bender, Thesis Advisor Professor, Computer Science Rob Johnson, Thesis Advisor Research Assistant Professor, Computer Science Michael Ferdman, Thesis Committee Chair Associate Professor, Computer Science Rob Patro Assistant Professor, Computer Science Guy Blelloch Professor, Computer Science Carnegie Mellon University This dissertation is accepted by the Graduate School Dean of the Graduate School ii Abstract of the Dissertation Fast and Space-Efficient Maps for Large Data Sets by Prashant Pandey Doctor of Philosophy in Computer Science Stony Brook University 2018 Approximate Membership Query (AMQ) data structures, such as the Bloom filter, have found numerous applications in databases, storage systems, networks, computa- tional biology, and other domains. However, many applications must work around limitations in the capabilities or performance of current AMQs, making these appli- cations more complex and less performant. For example, many current AMQs cannot delete or count the number of occurrences of each input item, nor can they store values corresponding to items. They take up large amounts of space, are slow, cannot be resized or merged, or have poor locality of reference and hence perform poorly when stored on SSD or disk. In this dissertation, we show how to use recent advances in the theory of compact and succinct data structures to build a general-purpose AMQ. We further demonstrate how we use this new feature-rich AMQ to improve applications in computational biology and streaming in terms of space, speed, and simplicity. First, we present a new general-purpose AMQ, the counting quotient filter (CQF). The CQF supports approximate membership testing and counting occurrences of items in a data set and offers an order-of-magnitude faster performance than the Bloom filter. The CQF can also be extended to be a fast and space-efficient map for small keys and values. Then we discuss three applications in computational biology and streaming that use the CQF to solve big data problems. In the first application, Squeakr, we show how iii we can compactly represent huge weighted de Bruijn Graphs in computational biology using the CQF as an approximate multiset representation. In deBGR, we further show how to use a weighted de Bruijn Graph invariant to iteratively correct all the approximation errors in the Squeakr representation. In the third application, Mantis, we show how to use the CQF as a map for small keys and values to build a large- scale sequence-search index for large collections of raw sequencing data. In the fourth application, we show how to extend the CQF to build a write-optimized key-value store (for small keys and values) for timely reporting of heavy-hitters using external memory. iv Dedication To my collaborators, cohabitators, and everyone else who had to put up with me. Especially, my parents, Sudha and Dharmen- dra, who taught me the importance of hard work and humbleness in life. My brother and sister-in-law, Siddharth and Pooja, who helped me at every step of my career and encouraged me to pur- sue research. And finally, my wife, Kavita, who stood with me as a friend all through the good and bad times of my grad life. v Contents List of Figures ix List of Tables xi 1 Introduction 1 1.1 Outline . .3 2 AMQ and counting structures 4 2.1 AMQ data structures . .4 2.2 Counting data structures . .5 2.3 Succinct data structures . .7 3 The counting quotient filter (CQF) 8 3.1 Rank-and-select-based metadata scheme . .8 3.2 Fast x86 rank and select . 13 3.3 Lookup performance . 14 3.4 Space analysis . 14 3.5 Enumeration, resizing, and merging . 15 3.6 Counting Quotient Filter . 16 3.7 CQF space analysis . 18 3.8 Configuring the CQF . 20 3.9 Evaluation . 20 3.9.1 Experiment setup . 21 3.9.2 In-RAM performance . 24 3.9.3 On-SSD performance . 24 3.9.4 Performance with skewed data sets . 24 3.9.5 Applications . 25 3.9.6 Mergeability . 25 3.9.7 Impact of optimizations . 26 vi 4 Squeakr: An exact and approximate k-mer counting system 33 4.1 k-mer counting . 33 4.2 Methods . 36 4.2.1 Squeakr design . 36 4.2.2 Squeakr can also be an exact k-mer counter . 39 4.3 Evaluation . 40 4.3.1 Experimental setup . 41 4.3.2 Memory requirement . 43 4.3.3 Counting performance . 44 4.3.4 Query performance . 45 4.3.5 Inner-product queries . 46 5 deBGR: An efficient and near-exact representation of the weighted de Bruijn Graph 47 5.1 de Bruijn Graphs . 47 5.2 Background . 50 5.2.1 Prior approximate de Bruijn Graph representations . 50 5.2.2 Lower bounds on weighted de Bruijn Graph representation . 51 5.3 Methods . 52 5.3.1 A weighted de Bruijn Graph invariant . 52 5.3.2 deBGR: A compact de Bruijn graph representation . 56 5.3.3 Local error-correction rules . 56 5.3.4 Global, CQF-specific error-correction rules . 58 5.3.5 An algorithm for computing abundance corrections . 60 5.3.6 Implementation . 61 5.4 Evaluation . 62 5.4.1 Experimental setup . 64 5.4.2 Space vs accuracy trade-off . 64 5.4.3 Performance . 64 6 Large-scale sequence-search index 68 6.1 Sequence-search indexes . 68 6.2 Methods . 73 6.2.1 Method details . 73 6.2.2 Quantification and statistical analysis . 78 6.3 Evaluation . 78 6.3.1 Evaluation metrics . 78 6.3.2 Experimental procedure . 78 6.3.3 Experimental setup . 80 6.3.4 Experiment results . 81 vii 7 Timely reporting of heavy-hitters using external memory 84 7.1 Online event detection problem . 84 7.2 The Misra-Gries algorithm and heavy hitters . 88 7.3 External-memory Misra-Gries and online event detection . 89 7.3.1 External-memory Misra-Gries . 90 7.4 Online event-detection . 91 7.5 Online event detection with time-stretch . 93 7.6 Online event detection on power-law distributions . 95 7.6.1 Power-law distributions . 96 7.6.2 Popcorn filter . 96 7.7 Implementation . 100 7.7.1 Time-stretch filter . 100 7.7.2 Popcorn filter . 101 7.8 Greedy shuffle-merge schedule . 102 7.9 Deamortizing . 102 7.10 Evaluation . 103 7.10.1 Experimental setup . 104 7.10.2 Timely reporting . 107 7.10.3 I/O performance . 109 7.10.4 Scaling with multiple threads . 110 Bibliography 117 viii List of Figures 3.1 Rank-and-select-based quotient filter . 10 3.2 Procedure for computing offset Oj given Oi................ 10 3.3 Rank-and-select-based-quotient-filter block . 12 3.4 A simple example of pdep instruction [87]. The 2nd operand acts as a mask to deposit bits from the 1st operand. 13 3.5 Space analysis of AMQs . 15 3.6 Space analysis of counting filters . 19 3.7 In-memory performance of AMQs . 28 3.8 On-SSD performance of AMQs . 29 3.9 In-memory performance of counting filters . 30 3.10 In-memory performance of the CQF with real-world data sets . 31 3.11 Impact of x86 instruction on RSQF performance . 32 4.1 Squeakr system design . 37 5.1 Weighted de Bruijn Graph invariant. 54 5.2 Types of edges in a de Bruijn Graph. 55 5.3 Total number of distinct k-mers in First QF, Last QF, and Main QF. 62 6.1 The Mantis indexing data structures. 74 6.2 The distribution of the number of k-mers in a color class and ID assigned to the color class. 76 7.1 Active-set generator dataset . 104 7.2 Count stretch vs. lifetime in active-set generator dataset . 107 7.3 Time stretch vs. lifetime in active-set generator dataset . 108 7.4 Time stretch vs. lifetime in active-set generator dataset . 109 7.5 Time stretch vs. lifetime in active-set generator dataset . 110 7.6 Time stretch vs. lifetime in active-set generator dataset . 111 ix 7.7 Scalability with increasing number of threads. 113 7.8 Scalability with increasing number of threads. 114 x List of Tables 3.1 Space usage of several AMQs. 15 3.2 Encodings for C occurrences of remainder x in the CQF. 18 3.3 Data sets used in multi-threaded experiments . 25 3.4 CQF K-way merge performance . 25 4.1 Datasets used in Squeakr experiments . 40 4.2 RAM used by KMC2, Squeakr, Squeakr (exact), and Jellyfish2. 43 4.3 k-mer counting performance for k = 28. 44 4.4 k-mer counting performance for k = 55. 44 4.5 Random query performance for k = 28. 45 4.6 de Bruijn Graph query.