← Lessons

quiz vs the machine

Gold1400

System Design

At Most Once vs At Least Once vs Exactly Once

The three delivery guarantees a messaging system can offer and the tradeoffs behind each.

5 min read · core · beat Gold to climb

Three guarantees

Messaging systems describe reliability with three labels that say what happens around failures and retries.

  • At most once means a message is delivered zero or one time. The broker never retries, so a crash can drop work. It is fast and simple but lossy.
  • At least once means a message is delivered one or more times. The broker retries until it sees an ack, so a slow ack or crash can cause duplicates.
  • Exactly once means the effect happens precisely once. This is the hardest and usually the most expensive.

How they are achieved

  • At least once comes naturally from ack plus retry. It is the most common default.
  • Exactly once delivery over a network is impossible in the strict sense, so systems approximate it with idempotent processing or deduplication, turning duplicate deliveries into a single effect.

The practical advice: aim for at least once delivery and make your consumer idempotent so duplicates are harmless. That combination behaves like exactly once without the cost.

Key idea

Prefer at least once delivery with an idempotent consumer to get exactly once effects without paying for true exactly once delivery.

Check yourself

Answer to earn rating on the learn ladder.

1. Which guarantee can produce duplicate deliveries?

2. What is the practical way to approximate exactly once effects?

3. Why is true exactly once delivery hard on a network?