0

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?

halfer
  • 19,824
  • 17
  • 99
  • 186
  • Possible duplicate: https://stackoverflow.com/questions/34794260/when-does-the-apache-kafka-client-throw-a-batch-expired-exception – OK sure Oct 01 '18 at 12:24
  • Please read [Under what circumstances may I add “urgent” or other similar phrases to my question, in order to obtain faster answers?](//meta.stackoverflow.com/q/326569) - the summary is that this is not an ideal way to address volunteers, and is probably counterproductive to obtaining answers. Please refrain from adding this to your questions. – halfer Oct 01 '18 at 13:50

1 Answers1

3

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.

Giorgos Myrianthous
  • 36,235
  • 20
  • 134
  • 156