AlgoMaster Logo

Delivery Semantics

High Priority12 min readUpdated October 14, 2026
AI Mock Interview

Practice this topic in a realistic system design interview

Premium Video

This video is available to premium subscribers only

Unlock Full Access

Over an unreliable network, a sender cannot always know whether a message was processed. So every messaging system has to choose how it behaves when that uncertainty appears.

In this chapter, we'll look at what at-most-once, at-least-once, and exactly-once really mean, and how real systems avoid losing or duplicating messages.

Suppose an order service sends a message to a payment service saying, "charge this customer $50." The order service waits for a response, but nothing comes back.

What happened? There are three possibilities:

  1. The message was lost before it reached the payment service.
  2. The payment service received it, charged the customer, and then the response was lost on the way back.
  3. The payment service is simply slow, and the response is still on its way.
alt[Request lost][Response lost]Never sees the messageCharges the cardStill working...All three look the same: silenceCharge customer $50Response lost on the way backOrder ServicePayment Service
6 / 6
algomaster.io

From the sender's side, these three cases look identical. All it sees is silence.

Now the sender has to make a decision. If it does not retry, the payment may never happen. If it does retry, the customer may be charged twice.

This is the core problem behind delivery semantics.

1. The Three Guarantees

There are three common delivery guarantees:

  • At-most-once: A message is delivered once or not at all. It may be lost, but it is never duplicated.
  • At-least-once: A message is never lost, but it may be delivered more than once.
  • Exactly-once: Every message affects the system one time, with no loss and no duplicates.
GuaranteeRetry?When the consumer acknowledgesMain Risk
At-most-onceNoBefore processingMessage loss
At-least-onceYes, until acknowledgedAfter processingDuplicates
Exactly-onceYesAfter processing, plus deduplicationMore complexity

Each guarantee comes from a specific choice about when to retry and when to acknowledge. Let's look at each one in detail.

2. At-Most-Once

Premium Content

This content is for premium members only.