Topic Configuration Properties
BeginnerKafka topics have configuration properties controlling durability, retention, compaction, segment size, and message size. Knowing the key properties is essential for production tuning.
Overview
Topic-level configurations override broker-level defaults. Getting these right is the difference between a reliable production system and one that silently loses data or runs out of disk.
Critical Topic Properties
The most important properties to know for interviews and production.
kafka-topics.sh --create \
--bootstrap-server localhost:9092 \
--topic payments \
--partitions 12 \
--replication-factor 3 \
--config retention.ms=604800000 \ # 7 days
--config retention.bytes=10737418240 \ # 10 GB
--config cleanup.policy=delete \
--config min.insync.replicas=2 \
--config max.message.bytes=1048576 \ # 1 MB
--config compression.type=lz4Key Points to Remember
- 1retention.ms / retention.bytes — how long / how much data to keep
- 2min.insync.replicas — minimum replicas that must confirm for acks=all
- 3max.message.bytes — maximum single message size (default 1 MB)
- 4cleanup.policy=delete|compact|compact,delete
- 5segment.bytes controls when a new log segment file is created
Interview Questions
Sign in to ask AriaWhat does min.insync.replicas control and why does it matter for data safety?
How do you increase the maximum message size in Kafka?
What is a log segment and why does segment.bytes matter?
What happens when both retention.ms and retention.bytes are set?
Which compression algorithm gives the best Kafka throughput and why?
Ask Aria about Topic Configuration Properties
Your personal AI tutor — ask anything about this concept
Revision Status
Personal Notes
Sign in to save personal notes for this topic.
Discussion
Sign in to join the discussion.