Delivery guarantees lab
Consumers that crash around the acknowledgement. Compare acking before the work, acking after it, and adding an idempotency key, then count lost messages and duplicate side effects.
crash per attempt 15%in the ack gap 50%slow per attempt 0%The model line in each panel is worked out from these three numbers alone.
At least once (work, then ack)
Each square is one finished message, oldest first. Filled green: processed once. Crossed red: lost. Amber with two bars: processed more than once.
- lost
- 0
- processed twice+
- 9
- extra effects
- 10
- redeliveries
- 22
- crashes
- 24
- dedupe hits
- 0
lost 0% model 0%extra effects per message 0.086 model 0.088
| Series | Latest | Lowest | Highest |
|---|---|---|---|
| At least once (work, then ack) | 0 | 0 | 0 |
| Series | Latest | Lowest | Highest |
|---|---|---|---|
| At least once (work, then ack) | 10 | 0 | 10 |
| Guarantee | Published | Finished | Processed once | Lost | Processed twice or more | Extra effects | Redeliveries | Crashes | Dedupe hits | Still in flight |
|---|---|---|---|---|---|---|---|---|---|---|
| At least once (work, then ack) | 119 | 116 | 107 | 0 | 9 | 10 | 22 | 24 | 0 | 3 |
What to try
Each one sets up a starting point. Then make the change it describes.
Acking first loses messages
Pick At most once and put every crash inside the ack gap.
Look for. Every crash after the ack throws a message away for good. The lost count climbs, and nothing is ever processed twice.
Acking last duplicates side effects
Switch to At least once with the same crashes.
Look for. Nothing is lost. A crash after the work but before the ack makes the broker redeliver, and the side effect happens a second time.
An idempotency key stops the second effect
Compare all three modes under the same crashes.
Look for. Redeliveries still happen in the idempotent mode, but the store recognises the message and skips the effect. Lost and duplicate counts both stay at zero.
A slow consumer is enough
Turn crashes off and make 20 percent of attempts slower than the ack timeout.
Look for. The broker gives up waiting and redelivers while the first attempt is still working. At least once duplicates without a single crash.
Writing the key in a separate step
Choose the idempotent mode, write the key in a separate step, and put every crash in the ack gap.
Look for. A crash between the side effect and the key write leaves no record, so the retry repeats the effect. The key only helps when it commits together with the effect.
New to the idea? Read the lesson first. Every number here comes from a seeded simulator, so the same seed gives the same run.
Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms