efficiency tricks for hashing and blooming in streaming algorithms

26

Upload: marat-zhanikeev

Post on 16-May-2015

357 views

Category:

Technology


0 download

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.

TRANSCRIPT

Page 1: Efficiency Tricks for Hashing and Blooming in Streaming Algorithms
Page 2: Efficiency Tricks for Hashing and Blooming in Streaming Algorithms

.

The Data Streaming Problem

M.Zhanikeev -- [email protected] -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 2/23...

2/23

Page 3: Efficiency Tricks for Hashing and Blooming in Streaming Algorithms

.

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 -- [email protected] -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 3/23...

3/23

Page 4: Efficiency Tricks for Hashing and Blooming in Streaming Algorithms

.

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 -- [email protected] -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 4/23...

4/23

Page 5: Efficiency Tricks for Hashing and Blooming in Streaming Algorithms

.

Hashing and Blooming

M.Zhanikeev -- [email protected] -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 5/23...

5/23

Page 6: Efficiency Tricks for Hashing and Blooming in Streaming Algorithms

.

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 -- [email protected] -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 6/23...

6/23

Page 7: Efficiency Tricks for Hashing and Blooming in Streaming Algorithms

.

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 -- [email protected] -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 7/23...

7/23

Page 8: Efficiency Tricks for Hashing and Blooming in Streaming Algorithms

.

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 -- [email protected] -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 8/23...

8/23

Page 9: Efficiency Tricks for Hashing and Blooming in Streaming Algorithms

.

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 -- [email protected] -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 9/23...

9/23

Page 10: Efficiency Tricks for Hashing and Blooming in Streaming Algorithms

.

Efficiency

M.Zhanikeev -- [email protected] -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 10/23...

10/23

Page 11: Efficiency Tricks for Hashing and Blooming in Streaming Algorithms

.

Efficiency (1) : Hash/Bloom

M.Zhanikeev -- [email protected] -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 11/23...

11/23

Page 12: Efficiency Tricks for Hashing and Blooming in Streaming Algorithms

.

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 -- [email protected] -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 12/23...

12/23

Page 13: Efficiency Tricks for Hashing and Blooming in Streaming Algorithms

.

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

M.Zhanikeev -- [email protected] -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 13/23...

13/23

Page 14: Efficiency Tricks for Hashing and Blooming in Streaming Algorithms

.

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 -- [email protected] -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 14/23...

14/23

Page 15: Efficiency Tricks for Hashing and Blooming in Streaming Algorithms

.

Data Streaming Examples

M.Zhanikeev -- [email protected] -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 15/23...

15/23

Page 16: Efficiency Tricks for Hashing and Blooming in Streaming Algorithms

.

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 -- [email protected] -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 16/23...

16/23

Page 17: Efficiency Tricks for Hashing and Blooming in Streaming Algorithms

.

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 -- [email protected] -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 17/23...

17/23

Page 18: Efficiency Tricks for Hashing and Blooming in Streaming Algorithms

.

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 -- [email protected] -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 18/23...

18/23

Page 19: Efficiency Tricks for Hashing and Blooming in Streaming Algorithms

.

The Why : Practical Application -BigData

M.Zhanikeev -- [email protected] -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 19/23...

19/23

Page 20: Efficiency Tricks for Hashing and Blooming in Streaming Algorithms

.

BigData: Today

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

M.Zhanikeev -- [email protected] -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 20/23...

20/23

Page 21: Efficiency Tricks for Hashing and Blooming in Streaming Algorithms

.

BigData Replay (new)

M.Zhanikeev -- [email protected] -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 21/23...

21/23

Page 22: Efficiency Tricks for Hashing and Blooming in Streaming Algorithms

.

BigData on Multicore

M.Zhanikeev -- [email protected] -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 22/23...

22/23

Page 23: Efficiency Tricks for Hashing and Blooming in Streaming Algorithms

.

That’s all, thank you ...

M.Zhanikeev -- [email protected] -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 23/23...

23/23

Page 24: Efficiency Tricks for Hashing and Blooming in Streaming Algorithms

.

[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 -- [email protected] -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 23/23...

23/23

Page 25: Efficiency Tricks for Hashing and Blooming in Streaming Algorithms

.

[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 -- [email protected] -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 23/23

...

23/23

Page 26: Efficiency Tricks for Hashing and Blooming in Streaming Algorithms

.

Blooming Trees for Minimal Perfect HashingGLOBECOM

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

M.Zhanikeev -- [email protected] -- Efficiency Tricks for Hashing and Blooming in Streaming Algorithms -- http://bit.do/marat140516 -- 23/23...

23/23