atmostonce
Atmostonce refers to a delivery or processing guarantee in distributed systems whereby each message or request is processed no more than once. Under atmostonce semantics, a receiver may process zero or one execution of a given message; there are no duplicates, but there is a risk that the message is lost if a failure occurs before delivery or acknowledgment.
- Guarantee: 0 or 1 processing of each logical message.
- Duplicates: avoided; no repeated executions due to retries.
- Reliability vs loss: improves simplicity and reduces duplication risk at the expense of potential message loss.
- Messaging and RPC: chosen when systems prefer simplicity or when retrying operations could cause unacceptable side
- Non-critical or idempotent work: suitable for logging, telemetry, or other operations where occasional loss is acceptable.
- Critical transactions: generally inappropriate, as missed events can be unacceptable; often requires at-least-once or exactly-once guarantees.
Comparison with related guarantees
- At-least-once: ensures delivery but may produce duplicates; requires idempotence or deduplication to handle duplicates.
- Exactly-once: delivers and processes a message once and only once; often complex and resource-intensive to implement.
- Acknowledgment-first approach: treat a delivery as complete after a successful acknowledgment, avoiding retries.
- Failure handling: any failure may result in message loss; systems may implement idempotent handlers as a
- Trade-offs: simpler design and lower overhead versus potential data loss in failure scenarios.