Batch vs stream
0-day streakReview

Your progress

Level 1

0 XP100 XP to level 2
0day streak
0best streak
0topics started
0cards reviewed
    Review cards

    Progress is stored only in this browser. No account is required.

    Layer 3 · Go deeper · 9 min

    Go deeper

    Size it, build it, then make the calls an interviewer will push you on.

    Back of the envelope

    Size it up

    Tap through each step of the arithmetic.

    How stale can a batch result get?

      How much state does counting 1M clicks a second per ad need?

        What does an always-on stream cost against a nightly job?

          Build-up · 6 steps

          Watch one window fire, then fix itself

          One-minute event-time windows over clicks, with a 10 s watermark and 2 minutes of allowed lateness, as in the ad-click design.

          Step 1 of 6

          Events arrive out of order

          Each dot is a click, placed by when it happened, across, and when the job saw it, down. Basements and congested links make the order messy.

          4 interview moments

          You’re the candidate

          The interviewer pushes on the hard parts. Pick an approach and see how it holds up.

          1. Deep dive 1 of 4

            Interviewer

            “An ad network takes 1M clicks a second. It needs live dashboards, budget pacing and exact bills. How do you count?”

            Your move. Pick an approach:

          2. Deep dive 2 of 4

            Interviewer

            “UPI fraud scoring gets perhaps 100–200 ms inside the payment flow. Where do features like “new payees in 10 minutes” come from?”

            Your move. Pick an approach:

          3. Deep dive 3 of 4

            Interviewer

            “A bug corrupted a week of output from a stream job handling 1M events a second. How do you fix it?”

            Your move. Pick an approach:

          4. Deep dive 4 of 4

            Interviewer

            “Your stream job texts customers when an order is late. After a crash and restore, some get the same SMS twice. Why, and the fix?”

            Your move. Pick an approach: