Exactly-Once Delivery,這個需求做不了

https://bravenewgeek.com/you-cannot-have-exactly-once-delivery/ 小小摘要 Distributed systems 就是 trade-offs 的權衡。 (傳統)理論上不可能實作出 exactly-once delivery,任何跟你說做得出來的都是唬爛你或是不了解什麼是 distributed systems。實務上可以透過 idempotent (同樣的訊息處理兩次不影響)或是 deduplication 來實現同樣效果。 於是我們只能從 at-most-once 跟 at-least-once 中做選擇,而大家可能都選了 at-least-once。 延伸閱讀 There is no nowin a distributed system. CAP Theorem = consistency, availability, and partition tolerance. Amazon SQS FIFO queue 有支援 exactly-once processing,但實際上也是透過 deduplication 跟 acknowledgement 機制來實現 (fake it),如這篇文章所說明。

January 5, 2022 · 1 分鐘 · maple