I have a use case of high throughput kafka producer where I want to push thousands of json messages every second.
I have a 3 node kafka cluster and I am using latest kafka-python library and have following method to produce message
def publish_to_kafka(topic):
data = get_data(topic)
producer = KafkaProducer(bootstrap_servers=['b1', 'b2', 'b3'],
value_serializer=lambda x: dumps(x).encode('utf-8'), compression_type='gzip')
try:
for obj in data:
producer.send(topic, value=obj)
except Exception as e:
logger.error(e)
finally:
producer.close()
My topic has 3 partitions.
Methods works correctly sometimes and fails with error "KafkaTimeoutError: Failed to update metadata after 60.0 secs."
What settings I needs to change to get it work smoothly?
server.properties
) ? Also, when you say that it sometimes fail, do you mean using the exact same topic? – Pigskin