Exactly-Once and Its Cost

Concepts covered: Idempotency

Exactly-once semantics (EOS) is the most misunderstood concept in streaming. Candidates either dismiss it as impossible or claim it is the only acceptable guarantee. Neither is correct. EOS is achievable within Kafka, with specific mechanisms, at a specific cost.

Kafka's Three-Layer EOS

The Cost of EOS

DimensionAt-Least-OnceExactly-OnceImpact
ThroughputBaseline15-20% lowerTransaction coordination adds round-trips to the broker
LatencyBaselineHigher (transaction commit)Each transaction has a commit phase before data is visible
ComplexitySimple consumer loopTransaction lifecycle managementBegin, send, commit offsets, commit transaction, handle abort
DebuggingStraightforward offset trackingTransaction state, PID trackingFailed transactions require understanding the transaction coordinator

The Follow-Up Trap

About this lesson

This section is part of the Delivery Semantics: Advanced lesson on DataDriven, the home of data engineering. Lessons cover SQL, Python, Spark, data modeling and pipeline architecture, and each section pairs its explanation with worked examples and practice you run as you go.