Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kafka message ordering in partition while producer retry

According to producer configs, there are: retries and max.in.flight.requests.per.connection. Suppose that retries > 0 and max.in.flight.requests.per.connection > 1.

Can messages arrive out of order within ONE partition of topic (e.g. if first message has retries, but second message delivered to broker with the first attempt)?

Or do out of order only happen across several partitions of topic, but within partition order is preserved?

like image 206
pavel_barbashov Avatar asked Oct 18 '25 23:10

pavel_barbashov


1 Answers

If you set retries to more than 0 and max.in.flight.requests.per.connection to more than 1, then yes messages can arrive out of order on the broker even if they are for the same partition.

You can also have duplicates if for example a message is correctly added to the Kafka logs and an error happens when sending the response back to the client.

Since Kafka 0.11, you can use the Idempotent producer to solve these 2 issues. See http://kafka.apache.org/documentation/#semantics

like image 94
Mickael Maison Avatar answered Oct 20 '25 12:10

Mickael Maison



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!