1
votes

I hve enabled snappy compression on producer side with a batch size of 64kb, and processing messages of 1 kb each and setting linger time to inf, does this mean till i process 64 messages, producer wont send the messages to kafka out topic... In other words, will producer send each message to kafka or wait for 64 messages and send them in a single batch...

Cause the offsets are increasing one by one rather than in the multiple of 64

Edit - using flink-kafka connectors

1

1 Answers

1
votes

Messages are batched by producer so that the network usage is minimized not to be written "as a batch" into Kafka's commitlog. What you are seeing is correctly done by Kafka as each message needs to be accounted for i.e. identified key / partition relationship, appended to the commitlog and then offset is incremented. Unless the first two steps are done, offset is not incremented.

Also there is data replication to be taken care of based on configurations as well as message tracking systems get updated for each message received (to support lag apis).

Also do note, the batch.size parameter considers ready to ship message's size, which has been pre-processed as 1. compressed 2. serialized by your favorite serializer.