AI Hints
Home›System Design Tutorial›Logs and Guarantees
System Design · Lesson 68 of 120

Delivery Guarantees

At most, at least, exactly once.

⏱ 2 min read▶ Video at 1:21:33🎓 Free
Watch this lesson in the System Design courseWatch on YouTube ↗Full System Design course

Networks fail, and workers crash. So a message system must choose. If something goes wrong, is it better to lose a message, or to deliver it twice?

Delivery Guarantees
From the video: Delivery Guarantees
  • Things go wrong
  • Lose a message?
  • Or deliver it twice?

Three guarantees

At most once means a message is delivered once, or not at all. Nothing is repeated, but some messages may be lost. At least once means every message arrives, but some may arrive twice. And exactly once means every message has its effect once. It's the hardest, and usually needs help from the application.

GuaranteeLost?Duplicates?
At most oncemaybenever
At least oncenevermaybe
Exactly oncenevernever (hard)

What most systems do

Most real systems choose at least once delivery, because losing an order or a payment is worse than seeing it twice. Then they make consumers handle duplicates safely. Together, that gives an effect of exactly once. That's what the next lesson is about.

keyvalue
Losing datausually worst
Chooseat least once
Thenhandle duplicates
Resulteffectively once

Summary

Messages can be delivered at most once, at least once, or exactly once. Most systems pick at least once, and handle duplicates. Next, consumers that handle duplicates safely.

Key takeaways
  • At most: may lose
  • At least: may repeat
  • Exactly: hard
Next up: Idempotent Consumers — handling duplicates