5 minute read

Streaming is not a faster version of batch. It is a different contract: the data product becomes available before the input is necessarily complete, late events remain possible, and operational responsibility continues around the clock. Batch is not obsolete, either. It gives a bounded input a clear completion point, makes correction simple, and often produces a cheaper and more reproducible result.

The choice should follow a user-visible service objective, not a preferred framework.

Decision tree and weighted scorecard for stream versus batch

Write the product contract first

Describe a useful result, not just a pipeline shape:

Product:   account fraud score
Consumer:  authorization decision service
Freshness: p95 <= 3 seconds after valid event
Coverage:  99.99% of events eligible for real-time score
Correction: late features supersede; original decision is immutable
SLO:       99.95% scoring availability

That contract already distinguishes transport arrival from event correctness. A score can be delivered in three seconds using the features available at that moment while a batch job later adds a late transaction. If downstream consumers expect a row to mean “final,” that distinction is a product and schema issue, not a latency tuning problem.

Evaluate six dimensions

Freshness and latency

Ask when delay destroys value. Fraud scoring before authorization needs sub-second to low-second results. An executive margin dashboard refreshed before the morning meeting can usually accept hourly or daily batch. Measure both p50 and p95 end-to-end latency. A pipeline with 200 ms averages can still have a five-minute tail caused by a keyed retry.

Completeness and lateness

Streaming computes on an observed prefix. Event-time watermarks bound the expected input, but they do not prove that every upstream source has arrived. Batch processes a known, finite partition and can declare a run complete. If a user expects totals, define “as of” semantics:

revenue_2020_05_13: $1,204,223
as_of:              2020-05-14T05:00:00Z
late_adjustment:    enabled

Correction and replay

Determine whether old results are immutable, superseded, or corrected in place. Append-only event logs favor streaming. Reconciled finance tables often need deterministic backfills that replace a complete partition. A correction strategy should state the replay horizon, idempotency key, and consumers’ behavior when a prior value changes.

Team and operating model

A continuous pipeline brings on-call load, checkpoints, broker retention, schema compatibility, lag metrics, and state evolution. A batch pipeline brings scheduling, rerun behavior, dependency management, and deadline recovery. Choose the model the organization can operate every day. Ownership is part of architecture.

Cost and volume

Compare cost per useful product update, not only compute price. A five-minute batch job can be idle the other 23 hours and 55 minutes. A streaming cluster can spend most of its capacity waiting for traffic or can collapse a large event burst into a useful continuous result. Include broker, state storage, monitoring, idle reservations, and engineering time.

Workload shape

Bursty millions-of-record inputs with expensive global sorts usually fit batch. Small stateful updates with event-time joins often fit streaming. A high volume alone does not force streaming, and low volume does not guarantee batch: low-volume fraud detection can have strict seconds-level freshness.

Concrete workload 1: fraud scoring

The first use case is an authorization decision:

{
  "event_id": "txn-8f2a",
  "account_id": "a-91",
  "amount_cents": 29900,
  "merchant_id": "m-404",
  "event_time": "2020-05-14T14:00:02.314Z"
}

A batch design can ingest all transactions hourly, join features, build a model-score table, and let the authorization API use only the previous snapshot. That architecture is correct but may miss a burst occurring three minutes ago. For this product, freshness is the feature.

Use a streaming path:

event log -> validate -> account-keyed state -> feature vector
          -> model service -> decision store -> authorization API

Persist decisions as:

Field Example Reason
event_id txn-8f2a idempotent retries
feature_snapshot_version 2020-05-14-v7 reproduces score
decision_time timestamp measures latency
score 0.87 available feature result
rule_version fraud-12 audit and correction
decision_final true consumer contract

Keep an immutable model input record and a batch training path over historical data. The real-time service produces decisions; it does not become the sole data warehouse.

Concrete workload 2: daily finance close

The second product is a ledger-derived daily financial report. It must reconcile invoices, refunds, foreign-exchange rates, and late accounting adjustments. Finance asks not for “the latest guess” but for a reproducible close certified after completeness checks.

A batch design is the stronger fit:

warehouse snapshot
  -> validate source control totals
  -> calculate ledger facts
  -> reconcile dimensions and currencies
  -> publish versioned partition
  -> finance sign-off

Partition names should express the business day and publication version:

s3://finance/ledger/dt=2020-05-13/version=2020-05-14T05-00Z/

The job can run once after source close, then rerun idempotently into a new version if a late correction arrives. The atomic catalog or manifest swap makes either the old or new report visible, never a mixture.

The same use case, two architectures

Consider a 15-minute active-user metric used both on an operations wallboard and in a retention table.

The batch architecture is:

object landing -> hourly read -> dedupe -> 15-minute aggregates
               -> overwrite completed partitions -> query table

Strengths include bounded reruns, simple backfill, and low operating cost. Its freshness is limited by schedule and input arrival.

The streaming architecture is:

event log -> event-time window -> keyed state -> watermarked aggregate
          -> upsert current result -> query endpoint

Strengths include fast visibility and continuous state. Its results may be preliminary until the watermark advances, and updates can change with late data.

For this single metric, neither result should silently pretend to be the same thing. Publish both semantics explicitly:

CREATE VIEW active_users_latest AS
SELECT window_end, distinct_users, updated_at, 'provisional' AS status
FROM active_users_stream;

CREATE VIEW active_users_final AS
SELECT window_end, distinct_users, published_at, 'certified' AS status
FROM active_users_batch;

A scorecard, not a universal threshold

Score each criterion from 1 to 5, where 5 strongly favors streaming:

Criterion Weight Fraud Finance
Business value lost when delayed 30 5 1
Events naturally incremental 20 5 3
Preliminary results acceptable 15 5 1
High value from retained state 10 4 1
Team can operate continuously 15 4 4
Scale favors continuous processing 10 4 3
Weighted total / 5 100 4.7 2.1

Weights are product-specific. A score is an input to review, not permission to ignore a hard correctness requirement. If the finance data must be final and auditable, “low latency is strategic” does not turn a preliminary stream into a close.

Use hybrid when freshness and completeness differ

Many mature data products use both modes:

                    +--> streaming estimate --> operational consumer
validated event log +
                    +--> periodic batch --> certified analytical table

Keep event validation, schemas, identity rules, and metric definitions shared. The outputs should differ in explicit status, latency, and correction semantics, not in arithmetic. A nightly reconciliation compares the streaming total to the batch total and records a known gap by event ID and source partition.

Suggested SLOs:

stream:
  freshness_p95: 3s
  decision_availability: 99.95%
  maximum_duplicate_business_effect: 0
batch:
  completion_deadline: "06:00 America/Toronto"
  reconciliation_tolerance_cents: 0
  rerun_limit: 2

The default is not “stream everything.” Begin with the freshest result the consumer truly needs, then ask what is made uncertain by processing before closure. Streaming is the right answer when that uncertainty is acceptable and valuable; batch is the right answer when bounded completeness, reproducibility, or cost dominates. Hybrid is the right answer when both service levels are real, provided the interface labels which result is provisional and which is certified.