I have a set of Kafka consumer which are subscribed to a Kafka topic with 16 partitions. Consumers run a long processing job which sometimes takes (2 hours).
I have observed that there is a lot of delay in message consumption when the consumers are free after completing the previous job.
I have tried setting the max poll interval seconds to 2 or 3 hours but it has not helped.
Below is my consumer config code
consumer_config = {
'bootstrap.servers': APPCONFIG['BOOTSTRAP_SERVERS'],
'security.protocol': 'SSL',
'ssl.keystore.location': APPCONFIG['SSL_KEYSTORE_LOCATION'],
'ssl.keystore.password': APPCONFIG['SSL_KEYSTORE_PASSWORD'],
'ssl.ca.location': APPCONFIG['SSL_CA_LOCATION'],
'group.id': APPCONFIG['GROUP_ID'],
'auto.offset.reset': 'earliest',
'max.poll.interval.ms': int(APPCONFIG['MAX_POLL_INTERVAL'])
}
and below is the processing code
consumer = Consumer(consumer_config)
consumer.subscribe([topic])
consumer.commit()
p = Processor(message)
p.start_processing()