learn-streaming-data-with-phoebe / Session 1 of 6
Learn Streaming Data with Phoebe · Session 1 of 6

The stale dashboard

At 11:41pm someone buys a $42 coffee gift bundle at Daybreak. The nightly pipeline picks it up at 2am, and at 9am the revenue dashboard is perfect. Then the day starts. At 2pm the dashboard still shows midnight, and someone in a meeting is making a lunch-promotion call on numbers that are 14 hours old. This course is about closing that gap - and about the surprising number of times you should not.

🟢 Start here Anyone who has waited for tomorrow's dashboard Knows what a pipeline is, wants the real-time layer 45 min
0-3 · Welcome 3-18 · Events, freshness, and what batch really costs 18-40 · Build-along: read the 2pm dashboard honestly 40-45 · Q&A
Part 0

Where this course goes

Six sessions, one running artifact: the coffee shop's order stream. Today the dashboard is a nightly batch. By session 6 it is a live, windowed, watermarked aggregate that is fresh to the second AND right to the cent - and you will know exactly which of those steps your own systems actually need.

🎫 Clear all three quiz questions to stamp your passport Live = presented in the 45 minutes Self-study = the full depth, after class

★ What you walk out with: the freshness-versus-correctness frame that carries the whole course, a working definition of an event, and a one-page test for whether a use case deserves streaming at all. Plus the 2pm dashboard - the simulator you will upgrade lever by lever for five more sessions.

Part 1 · covers the problem

The batch day, hour by hour 6 min live

Nothing in the nightly pipeline is broken. Every number it publishes is exactly right. The problem is purely WHEN it publishes them.

One day with a nightly batch 11:41pm order #8412 $42 bundle 2:00am batch job runs, covers through midnight 9:00am dashboard perfect, 9 hours old 2:00pm promo decision made on 14-hour-old numbers The pipeline never failed. The decision still used yesterday's world.
🔍 Click to zoom - the gap between when data happens and when anyone can see it.
Live Freshness and correctness are two different axes 4 min ▶

The nightly dashboard scores perfectly on one axis and terribly on the other. Everything it shows is correct: totals reconciled, duplicates cleaned, late records folded in. But its freshness is whatever the clock says minus the last batch run - at 2pm, that is 14 hours.

Streaming systems make the opposite trade by default. They can show you an order seconds after it happens, and in doing so they inherit every mess the batch job used to clean up overnight: retries that arrive twice, orders that arrive late, records that land in the wrong hour. Fresh but sloppy is the starting point, not the goal.

  • Batch: correct, then eventually fresh (tomorrow).
  • Naive streaming: fresh, then eventually correct (if you do the work).
  • The craft of this course: fresh AND correct, on purpose.
Real world

A retail team ships a "real-time" sales feed in a week and celebrates. A month later finance reconciles it against the ledger and finds it over-reports by 3 to 4 percent - producer retries were counted twice. The feed was fresh the whole time. Nobody had asked whether it was right.

Self-study Why the batch job exists at all 4 min ▶

The nightly batch is not a legacy embarrassment. It is a genuinely good design for its constraints: it sees the WHOLE day before it aggregates, so late arrivals, retries and corrections have all landed by the time it runs. Completeness is cheap when you are willing to wait.

That is the standing tension. A batch job answers with everything known at run time. A stream answers NOW, with only what has arrived so far. Every technique in sessions 2 through 5 - idempotency, event-time windows, watermarks, replay - is a way of buying back, at 2pm, the completeness the batch job gets for free at 2am.

Part 2 · covers events

An event is a fact, not a row 6 min live

Before any tooling, one mental shift. The Kafka documentation defines it plainly: an event records the fact that something happened. Facts do not change. That single property is what everything else is built on.

A row: the latest state order 8412 · status refunded paid? shipped? when? the history was overwritten each time Events: every fact, kept 23:41 order 8412 placed · $42 23:42 payment approved 08:15 shipped 13:02 refunded append only - nothing is ever edited The row is a summary. The events are the evidence. Streams carry the evidence.
🔍 Click to zoom - the same order as one mutable row versus four immutable facts.
Live Why immutability is the load-bearing property 4 min ▶

Because a fact never changes, you can hand the same event to five different consumers and they can each build their own view of the world - a revenue total, a fraud score, an inventory count - without coordinating with each other. And because the facts are kept in order, any of those views can be rebuilt from scratch by replaying them.

Martin Kleppmann's framing is the cleanest: the database you read from is just a cached view of the event log. When something goes wrong, you replay the events in the same order and reconstruct exactly what happened. That idea returns in session 5 as your correction mechanism, and in session 6 as an entire architecture.

Real world

Bank statements have worked this way for centuries. Nobody edits last Tuesday's transaction when a refund happens - a new correcting entry is appended. Accountants discovered append-only logs long before software did.

Self-study Event time versus arrival time - the seed of sessions 4 and 5 3 min ▶

Every event in tonight's simulator carries two timestamps. WHEN it happened (the customer tapped pay at 23:41) and WHEN the system heard about it (maybe 23:41, maybe 2:50am if the store's tablet was offline). For on-time events the two are the same and nobody cares. For late ones they diverge, and which timestamp you aggregate by decides whether your hourly chart tells the truth.

Hold the distinction; do not solve it yet. It becomes the whole of session 4 (windows) and session 5 (watermarks).

Part 3 · covers the decision

Most dashboards do not need this 6 min live

An honest streaming course starts by shrinking its own market. The evidence says most analytical workloads are small, recent-biased, and served perfectly well by batch.

Does acting within seconds change the outcome? Yes: stream it fraud blocks · outage alerts rule-based ops monitoring No: batch is the right answer weekly reviews · finance close most executive dashboards The middle: freshness is nice, correctness is mandatory the 2pm promo call · live ops dashboards · this course lives here The question is never "can we stream it". It is "what decision gets better if we do".
🔍 Click to zoom - the three-zone test for whether a use case deserves streaming.
Live The numbers that deflate the hype 4 min ▶

Jordan Tigani, a founding engineer of BigQuery, published the uncomfortable measurements: among customers actually paying for the service, 90 percent of queries processed less than 100MB of data, and heavy users' median total storage was under 100GB. He also measured the recency bias - data more than a week old is roughly 20 times less likely to be queried. Most "big data real-time" needs are neither big nor real-time.

And streaming's price is not only infrastructure. Gunnar Morling, who builds these systems for a living, puts the cost where it belongs: the price is complexity - reasoning about streaming joins, late data, and reprocessing is genuinely harder than reasoning about a nightly job.

  • The steelman is real too. Fraud detection, anomaly detection, and rule-based alerting are the canonical cases where seconds change the outcome - a fraud block after the money leaves is worthless.
  • And once teams taste it, they keep it. Morling again: experience a data freshness of a second or two in your warehouse and you never want to go back.

The test to carry: name the decision, name who makes it, and name what changes if they make it 12 hours sooner. If nothing changes, a nightly batch was the correct engineering answer, not a compromise.

Build-along

Read the 2pm dashboard honestly ★ 22 min · everyone builds

This is the simulator you will upgrade for the rest of the course. One deterministic day of coffee-shop orders. Tonight it runs the way most companies actually run: a nightly batch, viewed at 2pm.

Read the two headline numbers together, never alone. Freshness lag says 14h - the batch covered through midnight and it is now 2pm. Accuracy says "showing yesterday" because there is nothing of today on screen at all: $0 shown of the $3,723 that has really happened.

Look at the chart. The dashed outlines are what really happened hour by hour (by event time). The solid bars are what the dashboard displays. Tonight the solid bars are simply absent - that emptiness IS the 14 hours.

Now argue the batch job's side out loud: everything it DID show this morning was exactly right, retries deduplicated and stragglers included, because it waited for the whole day to land before counting. Old but honest. Hold on to that standard - next session, the moment you flip the stream on, you will watch freshness arrive and honesty leave.

Why the numbers are trustworthy: the order generator is a fixed-seed teaching simulation, but every figure on that panel is genuinely computed from the generated events - nothing is scripted. When a number moves in a later session, it moves because the semantics you switched on changed the arithmetic.

Homework

Before session 2 15 min

Check yourself

Three questions

1. At 2pm, what is actually wrong with the nightly batch dashboard?

The batch job waited for the whole day, so it cleaned retries and caught stragglers. Its failure is freshness, not correctness - that is the axis streaming attacks.

2. What is an event, in the sense this course uses the word?

The Kafka docs' own definition: an event records the fact that something happened. Facts never change, which is why they can be replayed and shared safely.

3. Which of these most clearly justifies streaming?

Fraud blocking is the canonical case where acting within seconds changes the outcome. The other two are correctness-mandatory, freshness-optional - batch territory.

Answer all three to see your score.

Sources this session stands on

What was covered

✓Apache Kafka docs · Introductionthe event definition, events as immutable facts
✓Tigani · Big Data is Dead (MotherDuck, 2023)90% of queries under 100MB, recency bias, the case against reflexive streaming
✓Morling · Streaming vs Batch is a Wrong Dichotomy (2025)complexity as the real price, freshness as the real prize
◐Apache Flink · Use casesthe steelman list: fraud, anomaly detection, alerting - deepened in session 6
◐Kleppmann · events and stream processingthe log as the source of truth - the full treatment arrives in session 5

Session 1 cheat sheet

EventAn immutable record that something happened, with a timestamp. Never edited, only appended.
Two axes, not oneBatch is correct then eventually fresh. Naive streaming is fresh then eventually correct. The craft is both.
Event time vs arrival timeWhen it happened vs when the system heard. They diverge for late events - sessions 4 and 5 live in that gap.
The three-zone testDoes acting within seconds change the outcome? Yes: stream. No: batch. Freshness nice but correctness mandatory: the middle, this course.
The deflating numbers90% of real queries under 100MB; week-old data ~20x less queried. Most dashboards do not need streaming.
Batch's honest virtueIt sees the whole day before counting, so completeness is free. Streaming must buy completeness back with technique.