Home/Learn/Apache Kafka/Topic Configuration Properties

Topic Configuration Properties

Beginner
Fundamentals

Kafka 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 CLI — topic creation with key configs
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=lz4

Key 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 Aria
1

What does min.insync.replicas control and why does it matter for data safety?

MediumAmazon
2

How do you increase the maximum message size in Kafka?

EasyWipro
3

What is a log segment and why does segment.bytes matter?

MediumConfluent
4

What happens when both retention.ms and retention.bytes are set?

MediumFlipkart
5

Which compression algorithm gives the best Kafka throughput and why?

HardLinkedIn

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.

Loading discussion…