High GC pressure due to numerous temporary objects in high-concurrency consumption scenario #2951
Labels
needs-investigation
Issues that require followup from maintainers
stale
Issues and pull requests without any recent activity
Description
Hello Sarama maintainers,
I'm encountering high GC pressure when consuming Kafka messages using Sarama under a 100K TPS high concurrency scenario.
pprof profile
![image](https://private-user-images.githubusercontent.com/3413361/354966693-293f92a6-b41b-48c0-8ca2-88c26f8378c9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNDU4MzAsIm5iZiI6MTczOTA0NTUzMCwicGF0aCI6Ii8zNDEzMzYxLzM1NDk2NjY5My0yOTNmOTJhNi1iNDFiLTQ4YzAtOGNhMi04OGMyNmY4Mzc4YzkucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDhUMjAxMjEwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ODNjOTE4MmU2NWRjY2U2NDE2MzQ1ZDc5NDA3Yzg2ODY4MzcwZjhhZGUzMzI3MTdhNGZkZmI2YzlkYjAxNDRkYSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.I6SLYuTu_airm1OcZ8nQwM77cK6S5s_tKDrZLLDAX6U)
pprof heap
After analyzing the pprof heap profile, I've identified several areas of concern related to frequent memory allocations during message decoding. Here are the key findings:
(*MessageSet).decode
(*MessageBlock).decode
(*partitionConsumer).parseMessages
Are there any optimization strategies or best practices you could recommend to reduce these allocations and mitigate the GC pressure? I'm open to suggestions on how to improve the performance in this high-concurrency scenario.
Thank you for your time and assistance.
Versions
Configuration
Logs
logs: CLICK ME
Additional Context
The text was updated successfully, but these errors were encountered: