Librdkafka: EOS support

Created on 7 Jul 2017  Β·  70Comments  Β·  Source: edenhill/librdkafka

Support for Exactly-Once-Semantics as introduced in Apache Kafka 0.11.0.

The message format is already supported which means librdkafka may be used
with EOS-supporting clients (official Java clients) without a performance penalty.

To track popularity, please add a +1 reaction to this comment if this is a feature you need

EOS is made of up three parts:

  • Idempotent producer - guarantees messages are produced once and in order (enable.idempotence=true)
  • Producer Transaction support - commit or fail a set of produced messages and consumer offsets across partitions (BeginTransaction(), SendOffsetsToTransaction(), etc)
  • Consumer transaction support - filter out messages for aborted transactions, and wait for transactions to be committed before processing (isolation.level=read_committed)

We'd be interested to know which functionality you are planning to use, use reactions to vote:

  • πŸ˜† - Idempotent Producer - supported in librdkafka v1.0.0 βœ…
  • πŸŽ‰ - Producer transactions - supported in v1.4.0 βœ…
  • ❀️ - Consumer transactions - supported in v1.2.0 βœ…
conformance enhancement

Most helpful comment

Available in v1.4.0, enjoy!

All 70 comments

We were primarily looking for a transaction aware consumer. So as you mentioned, exposing read_uncommitted=false as a property would really help.
Thanks in advance .

@edenhill do you have an estimated timeline for releasing this feature?
Also, can you suggest a reliable work-around that would ensure exactly once message consumption until this feature is released?

Thanks a lot!

We're aiming for Q2.

If there was a reliable work-around this feature wouldn't be needed, right? ;)

That's true, but it was worth a shot :)
Thanks again!

We also need the EOS feature, and thanks for putting efforts on it! πŸ˜€ Would you mind to share the current development status? Thanks!

@XiaoyaoFan Idempotent producer is scheduled for Q2, EOS for Q3

Is the idempotent producer still on track for Q2?

The plan is now to release all EoS features (idempotent, transactions, EoS) in the same release, which will be in Q3.

We are eagerly waiting for the release that will contain EOS features.

Any update here?

@thebigredgeek We're soon beginning work on the Idempotent producer.

Please vote on what EOS functionality you are planning on using by adding a reaction to the top comment on this issue.

Idempotent producer support is now available for testing on the idempotence branch.
Enable by setting enable.idempotence=true in the producer configs.

For our scenarios we are interested primarily in EOS to solve the Zombie Fencing problem as described here: https://www.confluent.io/blog/transactions-apache-kafka/

Does the work that is in the idempotence branch support transactional.id and is it enough to implement Zombie Fencing?

+1 for EoS (specifically transaction support).

Are you able to offer an update on the expected timeline? Appreciate the work that's being done here πŸ˜„

librdkafka v1.0.0 with idempotent producer support is scheduled to be released within about 1 month.
Early release candidates will be made available within two weeks, we strongly encourage community testing to vet out any corner cases.

@BertusGreeff Theoretically it should be possible to do zombie fencing with idempotent producers, given a transactional.id, but it'll need a bit of implementation on the client and testing to know for sure.

Great to hear @edenhill ! Is there any news about producer or consumer transaction support?

@ianwsperber Consumer transaction support will follow the 1.0.0 shortly. Producer transactions will be late Q4 or 2019.

+1 for transaction/eos support.

+1 for transaction/eos support.

+1 for transaction/eos support.

+1 for transaction/eos support.

+1 for transaction support

edenhill commented on Oct 4

librdkafka >> v1.0.0 with idempotent producer support is scheduled to be released within about 1 month

Hello
Any prgrs with this?

thx

@GeorgeShagov We're on the final leg of the release cycle, pulling in the last fixes and doing final verification. An RC will go out tomorrow and the final release friday or monday.

Thank you, Magnus, this is a good news indeed

Two new issues have recently surfaced which blocks the v1.0.0 release until early next year:

  • #2163 - idempotence: out of order issue after timeout
  • #2164 - consumer: stalled message consumption after cluster failure

We encourage people to try out the v1.0.0-RC5 release candidate in the meantime.

Hi,
Any update on this ?

@edenhill , wondering if the release of the Idempotent producer support is around the corner?

It is! Everything is looking great and we're just finishing up some packaging issues prior to the release.
Will have one of the final RCs later this week hopefully.

librdkafka v1.0.0 has now been released, including idempotent producer support.

Congrats, we’ve been looking forward to this milestone!

@edenhill
Great news, but I have the question:
Which of the original points are supported ?
I assume idempotent producer.
What about transactions ?

@maver1ck We now support the idempotent producer, not transactions.

See release notes here:
https://github.com/edenhill/librdkafka/releases/tag/v1.0.0

In the end, we're looking for feature parity in the .NET client (when compared to the Java client) and the .NET client depends on librdkafka.

@andyczerwonka What features exactly are you missing from the .NET client?

@edenhill sorry, should have been more explicit. We have a use case where transaction support would really help. A batch of messages, in this context, is logically a single document, although the addressable atomic unit is still a single message.

I'm using Kafka for microservices communication. In many cases there is an external counterpart for some internal event or group of them and they have to be dispatched all or none otherwise current bounded context will be out of sync with other contexts. Yes, it is possible to dispatch only internal events and then some other process will read them back and dispatch external events. But internal events are very pure and don't contain all information necessary for external integration events so the whole aggregate has to be resurrected in order to produce a proper external event which is definitely suboptimal.

Are there any defined plans for transactions support?

Here for bunch of use cases it would be extremely useful and mitigation of their absence looks unpretty and not at all optimal.

From the source code librdkafka-1.0.0-RC7, I found that isolation_level is set to READ_UNCOMMITTED for consumer mode. I want read committed messages only, how should I do?

@JiangXiao2019 we're aiming to add READ_COMMITTED support during 2019 Q2 or Q3.

@edenhill does it also mean full transaction support, or just READ_COMMITTED / READ_UNCOMMITTED switch?

It means the consumer will be transaction-aware, filtering out uncommitted/aborted transactions.

Crossing the fingers that transaction-aware producer is also somewhere on the road :D

@edenhill OK, got it, thank you.

@edenhill It's OK for me if consumer can filter out uncommmitted transactions. It seems that aborted transaction has been filtered out in current version, Am I right? Thank you!

@JiangXiao2019 The current version performs no filtering of transactions.

@edenhill And then I have a question, my app use simple consumer mode, it pull messages from kafka with specified offset. The producer was developed by customer, and they used kafka transaction. When I consume the message which offset=100, librdkafka returns offset=101 to me. I checked the kafka server configure, no [compose] options was set. So I think this maybe caused by aborted transactions, messge with offset=100 maybe marked as "aborted" by kafka server.

I'm not aware of any such filtering functionality on the broker.

in rdkafka_broker.c,
/* Ignore aborted transactions for now */
if (AbortedTxCnt > 0)
rd_kafka_buf_skip()

That code ignores the list of aborted transactions, not the aborted transactions themselves

@edenhill Could you help me to know what caused this issue? "When I consume the message which offset=100, librdkafka returns offset=101 to me".
read 100----> returns 101
read 101----> returns 101 too
This happed 500 thousand times in half a day.

@JiangXiao2019 This issue is to track EOS popularity. Please open up a separate issue and provide logs with debug=cgrp,fetch enabled.

@edenhill

Once we have updated librdkafka to 1.0.0 versions accordingly step mentioned in document. While producing we are getting the following error message.
Broker: Message format on broker does not support request

retries = 3
acks = all
retry.backoff.ms = 100
max.in.flight.requests.per.connection = 1
enable.idempotence = true
broker version = 0.11.0.0

@harshadvichare This issue is to track EOS popularity. Please open up a separate issue and provide logs with debug=broker,feature,protocol enabled.

HELP WANTED

To fully understand the user requirements and prioritize accordingly we would like to ask you all to explain how you are aiming to use EOS and Producer Transactions specifically.

So please take a moment to write down your use-case, this will help us know what to implement and when.

We are working on the application with exactly-once guarantee (well, at least we try to achieve it).

There are several microservices that can read from and write to Kafka. Java microservice (and its internal implementation) supports read_committed isolation level, but PHP microservice does not, because at the moment of writing this comment read_committed is not yet implemented in librdkafka, but fortunately WIP.

So, different parts of the application can read committed or not yet committed data, while we must read always only committed data.

We are consuming data from an unreliable source and publishing to kafka. Should we encounter an interruption, we have the possibility to retry the entire stream of data, but we cannot restart from where we were last (no gaurantee data is in the same order or that states have not changed). As it is, we load the entire source into memory/disk and then publish from that "more reliable" source. Ideally we should add some consumer logic to deduplicate in case of a publication error too.

Producer Transations would be an elegant solution to allow us to consume the source, publish immediately and cancel should we encounter a problem with the source and keep our consumer application simple.

Thanks for your work on librdkafka!

We are working on payment domainwhere the whole payment process shld be in
a kafka transaction. And eos is an absolute must.

On Wed, 31 Jul 2019, 17:15 robfr, notifications@github.com wrote:

We are consuming data from an unreliable source and publishing to kafka.
Should we encounter an interruption, we have the possibility to retry the
entire stream of data, but we cannot restart from where we were last (no
gaurantee data is in the same order or that states have not changed). As it
is, we load the entire source into memory/disk and then publish from that
"more reliable" source. Ideally we should add some consumer logic to
deduplicate in case of a publication error too.

Producer Transations would be an elegant solution to allow us to consume
the source, publish immediately and cancel should we encounter a problem
with the source and keep our consumer application simple.

Thanks for your work on librdkafka!

β€”
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/edenhill/librdkafka/issues/1308?email_source=notifications&email_token=ABLKBNHHQGQ4DDG5FJ6HCV3QCFJZTA5CNFSM4DSCPCNKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3GUAEA#issuecomment-516767760,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABLKBND4NE34S33TZA424NTQCFJZTANCNFSM4DSCPCNA
.

We have ETL workflows where we consume data from kafka, transform it, and then produce a new message back onto kafka. We have several hops where we do this consumption, transformation, and production. Some of the hops are in Java, where we get access to EOS semantics, but some of the hops use librdkafka, which means those hops are at-least-once semantics. As soon as any hop in the path is at-least-once, the entire path becomes at-least-once.

Having EOS semantics / producer transaction will eliminate the need for us to build business logic that de-dupes along our ETL path... allowing our entire ETL path to be EOS, regardless of whether we're using Java or not.

To get our events into Kafka, we had publish them in batches. Just want to ensure that either all or no events get into the store so we don’t have any duplication.

Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10


From: Magnus Edenhill notifications@github.com
Sent: Wednesday, July 31, 2019 1:53:47 AM
To: edenhill/librdkafka librdkafka@noreply.github.com
Cc: sean-buchanan seanbuch@outlook.com; Comment comment@noreply.github.com
Subject: Re: [edenhill/librdkafka] EOS support (#1308)

HELP WANTED

To fully understand the user requirements and prioritize accordingly we would like to ask you all to explain how you are aiming to use EOS and Producer Transactions specifically.

So please take a moment to write down your use-case, this will help us know what to implement and when.

β€”
You are receiving this because you commented.
Reply to this email directly, view it on GitHubhttps://github.com/edenhill/librdkafka/issues/1308?email_source=notifications&email_token=AFAWNTE3DVEZ5I3FUWZW52LQCFAIXA5CNFSM4DSCPCNKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3GNEVY#issuecomment-516739671, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AFAWNTDMGPHESOX7VTEHJYDQCFAIXANCNFSM4DSCPCNA.

We are also publishing events in batches. These events are on high load path (up to 50k events per second), so we can't afford duplicate checks for each via external source. So we're doing duplicate check for batches only, which is less. Though far from being ideal.

Also since we cannot pack batches on input side by any other meaningful criteria rather then just a timestamp, we need additional repartitioning after decomposing batch to meaningful events. To enable processing by their groups/accounts.

Hello Magnus

  1. Thanks for your great work!
  2. LATOKEN CEX Exchange Trading Flow is based on Kafka.
  3. In two words: Double Executions/Fills are Huuuge Problem.

thx
George

On 31/07/2019 10:53, Magnus Edenhill wrote:
>
>

HELP WANTED

To fully understand the user requirements and prioritize accordingly
we would like to ask you all to explain how you are aiming to use
EOS and Producer Transactions specifically.

So please take a moment to write down your use-case, this will help us
know what to implement and when.

β€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/edenhill/librdkafka/issues/1308?email_source=notifications&email_token=AJNIJON3XD4ZLHJB3ECXM5DQCFAIZA5CNFSM4DSCPCNKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3GNEVY#issuecomment-516739671,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AJNIJOIB3DMP7ZRYFWUFIKDQCFAIZANCNFSM4DSCPCNA.

Our application uses Kafka to transfer state between two micro-services. We use Compacted Topics and it is critical that the topic always contains the latest message for each key.

Our primary need for Producer Transactions is to implement Zombie Fencing semantics as described here: https://www.confluent.io/blog/transactions-apache-kafka/

Client support needed to enable Zombie Fencing is the ability to associate a transactional.id with a producer and send a single message in a transaction.

we need transaction support to develop our system which is composed of "read-process-write" kafka clients. meaning that the majority of our software components read date from Kafka topics, process it and push the result in other kafka topics.
We need the "read-process-write" to be atomic

I'm writing an ETL system for emails (SMTP) in python providing a easy to use plugin interface. I would like to split the monolith into micro-services and replicas with kafka as backbone. EOL and full transactional behaviour would be a strong requirement to implement a reliable distributed producer-consumer architecture.

Confluent's python library relies on librdkafka: confluentinc/confluent-kafka-python#357

We're processing payments, we'd like to avoid double-spends.

Available in v1.4.0, enjoy!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

roopabayar picture roopabayar  Β·  5Comments

agis picture agis  Β·  5Comments

winbatch picture winbatch  Β·  5Comments

xzxxzx401 picture xzxxzx401  Β·  5Comments

edenhill picture edenhill  Β·  3Comments