Menu

Kafka interview question · Question 2 of 2

What is at-least-once delivery and what problems can it create?

  • Medium
  • conceptual / scenario
  • ~7 min
  • High relevance
  • 2 min read
  • Updated Oct 2026

Short answer

At-least-once delivery guarantees that every message is processed, but a message may be processed more than once. In Kafka it typically comes from processing a record and then committing its offset: if the consumer crashes after processing but before committing, it reprocesses that record on restart. The problem is duplicates, such as double-counted metrics or repeated side effects, so the processing and the sink must be idempotent, for example by upserting on a unique event id.

On this page
  1. Detailed explanation
  2. Making duplicates harmless
  3. Common mistakes

Detailed explanation

poll → process → write to sink → commit offset
                              ↑ crash here → record is processed again after restart

Duplicates also arise from producer retries (mitigated by idempotent producers, enabled by default in modern Kafka clients) and from rebalances.

Making duplicates harmless

  • Idempotent writes: upsert or MERGE on a unique event id.
  • Deduplication: keep a record of processed ids within a time window (streaming engines support watermark-bounded dedup).
  • Side effects: record that an email or payment was sent, keyed by event id, before sending again.

Common mistakes

  1. Using auto-commit and assuming it gives exactly-once.
  2. Believing Kafka transactions make writes to an external database exactly-once.
  3. Counting events in a sink that appends blindly.

By Data Career Hub Editorial · Last reviewed Oct 2026

Progress is saved in this browser only. No account needed.

Search
Filter by type