Apache Kafka provides several configuration options for topics, brokers, producers, and consumers. Knowing the default values and purpose of these settings is crucial when tuning Kafka for production or development environments.
Below is a table of the most commonly used Kafka configuration properties, their default values, and a brief description.
🔧 Main Kafka Configuration Table
Property | Default Value | Description |
---|---|---|
retention.ms | 604800000 (7 days) | Duration for which Kafka retains published messages. |
segment.ms | 604800000 (7 days) | Time interval after which Kafka rolls over to a new log segment. |
num.partitions | 1 | Default number of partitions for a topic when created without specifying partitions. |
log.dirs | /tmp/kafka-logs | Filesystem path where Kafka stores topic log files. |
auto.create.topics.enable | true | Allows automatic topic creation when a non-existent topic is referenced. |
retries | 0 | Number of retry attempts a producer makes on message send failure. |
enable.auto.commit | true | Consumer setting to automatically commit the offset of records returned by poll(). |
auto.commit.interval.ms | 5000 | Time interval (in ms) for committing consumer offsets when auto-commit is enabled. |
segment.ms: In Apache Kafka, a segment is a file on disk. Each partition of a topic is stored as a series of segment files. Kafka writes incoming messages sequentially to the current (active) segment file.
✉️ Producer Acknowledgement Options (acks)
The acks setting determines the level of acknowledgment the producer requires the broker to receive before considering a message “sent.”
⚙️ Kafka Producer Acknowledgment Modes
acks Value | Description | Use Case |
---|---|---|
0 | Producer doesn’t wait for any broker response. | Max performance, but message loss risk. Suitable for logs or metrics. |
1 (Default) | Producer waits for acknowledgment from leader broker only. | Balanced durability and latency. Some risk if leader fails before replication. |
all or -1 | Leader waits for acknowledgments from all in-sync replicas (ISRs). | Highest durability. Ideal for critical data like transactions or financial logs. |