Efficiency Tricks for Hashing and Blooming in Streaming Algorithms

Preview:

DESCRIPTION

Streaming algorithms, also known as data streaming, are a realtime/online alternative to offline processing of data stored in a database. While streaming, it is important to stay below the per-item processing time budget. Since one would still like to extract as much valuable information as possible from the stream (larger sketches), it is important to use highly efficient algorithms for hash functions and bloom filters. This paper presents some of the efficiency tricks in this area. Note that the topic is only distantly related to the space efficiency (memory footprint minimization) problem and pursues drastically different objectives.

Citation preview

.

The Data Streaming Problem

M.Zhanikeev -- maratishe@gmail.com -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 2/23...

2/23

.

Data Streaming Problem• based on the traditional Information Theory 01 02

• but a new formulation altogether 04

• data streaming: processes input in realtime (no storage), creatingspace efficient sketches on the output

• alternative to database, indexing, offline processing, etc. technologies

01 C.Shannon "A Mathematical Theory of Communication" The Bell System Tech.J (1948)

02 D.MacKey "Information Theory, Inference, and Learning Algorithms" Cambridge UniPress (2003)

04 S.Muthukrishnan "Data Streams: Algorithms and Applications" Theoretical Comp.Science (2005)

M.Zhanikeev -- maratishe@gmail.com -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 3/23...

3/23

.

Data Streaming Problems

• fast hashing 08

• efficient blooming 09 10

• space-efficient streaming algorithms

Other Uses

Data Streaming

Other uses Bloom Filter

Other Types of Hashing Fast Hashing

08 D.Lemire+1 "Strongly Universal String Hashing is Fast" Cornell Techreport (2013)

09 F.Putze+2 "Cache- Hash- and Space-Efficient Bloom Filters" JEA Journal (2009)

10 A.Kirsch+1 "Less Hashing, Same Performance: Building a Better Bloom Filter" Inderscience (2007)

M.Zhanikeev -- maratishe@gmail.com -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 4/23...

4/23

.

Hashing and Blooming

M.Zhanikeev -- maratishe@gmail.com -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 5/23...

5/23

.

Hashing Technology

• perfect hashing• minimal perfect hashing

◦ applied to blooming, but relatively inefficient 11

• universal hashing← this is the one we use◦ but many efficiency tricks◦ bitwise fast hashing, etc.12

11 G.Antichi+4 "Blooming Trees for Minimal Perfect Hashing" GLOBECOM (2008)

12 F.Bonomi+4 "Bloom Filters via d-Left Hashing and Dynamic Bit Reassignment" 44th ACCCC (2006)

M.Zhanikeev -- maratishe@gmail.com -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 6/23...

6/23

.

Hashing Quality Metrics

• uniform distribution• avalance condition

◦ change in one bit on the input changes about half of bits on the output

• no partial correlation◦ hard to achieve, head and tail bits have different qualities in common algorithms like

CRC24, etc.

M.Zhanikeev -- maratishe@gmail.com -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 7/23...

7/23

.

Blooming Quality Metrics

• True Positive OK, butFalse Positive also possible

• an answer to the question of "have you seen this before?"

• time it takes to "fill up" a bloom structure -- useless afterwards

M.Zhanikeev -- maratishe@gmail.com -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 8/23...

8/23

.

Bloom Filter Types

• stop additions filter

• delition filter

• counting filter

• .... very active research 09 10

• .... reality: most of them are inefficient!

09 F.Putze+2 "Cache- Hash- and Space-Efficient Bloom Filters" JEA Journal (2009)

10 A.Kirsch+1 "Less Hashing, Same Performance: Building a Better Bloom Filter" Inderscience (2007)

M.Zhanikeev -- maratishe@gmail.com -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 9/23...

9/23

.

Efficiency

M.Zhanikeev -- maratishe@gmail.com -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 10/23...

10/23

.

Efficiency (1) : Hash/Bloom

M.Zhanikeev -- maratishe@gmail.com -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 11/23...

11/23

.

Efficiency (2) : Hash/Bloom• how many hash functions k?

k = ln2(mn

)≈ 0.6

m

n.

• the "fill-up" rate -- when it becomes useless

p =(1− 1

m

)kn≈ e

−knm .

• FP probability

pFP = (1− p)k ≈(1− e

−knm

)k≈ 1

2k,

M.Zhanikeev -- maratishe@gmail.com -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 12/23...

12/23

.

Efficiency (2) : Hotspot Input• most data today hotspot distribution moded as a SB process

M.Zhanikeev -- maratishe@gmail.com -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 13/23...

13/23

.

Efficiency (3) : DLL and Collissions

• a practicalalternative to perfecthashing

• catch and resolvecollissions usingsideways DLL

• hotspots: movechanged items to the topof DLL

• common in C/C++

M.Zhanikeev -- maratishe@gmail.com -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 14/23...

14/23

.

Data Streaming Examples

M.Zhanikeev -- maratishe@gmail.com -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 15/23...

15/23

.

Examples (1) : Heavy Hitterns

.Objective..

.FindingHeavy Hitters in a hotspot distributed input.

• find k most frequently accessed items in a list.

• good algorithms can be found in 04

04 S.Muthukrishnan "Data Streams: Algorithms and Applications" Theoretical Comp.Science (2005)

M.Zhanikeev -- maratishe@gmail.com -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 16/23...

16/23

.

Examples (2) : Superspreaders

.Objective..

.

Superspreaders: detect items which access or are accessed byexceedingly many other items.

• computer viruses, botnets, etc.• one source, many destinations

• short lifespan

M.Zhanikeev -- maratishe@gmail.com -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 17/23...

17/23

.

Examples (3) : M2M Patterns

.Objective..

.

M2M patterns: A more generic case of heavy hitters and superspreaders,but in this definition the patterns are not known in advance.

• m2m communication patterns

• space efficiency is important

• selective filtering -- pick only interesting m2m units

M.Zhanikeev -- maratishe@gmail.com -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 18/23...

18/23

.

The Why : Practical Application -BigData

M.Zhanikeev -- maratishe@gmail.com -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 19/23...

19/23

.

BigData: Today

05 K.Shvachko "HDFS Scalability: the Limits to Growth" the Magazine of USENIX (2012)

M.Zhanikeev -- maratishe@gmail.com -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 20/23...

20/23

.

BigData Replay (new)

M.Zhanikeev -- maratishe@gmail.com -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 21/23...

21/23

.

BigData on Multicore

M.Zhanikeev -- maratishe@gmail.com -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 22/23...

22/23

.

That’s all, thank you ...

M.Zhanikeev -- maratishe@gmail.com -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 23/23...

23/23

.

[01] C.Shannon (1948)A Mathematical Theory of CommunicationThe Bell System Tech.J

[02] D.MacKey (2003)Information Theory, Inference, and Learning AlgorithmsCambridge UniPress

[03] A.Konheim (2010)Hashing in Computer Science: Fifty Years of Slicing and DicingWiley

[04] S.Muthukrishnan (2005)Data Streams: Algorithms and ApplicationsTheoretical Comp.Science

[05] K.Shvachko (2012)HDFS Scalability: the Limits to Growththe Magazine of USENIX

M.Zhanikeev -- maratishe@gmail.com -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 23/23...

23/23

.

[06] S.Heinz+2 (2002)Burst Tries: A Fast, Efficient Data Structure for String KeysACM TOIS

[07] M.Ramakrishna+1 (1997)Performance in Practice of String Hashing Functions5th ICDSAA

[08] D.Lemire+1 (2013)Strongly Universal String Hashing is FastCornell Techreport

[09] F.Putze+2 (2009)Cache- Hash- and Space-Efficient Bloom FiltersJEA Journal

[10] A.Kirsch+1 (2007)Less Hashing, Same Performance: Building a Better Bloom FilterInderscience

[11] G.Antichi+4 (2008)M.Zhanikeev -- maratishe@gmail.com -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 23/23

...

23/23

.

Blooming Trees for Minimal Perfect HashingGLOBECOM

[12] F.Bonomi+4 (2006)Bloom Filters via d-Left Hashing and Dynamic Bit Reassignment44th ACCCC

M.Zhanikeev -- maratishe@gmail.com -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 23/23...

23/23

Recommended