Kafka guarantees ordering within a partition, but this isn’t always the case.
If you don’t fully understand Kafka producer properties or configure them incorrectly, you could face issues in production.
For example, if Batch 1 is sent asynchronously and Batch 2 is sent before Batch 1’s acknowledgment, Kafka may deliver Batch 2 first, breaking the order.
To prevent this, set max.in.flight.requests.per.connection to 1, ensuring Batch 2 isn't sent until Batch 1’s acknowledgment is received.
If you want to read more about such properties related to Kafka Producer head over to my blog: https://medium.com/@pranavt84/optimizing-kafka-producer-performance-key-configuration-properties-9212b3d7fa01
This will enhance your understanding of Kafka, boosting your confidence when deploying it in production or during interviews.
Top comments (0)