6 ms·
How so?
by chairmanwow 9y ago
How so?
- danielblazevski 9y agoIf you have a consumer on some other node that does nothing more that a println statement, you will see that there will be more than once delivery. Exactly once seems to refer to exactly once write to kafka and processing in kafka streams that write back to kafka and don't do stuff like make external http requests, in which case you'll need your logic of at most or at least once to delivery results to wherever you're sending the http requests. Confluence blogs do seem pretty misleading in terms of hiding these issues.
- thanatos_dem 9y agoI think the term they meant to use was “idempotent”, but that doesn’t get attention the same way that claiming to violate the FLP result does.
- danielblazevski 9y agoNot sure that I agree with that. I just think that they are opaque to what they really mean by exactly-once and definitely hide the fact that they do not offer exactly-once delivery.
- deleted 9y ago[deleted]
- thanatos_dem 9y agoWe can look at the ProduceRequest logic in their design doc - (https://docs.google.com/document/d/11Jqy_GjUGtdXJK94XGsEIK7CP1SnQGdp2eF0wSw9ra8/edit#bookmark=kix.x4k78mufyunt https://docs.google.com/document/d/11Jqy_GjUGtdXJK94XGsEIK7C...) Check the sequence number map to determine if the PID is already present. If it is not, check sequence number. If it is 0, insert the PID, epoch, and sequence number into the PID mapping table and proceed to append the entries. If the sequence is not zero, return the InvalidSequenceNumber error code. If the PID is present in the mapping, check the epoch. If the epoch is older than the current one, return InvalidProducerEpoch error code. If the epoch matches the current epoch, check the sequence number: If it matches the current sequence number, allow the append. If the sequence number is older than the current sequence number, return DuplicateSequenceNumber. If it is newer, return InvalidSequenceNumber. If the epoch is newer, check the sequence number. If it is 0, update the mapping and allow the append. If it is not 0, return InvalidSequenceNumber. That's a pretty straightforward approach of enforcing idempotency; checking producer and sequence IDs and throwing them out if they aren't correctly ordered. The other big addition to the code base was cross-partition transactions, which, while pretty cool, is a far cry from "Exactly once delivery".
- ploxiln 9y ago"exactly once" is not possible, but you can do "at least once" and make the processing of the message idempotent or "de-duplicated". This is true of many messaging systems. https://www.confluent.io/blog/exactly-once-semantics-are-possible-heres-how-apache-kafka-does-it/ https://www.confluent.io/blog/exactly-once-semantics-are-pos... > Exactly-once Semantics are Possible: Here’s How Kafka Does it > Now, I know what some of you are thinking. Exactly-once delivery is impossible, it comes at too high a price to put it to practical use, or that I’m getting all this entirely wrong! You’re not alone in thinking that. blah blah blah ... of course it's at-least-once, with the "idempotent producer" so only one resulting message is published back to another kafka stream. Big surprise. Now many people think "kafka has exactly-once delivery, that's what I want, I don't want to have to deal with this at-least-once stuff" when really it's the same thing, and others have been doing idempotent operations of various kinds for years, and the user still has to figure out how to do their desired thing (which might not be sending one more kafka message) in a mostly idempotent way.
- apurvamehta 9y agoFrom the very same blog post: > Is this Magical Pixie Dust I can sprinkle on my application? > No, not quite. Exactly-once processing is an end-to-end guarantee and the application has to be designed to not violate the property as well. If you are using the consumer API, this means ensuring that you commit changes to your application state concordant with your offsets as described here. I think that is a pretty clear statement that end-to-end exactly once semantics doesn't come for free. It states that there needs to be additional application logic to achieve this and also specifies what must be done.
- ploxiln 9y agoRight. But that's at the end of a separate article, while the post which this HN discussion is about throws around the words "exactly once" a lot more casually. The argument is over the use of the words "exactly once". They should just refer to the feature as "transactions" or "idempotent producer".
- dvlsg 9y ago