user3392430
user3392430

Reputation: 1

Kafka Timeout Exception:Batch Expired

We are facing following issue on production:

org.apache.kafka.common.errors.TimeoutException: Batch Expired.

Is it because of invalid configuration like batch size, request timeout or any other thing?

Upvotes: 0

Views: 1649

Answers (1)

Giorgos Myrianthous
Giorgos Myrianthous

Reputation: 39790

The error indicates that some records are put into the queue at a faster rate than they can be sent from the client.

When your Producer sends messages, they are stored in buffer (before sending the to the target broker) and the records are grouped together into batches in order to increase throughput. When a new record is added to the batch, it must be sent within a -configurable- time window which is controlled by request.timeout.ms (the default is set to 30 seconds). If the batch is in the queue for longer time, a TimeoutException is thrown and the batch records will then be removed from the queue and won't be delivered to the broker.

Increasing the value of request.timeout.ms should do the trick for you.

Upvotes: 3

Related Questions