Unit 15 of 15 · about 4 hours · measure

Lag, throughput, recovery and duplicate measurement

Contracts without measurements are wishes: lag, duplicates and recovery time are where ordering and effect promises meet reality. Measure them before claiming them.

You'll be able to

  • Measure end-to-end lag, throughput and backlog drain with the durability, concurrency and batching settings labeled.
  • Measure recovery time, duplicate rate and rebalance pause under killed-consumer, replay and late-event faults.

Covers

Lag, throughput, recovery and duplicate measurement
1

Read

In this order, only the parts listed

0 of 3 done

  1. Measuring backlogs and drainAWS Builders' Library - Avoiding Insurmountable Queue Backlogs

    Measuring availability and latency (message age as the lag signal); Backlogs (drain at spare capacity)

  2. Backpressure metricsApache Flink 2.3 - Event Time, State and Checkpointing

    Back Pressure with Task performance metrics: busy, backpressured and idle time per second as the stall signal

  3. Lag monitoring on the logDDIA 2e - Chapters 11 to 13 Batch and Stream Processing

    Chapter 12, When consumers cannot keep up with producers (p. 499): monitor how far a consumer is behind the head of the log and alert before it misses messages

2

Focus on

  • Lag is the log end offset minus the committed offset, reported in records and in time. Report both with the workload and durability settings.
  • A measured number is a labeled example: versions, concurrency, batching, acks, retention and run count travel with it. Unlabeled numbers do not transfer.
  • Duplicates are counted end to end across retry, rebalance and replay faults, not per component. Per-component zeros can hide end-to-end doubles.
  • Recovery time runs from fault injection to caught-up offsets with matching state, not just to process restart.
Common mistakes · 3
  • Reporting a mean without the spread. Backlog and rebalance pauses live in the tail, so report the max and the run count.
  • Measuring throughput the broker accepted. End-to-end goodput counts effects applied once at the sink.
  • Comparing lag across different setups. Batching, acks and partition counts change the numbers, so compare only matched runs.
3

Try it yourself

Closed-book, before checking anything

Run a fixed-rate producer against a bounded consumer, record lag, kill one consumer through a rebalance, and report the lag peak, duplicate count and catch-up time with the full setup label.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.What two numbers make up a lag report, and what travels with them?Answer

    Records behind (end offset minus committed offset) and time behind. The workload, versions, concurrency, batching, acks, retention and run count travel with them.

  2. 2.A consumer is killed at t = 0 s, restarts at t = 2 s, and reaches caught-up offsets with matching state at t = 42 s. What is the recovery time?Answer

    42 seconds, from the fault to caught-up offsets with matching state. The 2-second restart is one step inside it.

  3. 3.Retries show zero duplicates at the producer and the sink counts doubles after a rebalance. Where is the gap?Answer

    The consumer redelivered processed-but-uncommitted records to the new owner. Component zeros hid the end-to-end double; count at the sink.

  4. 4.What does the 5c efficiency run establish that a 5b run does not?Answer

    Fewer messages per operation under the same workload and flags. It measures coordination cost, not stronger correctness.

5

Practice

  • Gossip Glomers 5c: Kafka-style log efficiency

    Run the same two-node kafka command as 5b. The specification asks for significantly fewer messages per operation and fewer compare-and-swap failures on lin-kv while every correctness check still passes; the page calls it a looser definition of success

    Use it as the efficiency drill. Full lag, throughput and recovery measurement with labeled setups is section mini-project work.

You're done when

You can report lag, goodput, duplicates and recovery time for a matched run with the full setup label, and say which comparisons that label permits.

Only when you can do this without notes.

Leads to

Notes

Resources · 3 for this unit, 15 more in the section
  • DDIA 2e - Chapters 11 to 13 Batch and Stream ProcessingMartin Kleppmann and Chris Riccomini · primary

    Read batch processing, stream processing and the streaming-systems philosophy in order. For every guarantee, mark the source position, operator state, output effect and recovery boundary it actually covers.

  • AWS Builders' Library - Avoiding Insurmountable Queue BacklogsAmazon Web Services · support

    Read it for how backlogs grow and why they take long to drain, and for backpressure, prioritization, sidelining and constant work. Compare its recovery strategies with the bounded backlog and lag measurements of your consumer.

  • Apache Flink 2.3 - Event Time, State and CheckpointingApache Flink · required

    Read the 2.3 concepts pages on time (event time, watermarks, lateness, windowing) and stateful stream processing (keyed state, checkpoint barriers, recovery, unaligned checkpoints, exactly-once versus at-least-once), then the watermark-generation guide on idle sources. Use them to build one bounded local processor; exactly-once covers state and participating sinks only.

Also in this section