



















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!




















The Stream Model
Sliding Windows
Counting 1’s
Data enters at a rapid rate from one or more input ports.
The system cannot store the entire stream.
How do you make critical calculations about the stream using a limitedamount of (secondary) memory?
In general, stream processing is important for applications where
New data arrives frequently.
Important queries tend to ask about themost recent data, or summaries of data.
Mining query streams.
Google wants to know what queries aremore frequent today than yesterday.
Mining click streams.
Yahoo wants to know which of its pagesare getting an unusual number of hits inthe past hour.
Intelligence-gathering.
Like “evil-doers visit hotels” at beginning ofcourse, but much more data at a muchfaster rate.
Who calls whom?
Who accesses which Web pages?
Who buys what where?
A useful model of stream processing is that queries are about a
of
length
--- the
most recent
elements received.
Interesting case:
is still so large that
it cannot be stored on disk.
Or, there are so many streams thatwindows for all cannot be stored.
Problem
: given a stream of 0’s and 1’s,
be prepared to answer queries of theform “how many 1’s in the last
bits?”
where
Obvious solution
: store the most recent
bits.
When new bit comes in, discard the
N
st
bit.
You can’t get an exact answer without storing the entire window.
Real Problem
: what if we cannot afford
to store
bits?
E.g., we are processing 1 billion streamsand
N
= 1 billion, but we’re happy with an
approximate answer.
13
0 1 0 0 1 1 1 0 0 0 1 0 1 0 0 1 0 0 0 1 0 1 1 0 1 1 0 1 1 1 0 0 1 0 1 0 1 1 0 0 1 1 0 1 0
1 1 2 2 3 4
10
N
We can construct the count ofthe last
N
bits, except we’re
Not sure how many of the last6 are included.
?
6
Stores only O(log
2
) bits.
Easy update as more bits enter.
Error in count no greater than the number of 1’s in the “unknown” area.
Instead of summarizing fixed-length blocks, summarize blocks with specificnumbers of 1’s.
Let the block “sizes” (number of 1’s)increase exponentially.
When there are few 1’s in the window, block sizes stay small, so errors aresmall.
Store O(log
2
) bits per stream.
Gives approximate answer, never off by more than 50%.
Error factor can be reduced to any fraction> 0, with more complicated algorithm andproportionally more stored bits.
*Datar, Gionis, Indyk, and Motwani
in the DGIM method is a
record consisting of:
The timestamp of its end [O(log
N
) bits].
The number of 1’s between its beginningand end [O(log log
N
) bits].
Constraint on buckets
: number of 1’s
must be a power of 2.
That explains the log log
N
in (2).
Either one or two buckets with the same power-of-2 number of 1’s.
Buckets do not overlap in timestamps.
Buckets are sorted by
(# of 1’s).
Earlier buckets are not smaller than laterbuckets.
Buckets disappear when their end-time is >
time units in the past.