Intermediatehow it works Verified ~7 min
What is log compaction and when would you use it?
Quick answerFree
With cleanup.policy=compact, Kafka keeps at least the latest record for every key and removes older records for the same key in the background. Use it for changelog topics where consumers need the current state per key, like customer profiles, configs and Kafka Streams state stores.
Detailed answer· ~230 words
Interview PrepUnlock the full answer with Interview Prep
Get a ~230-word model answer, 5 key points, a visual explainer, 4 common mistakes and 4 follow-ups, plus 21 more Apache Kafka questions.
Also in Pro (₹499 / 90 days).
Key points· 5 points
Interview PrepUnlock with Interview Prep
Visual explainer· animated, step by step
Interview PrepUnlock with Interview Prep
Common mistakes· 4
Interview PrepLocked
Best practices· 3
Interview PrepLocked
Likely follow-ups· 4 questions
Interview PrepUnlock with Interview Prep
+ 21 more Apache Kafka questions in Interview Prep, each with the full answer.