Bird
Raised Fist0

What is the main purpose of log compaction in Kafka?

easy🧠 Conceptual Q11 of Q15
Kafka - Monitoring and Operations
What is the main purpose of log compaction in Kafka?
ATo compress messages to save disk space
BTo delete all messages older than a certain time
CTo replicate messages across multiple brokers
DTo keep only the latest message for each key in a topic
Step-by-Step Solution
Solution:
  1. Step 1: Understand log compaction concept

    Log compaction keeps the latest message per key, removing older duplicates.
  2. Step 2: Compare with other options

    Deleting old messages is retention, compression is different, replication is for fault tolerance.
  3. Final Answer:

    To keep only the latest message for each key in a topic -> Option D
  4. Quick Check:

    Log compaction = latest message per key [OK]
Quick Trick: Log compaction keeps latest per key, not all old messages [OK]
Common Mistakes:
MISTAKES
  • Confusing log compaction with time-based retention
  • Thinking compression means log compaction
  • Mixing replication with compaction

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes