bitmap algorithms for flow counting – internet measurement conference, october 2003 bitmap...

49
Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Bitmap Algorithms for Counting Active Flows on Counting Active Flows on High High Speed Links Speed Links Cristian Estan, George Varghese, Mike Fisk Computer Science and Engineering Department, University of California, San Diego

Upload: adam-power

Post on 27-Mar-2015

220 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Bitmap Algorithms for Bitmap Algorithms for Counting Active Flows on Counting Active Flows on

HighHighSpeed LinksSpeed Links

Cristian Estan, George Varghese, Mike Fisk

Computer Science and Engineering Department,University of California, San Diego

Page 2: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Why count flows?Why count flows?

• Detect port/IP scans• Identify DoS attacks• Estimate spreading rate

of a worm• Packet scheduling

Dave Plonka’s FlowScan

Page 3: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Existing flow counting solutionsExisting flow counting solutions

ServerNetFlow data

Analysis

Traffic

reports

Network Operations Center

Router

Fast link

Memory

Network

Memory sizeMemory size

& bandwidth& bandwidth

NetworkNetwork

bandwidthbandwidth

Page 4: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Motivating questionMotivating question

• Can we count flows at line speeds at the router?

– Wrong solution – counters

– Naïve solution – use hash tables (like NetFlow)

– Our approach – use bitmaps

Page 5: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Bitmap counting algorithmsBitmap counting algorithms

• A family of algorithms that can be used as building blocks in various systems

• Algorithms can be adapted to application

• Low memory and per packet processing

• Generalize flows to distinct header patterns– Count flows or source addresses to detect attack– Count destination address+port pairs to detect scan

Page 6: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Talk structureTalk structure

• Per packet processing for bitmap algorithms

• Computing flow count estimates from bitmaps

• Variance analysis of estimates

• Derived algorithms

• Related work

• Measurements

• Conclusions

Page 7: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Bitmap counting – direct bitmapBitmap counting – direct bitmap

HASH(green)=10001001

Set bits in the bitmap using hash of the flow ID of incoming packets

Page 8: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Bitmap counting – direct bitmapBitmap counting – direct bitmap

HASH(blue)=00100100

Different flows have different hash values

Page 9: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Bitmap counting – direct bitmapBitmap counting – direct bitmap

HASH(green)=10001001

Packets from the same flow always hash to the same bit

Page 10: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Bitmap counting – direct bitmapBitmap counting – direct bitmap

HASH(violet)=10010101

Collisions OK, estimates compensate for them

Page 11: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Bitmap counting – direct bitmapBitmap counting – direct bitmap

HASH(orange)=11110011

Page 12: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Bitmap counting – direct bitmapBitmap counting – direct bitmap

HASH(pink)=11100000

Page 13: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Bitmap counting – direct bitmapBitmap counting – direct bitmap

HASH(yellow)=01100011

As the bitmap fills up, estimates get inaccurate

Page 14: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Bitmap counting – direct bitmapBitmap counting – direct bitmap

Solution: use more bits

HASH(green)=10001001

Page 15: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Bitmap counting – direct bitmapBitmap counting – direct bitmap

Solution: use more bits

Problem: memory scales with the number of flows

HASH(blue)=00100100

Page 16: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Bitmap counting – virtual bitmapBitmap counting – virtual bitmap

Solution: a) store only a portion of the bitmap

b) multiply estimate by scaling factor

Page 17: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Bitmap counting – virtual bitmapBitmap counting – virtual bitmap

HASH(pink)=11100000

Page 18: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Bitmap counting – virtual bitmapBitmap counting – virtual bitmap

HASH(yellow)=01100011

Problem: estimate inaccurate when few flows active

Page 19: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Bitmap counting – multiple bmpsBitmap counting – multiple bmps

Solution: use many bitmaps, each accurate for a different range

Page 20: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Bitmap counting – multiple bmpsBitmap counting – multiple bmps

HASH(pink)=11100000

Page 21: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Bitmap counting – multiple bmpsBitmap counting – multiple bmps

HASH(yellow)=01100011

Page 22: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Bitmap counting – multiple bmpsBitmap counting – multiple bmps

Use this bitmap to estimate number of flows

Page 23: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Bitmap counting – multiple bmpsBitmap counting – multiple bmps

Use this bitmap to estimate number of flows

Page 24: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Bitmap counting – multires. bmpBitmap counting – multires. bmp

Problem: must update up to three bitmaps per packet

Solution: combine bitmaps into one

OR

OR

Page 25: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

HASH(pink)=11100000

Bitmap counting – multires. bmpBitmap counting – multires. bmp

Page 26: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Bitmap counting – multires. bmpBitmap counting – multires. bmp

HASH(yellow)=01100011

Page 27: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Talk structureTalk structure

• Per packet processing for bitmap algorithms

• Computing flow count estimates from bitmaps

• Variance analysis of estimates

• Derived algorithms

• Related work

• Measurements

• Conclusions

Page 28: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Basic estimatesBasic estimates

Direct bitmap

Virtual bitmap

Page 29: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Multiresolution bitmap estimateMultiresolution bitmap estimate

Find most accurate Find most accurate componentcomponent

Estimate number of Estimate number of flows hashing to itflows hashing to it

Apply scaling factorApply scaling factor

Page 30: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Talk structureTalk structure

• Per packet processing for bitmap algorithms

• Computing flow count estimates from bitmaps

• Variance analysis of estimates

• Derived algorithms

• Related work

• Measurements

• Conclusions

Page 31: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Relative error in estimatesRelative error in estimates

Direct bitmap

Virtual bitmap

Multiresolution

bitmap

Page 32: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Error of virtual bitmapError of virtual bitmap

Flow density (flows/bit)

Ave

rage

(re

lati

ve)

erro

r

Page 33: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Memory requirementsMemory requirements

Direct bitmap < N / ln (Nε2+1)

Virtual bitmap 1.5441/ ε2

Multiresolution bitmap 0.9186 ln (Nε2) / ε2+ct.

Page 34: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

100 million flows, error 1%100 million flows, error 1%

Hash table* 1.21 Gbytes

Direct bitmap 1.29 Mbytes

Virtual bitmap* 1.88 Kbytes

Multiresolution bitmap 10.33 Kbytes

Page 35: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Talk structureTalk structure

• Per packet processing for bitmap algorithms

• Computing flow count estimates from bitmaps

• Variance analysis of estimates

• Derived algorithms

• Related work

• Measurements

• Conclusions

Page 36: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Triggered bitmapTriggered bitmap

• Need multiple instances of counting algorithm (e.g. port scan detection)

• Many instances count few flows

• Triggered bitmap– Allocate small direct bitmap to new sources– If number of bits set exceeds trigger value, allocate

large multiresolution bitmap

Page 37: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Talk structureTalk structure

• Per packet processing for bitmap algorithms

• Computing flow count estimates from bitmaps

• Variance analysis of estimates

• Derived algorithms

• Related work

• Measurements

• Conclusions

Page 38: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Related workRelated work

• Flajolet, Martin (1985) probabilistic counting – Memory use similar to multiresolution bitmap

• Whang et al (1990) introduce direct bitmap• You, Chang (1996) use virtual bitmap• Chauduri, Motwani, Narasayya (1998)

– Counting flows without bias impossible from sampled data

• Duffield, Lund, Thorup (2002) – Accurate solutions based on counting TCP SYN flags

Page 39: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Talk structureTalk structure

• Per packet processing for bitmap algorithms

• Computing flow count estimates from bitmaps

• Variance analysis of estimates

• Derived algorithms

• Related work

• Measurements

• Conclusions

Page 40: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Multires. bmp. vs. prob. countingMultires. bmp. vs. prob. counting

Number of flows (log scale)

Ave

rage

(re

lati

ve)

erro

r

Page 41: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Scan detection memory usageScan detection memory usage

Interval

length

Snort

(naïve)

Probabilistic

counting

Triggered

bitmap

12 seconds 1.94 M 2.42 M 0.37 M

600 seconds 49.60 M 22,34 M 5.59 M

Page 42: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Talk structureTalk structure

• Per packet processing for bitmap algorithms

• Computing flow count estimates from bitmaps

• Variance analysis of estimates

• Derived algorithms

• Related work

• Measurements

• Conclusions

Page 43: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

A family of counting algorithmsA family of counting algorithms

Setting Algorithm Applications

General counting Multiresolution bmp. Track infections

Narrow range Virtual bitmap Triggers (e.g. DoS)

Small counts common Triggered bitmap Port scans

Stationarity Adaptive bitmap Measurement

Add and delete Increment-decrement Scheduling

Page 44: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Bitmap counting algorithmsBitmap counting algorithms

• A family of algorithms that can be used as building blocks in various systems

• Algorithms can be adapted to application

• Low memory and per packet processing

– With 2Kbytes error around 1%

Page 45: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

The endThe end

Bitmap algorithms will be available at:

http://ial.ucsd.edu/bitmaps/

Any questions?

Acknowledgements: Vern Paxson, David Moore, Philippe Flajolet, Marianne Durand, Alex Snoeren, K Claffy, Stefan Savage, Florin Baboescu, NIST,NSF

Page 46: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Adaptive bitmapAdaptive bitmap

• Virtual bitmap measures accurately number of flows if range known in advance

• Often number of flows does not change rapidly• Measurement repeated• Can use previous measurement to tune virtual

bitmap• Combine a large virtual bitmap with a small

multiresolution bitmap used for tuning

Page 47: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Adaptive bitmap accuracyAdaptive bitmap accuracy

Number of flows (log scale)

Ave

rage

(re

lati

ve)

erro

r

Page 48: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

With 2 kilobytes of memoryWith 2 kilobytes of memory

Adaptive bitmap

(min avg max)

Probabilistic counting

(min avg max)

Trace1 -4.4% 1.1% 4.7% -9.5% 2.8% 13.3%

Trace2 -1.9% 0.7% 2.0% -6.9% 2.8% 7.6%

Trace3 -1.8% 0.6% 1.8% 2.4% 10.2% 17.7%

Page 49: Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003 Bitmap Algorithms for Counting Active Flows on High Speed Links Cristian

Bitmap algorithms for flow counting – Internet Measurement Conference, October 2003

Increment-decrement algorithmsIncrement-decrement algorithms

• Active flow defined as flow with packets in queue

• Must support additions and deletions

• Replace bits of bitmap with counters– Increment when packet arrives– Decrement when packet leaves– Estimate number of flows based on zero counters