









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










Ashwin Lall
20th August, 2008
A stream is an ordered tuple over the alphabet
{ 1 , 2 , 3 ,... , n }.
source or destination address ( n = 232 ) source or destination port ( n = 64K) or any combination of flow header fields ( n ≈ 2100 ) Frequency of i th item is mi , and the length of the stream is
m =
∑^ n
i = 1
mi.
The stream is represented by ( a 1 , a 2 , a 3 ,... , am ), where each at ∈ { 1 , 2 , 3 ,... , n }.
Estimating frequency moments (e.g., F 2 is a measure of the “skewness”)
Fk =
∑^ n
i = 1
mki
Estimating entropy (Useful metric for anomaly detection)
∑^ n
i = 1
mi m
log
( (^) m i m
Counting the number of distinct elements:
D = ||{ i | mi 6 = 0 }||
What does it mean when (^1) the number of destination ports spikes? Port scan
(^2) the number of source addresses spikes? Flash crowd
(^3) the number of source addresses to a fixed destination address spikes? DDoS attack
Maintain a record for every distinct flow
Sample (e.g., 1 in 100 packets) - Cisco’s NetFlow
Use a lossy set maintenance data structure (Bloom filter)
Consider the probability of a position in the bitmap being zero at the end: ( 1 − 1 / B ) D^ ≈ e − D / B , where D is the number of distinct items. The expected number of zeroes is B times this (since the bitmap is of size B ), so we have: B − c ≈ B ∗ e − D / B.
Solving for D , we get D = B ln
B B − c
This turns out to be a maximum likelihood estimator for the number of distinct elements.
Estimated number of distinct elements = 4 ∗ ln( 4 / 1 ) = 5. 55 ≈ 6
We look at the number of coupons that he must pick to get the i th distinct coupon: (^1) To get the first coupon, he only needs one try. (^2) To get the second distinct coupon (any of C − 1 of C ) he needs expected (^) CC − 1 tries. · · · (^3) To get the i th distinct coupon (any of C − i + 1 of C ) he needs expected (^) C − Ci + 1 tries. Hence, expected number of tries is 1 + (^) CC − 1 + (^) CC − 2 +... C 1 = C ∗ ( 1 + 1 / 2 + 1 / 3 +.. .+ 1 / C ) ≈ C ln C.
A virtual bitmap is one where the flows are first sampled before being entered into the bitmap. This cuts down the amount of memory by about the sampling factor.
However, from the Coupon Collector’s problem, we know that B ln B distinct flows will (in expectation) fill the bitmap entirely with 1’s.
If we are unsure how large the number of distinct items can get beforehand, we can use bitmaps of various sizes and approximate the value from the one with the most appropriate size.
Number of distinct elements ≈ 16 / 3 − 1 = 4. 33