chapter seven

7 Windowed computations

 

In this chapter:

  • Standard windowing strategies
  • Time stamps in events
  • Windowing watermark and late events

The attention span of a computer is only as long as its powercord.

— Unknown

In the previous chapters, we have built a streaming job to detect fraudulent credit card transactions. There could be many analyzers that use different models, but the basic idea is to compare the transaction with the previous activities on the same card. Windowing is designed for this type of work and we are going to learn the windowing support in streaming systems in this chapter.

7.1 Slicing up real-time data

As the popularity of Tim and Tracy’s new product has grown, so has the attention of new types of hackers. A group of hackers has started a new scheme involving gas stations.

Here’s how it works: they capture an innocent victim’s card information and duplicate it across multiple new physical credit cards. From here the attackers will send the newly created fraudulent cards out to others in the group and orchestrate spending money on the same credit card across multiple locations across the world at the same time to purchase gas. They hope that by charging the card all at once, the card holder will not notice the charges until it’s too late. The result is free gas. Why do they go to a global scale to try and get free tanks of gas? We can consider this a mystery.

Diagram Description automatically generated

7.1.1 How do we prevent this scam?

7.2 Breaking down the problem in detail

7.3 Breaking down the problem in detail (cont)

7.4 Two different contexts

7.5 Windowing in the fraud detection job

7.6 What exactly are windows?

7.7 Looking closer into the window

7.8 New concept: windowing strategy

7.9 Fixed windows

7.10 Fixed windows in the windowed proximity analyzer

7.11 Detecting fraud with a fixed time window

7.12 Fixed windows: time vs. count

7.13 Sliding windows

7.14 Sliding windows: windowed proximity analyzer

7.15 Detecting fraud with a sliding window

7.16 Session Windows

7.17 Session Windows (cont.)

7.18 Detecting fraud with session windows

7.19 Summary of windowing strategies

7.20 Slicing event stream into data sets

7.21 Windowing: concept or implementation

7.22 Another look

7.23 Key-value store 101

7.24 Implement the windowed proximity analyzer

7.25 Event time and other times for events

7.26 Windowing watermark

7.27 Late event