-
Notifications
You must be signed in to change notification settings - Fork 915
Finalization kills flush #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
That's weird, flush() is supposed to block until all outstanding messages have been delivered or failed. |
Before: 120 And yet they never actually make it. So it appears that the buffer is being cleared, but they're not actually being sent. |
What's your producer config? |
{
'group.id': None,
'session.timeout.ms': 6000,
'enable.auto.commit': False,
'fetch.min.bytes': 1,
'fetch.wait.max.ms': 1,
'max.partition.fetch.bytes': 50 * MiB,
'api.version.request': True,
'broker.version.fallback': '0.8.2.1',
'kafka_ack': 0
} |
|
Sorry, I gave the consumer config. This is the producer config: {
'api.version.request': True,
'broker.version.fallback': '0.8.2.1',
'bootstrap.servers': '', # list of brokers
'default.topic.config': {
'acks': 0,
},
} |
And that's your culprit: You should generally not use acks: 0 unless you are fine with message loss, |
So the definition of "sent" does not actually include flushing the socket? I understand that not waiting for acknowledgement poses the risk that a message may not be accepted (i.e. failure), but I think that finalization or flushing should at least give a guarantee of the packets being sent at the socket level. We're not talking about a little message loss either. I'm not seeing any of the 120 message get delivered in this example. |
@CorwinTanner These are the semantics of the Java producer as well -- the docs for |
I'm not looking for a guarantee of receipt. I understand that's what This (as well as allowing a |
You could minimize the socket send buffer to achieve the same result as a socket-level flush: |
Some more context: For reference there is support in librdkafka master for disabling Nagle: |
When calling
flush()
on a producer and then immediately dereferencing the object, the buffer does not actually get flushed.Acknowledgement is set to none. Placing a sleep after
producer.flush()
allows messages to be flushed. Placing a sleep afterproducer = None
does not allow messages to be flushed.Note: This may only occur on fast hardware.
The text was updated successfully, but these errors were encountered: