Scrivio Interview library
LeadershipPrincipal5 min read · updated 13 November 2026

An ad platform runs separate streaming and batch pipelines for click counts. Streaming numbers feed dashboards and budget pacing, batch numbers feed invoices, and the two differ by up to 2 percent, which advertisers notice and dispute.

As the senior technical leader, do you unify on one click-counting pipeline or keep two, and what accuracy promises do you make to advertisers?

The 2 percent gap comes from late data, different deduplication windows, fraud filtering done only in batch and drift between two implementations of the same rules. I would not promise advertisers that two numbers are identical; I would make the promise measurable: invoices come from final numbers, real-time numbers stay within stated bounds of them, and a reconciliation report shows both. Whether to unify depends on whether a single event-time streaming pipeline with long lateness and replay can match batch accuracy, including fraud filtering; if not yet, keeping both with clear roles and one shared rules library is defensible, and moving billing happens only after several cycles in parallel.

Why this question is asked

Two pipelines that count the same clicks and disagree are a slow drain on trust: every disputed invoice costs a support case, and every advertiser who notices the gap wonders which number is real. The temptation is a big rewrite into one pipeline, but billing is the most dangerous system to rewrite. Interviewers ask this to see whether a senior leader diagnoses before deciding, weighs migration risk honestly, and turns a vague promise of accuracy into something measurable. In this answer, we will find where the gap comes from, compare unifying with keeping two pipelines, define accuracy promises, plan a safe move of billing, and give a recommendation.

1Where the 2 Percent Comes From

Before choosing an architecture, we break the difference down, ideally per ad format and per day, by re-running both pipelines' rules on the same sample of raw events. The causes are usually a small set.

Sources of difference (illustrative)
CauseStreamingBatch
Late datacloses windows after 10 minutessees everything up to the next day
Deduplication windowclick ids kept 1 hourwhole day
Fraud filteringsimple rules onlyfull model with day-level features
Rule driftown implementationown implementation, changed separately

Notice that some causes are legitimate and some are defects. Fraud filtering that needs a full day of data cannot be identical in a one-minute stream, and late data is a property of the world. Drift between two implementations is a pure defect: the same rule written twice will disagree eventually. A good plan treats the two kinds differently.

2Option 1: One Streaming Pipeline

A single pipeline built on event time, with long allowed lateness and the ability to replay from raw events, removes drift completely, because there is only one implementation. This is often called the Kappa approach: everything is a stream, and recomputation is a replay. Real-time numbers and invoice numbers come from the same code, at different points in time: provisional when a window first closes, final when its lateness period ends.

But it has to meet the bar batch sets today. The streaming fraud filtering must be as good as batch fraud filtering, which may mean holding windows open for hours to compute day-level features, and the system must handle large reprocessing jobs, such as recomputing a quarter after a rule change, without disturbing live processing. If either is not yet true, unifying moves the error rather than removing it.

3Option 2: Keep Two, With Clear Roles

Keeping both is defensible if each has an explicit role. Streaming is labelled provisional everywhere it is shown, and drives dashboards and pacing, where speed matters more than the last fraction of a percent. Batch is the billing truth, with the full fraud model and complete data.

The defect, drift, is removed by building both on one shared library of rules: the click validity rules, deduplication logic and fraud rules that can run in both are one versioned package, tested once, and deployed to both pipelines together. What remains is the legitimate difference from timing and day-level fraud features, which we can measure and bound.

Step throughTwo pipelines on one set of rules
  1. Raw click eventsone source in Kafka and object storage
  2. Shared rules libraryvalidity, dedup and fraud rules, one version
  3. Streaming pipelineprovisional counts in about 1 minute: dashboards, pacing
  4. Batch pipelinefinal counts next day: invoices
  5. Reconciliation reportdifference per advertiser, visible to them

5 layers, from the top down. Step through them one at a time.

4Accuracy Promises Advertisers Can Check

Promises like 'our numbers are accurate' cannot be verified, so they produce disputes. Measurable promises work better. Invoices are always based on final numbers, closed after a stated period. Real-time numbers are provisional and, for example, within 2 percent of final for 99 percent of campaign-days, a bound we measure and publish. And each advertiser can see a reconciliation report showing provisional and final numbers side by side, with the reasons for the difference, such as late clicks and invalid traffic removed.

This changes the conversation. An advertiser who sees a 1.5 percent difference explained as 'invalid clicks removed: 1.2 percent, late clicks: 0.3 percent' has an answer, not a reason to dispute.

5Moving Billing Safely

If we do decide to unify, billing moves last and slowly, because errors there cost money and trust directly. The plan runs the new pipeline in parallel for several billing cycles, generating shadow invoices, and compares them with the real ones per advertiser.

Step throughSwitching billing to a unified pipeline
  1. Shadow invoices from the new pipelinefor at least 3 billing cycles
  2. Per-advertiser difference within 0.1%?and every difference explained
    YesSwitch a small segment firstNoFix the cause, extend the parallel run
  3. Segment stable for a full cycle?disputes, reconciliation
    YesExpand to all advertisersNoRoll the segment back
  4. Retire the batch pipelinekeep its code to rerun old periods

4 steps in order. Play them, or step through them one at a time.

6My Recommendation

I would make the promises measurable now, because that reduces disputes regardless of architecture, and build the shared rules library immediately, because drift is a pure defect. Then I would set a clear condition for unification: when the streaming pipeline matches batch fraud filtering within an agreed tolerance and has proven a full-quarter replay, we start the parallel billing run.

That makes the decision depend on evidence rather than preference. If the streaming pipeline meets the bar, we unify and save the cost of running two systems; if it does not, we keep two with clear roles and a published bound, which advertisers can trust because they can check it.

7Follow-up questions

Is the Lambda architecture, batch plus streaming, outdated?

Not outdated, but costly: two implementations of the same logic tend to drift, and two systems cost more to run. Modern stream processors with event time and replay make a single pipeline viable for many use cases. Whether it is viable for billing depends on whether streaming fraud detection and reprocessing can meet the accuracy bar, which is a question to answer with data.

What bound would you promise for real-time numbers?

One we have measured with margin. If today 99 percent of campaign-days are within 1.5 percent, promising 2 percent is safe. Promising zero difference would be broken the first time a late batch of mobile clicks arrives.

How do you handle invalid clicks found after the invoice?

Through a documented adjustment: the next invoice includes a credit for invalid traffic found later, shown with its reason. Advertisers accept corrections they can see; they dispute numbers that change silently.

8Conclusion

In this answer, we traced the 2 percent gap to late data, different deduplication windows, batch-only fraud filtering and drift between two implementations. We compared one event-time streaming pipeline, which removes drift but must match batch accuracy and handle reprocessing, with two pipelines that have clear roles and one shared rules library. We made accuracy promises measurable, with invoices from final numbers, real-time numbers within a stated bound and a visible reconciliation report, and moved billing only after several cycles of parallel shadow invoices.

What to say in the interviewAbout 90 seconds aloud

Open with

I would start by breaking the two percent down, because the decision depends on where it comes from. It is usually late data, different deduplication windows, fraud filtering that only batch does, and drift between two implementations of the same rules.

Then, if they want more

Some of that is legitimate and some is a pure defect. Drift I would remove right away by putting the validity, dedup and fraud rules in one shared, versioned library used by both pipelines.

On unification: one streaming pipeline with event time, long allowed lateness and replay removes drift entirely, but only if it matches batch accuracy, including fraud filtering with day-level features, and can reprocess a quarter without hurting live traffic.

If it cannot yet, keeping both is defensible with clear roles: streaming labelled provisional for dashboards and pacing, batch as the billing truth.

Either way, I make the promises to advertisers measurable: invoices always come from final numbers, real-time numbers stay within a stated bound of final, for example two percent for ninety-nine percent of campaign-days, and advertisers get a reconciliation report showing both with the reasons for the difference.

And if we do move billing to a unified pipeline, it runs in parallel for several billing cycles producing shadow invoices, we compare per advertiser, switch a small segment first, and only then retire batch.

About this answer

Last updated
13 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "As the senior technical leader, do you unify on one click-counting pipeline or keep two...": https://scrivio-interview-library.netlify.app/architecture/system-design-problems/9985603d3a/