Cloud Technology

How can I optimize Kafka producer performance for high throughput in a Kubernetes cluster?

KE Asked by Kevin Adams · 10-11-2023
0 upvotes 11,243 views 0 comments
The question

We are running Kafka on a K8s cluster using the Strimzi operator. Our producers are currently hitting a bottleneck and we aren't seeing the throughput we expected. Should we increase the batch size or adjust the linger.ms settings to better utilize the network bandwidth in our cloud environment? 

3 answers

0
M
Answered on 11-11-2023

Increasing the batch size worked for us. We also found that using the LZ4 compression codec gave us the best balance between CPU usage and throughput. 

KE 18-11-2023

I’ve had the same experience, Mary. LZ4 is incredibly fast for the amount of compression it provides, especially with typical JSON or string data.

0
EL
Answered on 12-11-2023

In a Kubernetes environment, network overhead is a factor. To increase throughput, try increasing batch.size to 64KB or even 128KB and set linger.ms to 10-20ms. This forces the producer to wait slightly longer to group more messages into a single request, reducing the number of I/O operations. You should also check your buffer.memory to ensure the producer doesn't block when sending high volumes. Also, ensure your K8s nodes have sufficient CPU resources, as compression (like Snappy or LZ4) is CPU-intensive but greatly improves throughput by reducing payload size. 

0
CH
Answered on 14-11-2023

Are you monitoring your 'request-latency-avg' and 'produce-throttle-time-max' metrics to see if the brokers are actually the ones slowing down the producers?

DA 16-11-2023

That's a smart check, Charles. If the throttle time is high, it means the brokers are hitting quota limits or disk I/O caps. You might need to scale your brokers or upgrade your cloud storage volumes.

Share your thoughts

Your email address will not be published. Required fields are marked (*)

Professional Counselling Session

Still have questions?
Schedule a free counselling session

Our experts are ready to help you with any questions about courses, admissions, or career paths. Get personalized guidance from industry professionals.

Request a Call Back

Search Online

We Accept

We Accept

Follow Us

"PMI®", "PMBOK®", "PMP®", "CAPM®" and "PMI-ACP®" are registered marks of the Project Management Institute, Inc. | "CSM", "CST" are Registered Trade Marks of The Scrum Alliance, USA. | COBIT® is a trademark of ISACA® registered in the United States and other countries.

Book Free Session