-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Single message consumer with 0.11.0 API #1022
Comments
Digging a bit around the Java code, it seems that indeed there could be more than one batch in a stream (eg, a fetch response). I guess this is done for efficiency reasons, as the batches are stored/retrieved from the log with zero-copy so the records are not re-batched in the broker. I will work on a fix for this. |
@wladh, can you point me at relevant Java code, so I can also take a look? |
Indeed there may be multiple of It's a bit confusing to have different names for entities in Kafka and Sarama, you have to match concepts by field names within them. |
Support multiple record batches, closes #1022
Versions
Sarama Version: f0c3255
Kafka Version: 0.11.0.1
Go Version: go1.9.2
Configuration
Sarama is using Kafka API 0.11.0.0.
Logs
I added some debug logging, here's the output:
Here's the diff that added the logging:
Problem Description
This is related to #901.
See the ticket I filed previously for Kafka itself: https://issues.apache.org/jira/browse/KAFKA-6441
The problem is that Sarama decodes 0.11.0.0
FetchResponse
in such a way, that only the very first message is extracted. We have pretty deep buffers and this resulted in Kafka outbound jumping from 125Mbit/s to 55000Mbit/s for a tiny topic. Essentially, consumers are only able to advance 1 message at a time, while Kafka always replies with filled buffers with thousands of messages.I'm not sure if the problem is within Kafka or Sarama.
In reply for the logged request above we get this reply (truncated):
Kafka sets
recordsSize
inFetchResponse
to a large number (10000
in the logs), that is supposed to hold multiple messages (which are a lot shorter than10000
bytes). Then inRecordBatch
Kafka clearly says that there is only one record (0x0, 0x0, 0x0, 0x1
) in this record and the length of the whole thing is 901 bytes (0x3, 0x85
).The gap between 901 bytes and 10000 bytes filled with other messages (records? record batches?), which Sarama does not see.
I looked at Kafka protocol docs, but they do not mention anything about this:
cc @wladh
The text was updated successfully, but these errors were encountered: