Maximize Kafka Broker Data Durability
Maximize data safety with replication factor 3, ISR enforcement, and clean leader election.
Recommended starting points curated by Conduktor. Always benchmark with your workload. Some broker configs are not available on managed services (AWS MSK, Confluent Cloud) — check your provider's documentation.
broker
| Config | Change | Why |
|---|---|---|
| Replication | ||
|
default.replication.factor
Kafka 0.8.0+
|
1 → 3 | Replication factor 1 means a single broker failure permanently destroys all data on that partition. Factor 3 tolerates simultaneous loss of 1 broker (with min.insync.replicas=2) without data loss or availability interruption. This is the single most important durability setting. • 3x replication triples network bandwidth used for replication and triples disk space consumed per topic. Replication lag also adds to produce latency when acks=all. |
|
min.insync.replicas
Kafka 0.9.0+
|
1 → 2 | With default.replication.factor=3 and min.insync.replicas=2, a ProduceRequest with acks=all is acknowledged only after 2 out of 3 replicas confirm the write. This guarantees that even if 1 broker fails immediately after the ack, the data is safe on the remaining 2. • If 2 out of 3 replicas become unavailable simultaneously (e.g., rack failure + rolling restart), the partition enters read-only mode and produces are rejected with NotEnoughReplicasException until replicas recover. |
|
num.replica.fetchers
Kafka 0.8.0+
|
1 → 4 | Faster replication directly improves durability: a follower that lags behind accumulates unreplicated data that becomes vulnerable to loss on leader failure. More fetcher threads reduce replication lag, shrinking the window of unprotected writes. • More fetcher threads increase inter-broker network bandwidth usage and CPU load on leader brokers serving fetch requests. |
|
replica.lag.time.max.mscaution
Kafka 0.8.0+
|
30s → 10s | Reducing ISR shrink threshold to 10s means a follower that falls behind is removed from ISR faster, forcing acks=all producers to wait for a genuinely in-sync replica rather than an outdated one. This tightens the durability guarantee. • Too-aggressive ISR shrink causes spurious shrinks during GC pauses or momentary network hiccups; 10s is the lower bound for stable clusters. Below 5s, ISR flapping becomes chronic and triggers frequent leader elections. |
| Log Segments & Compaction | ||
|
log.flush.interval.messagescaution
Kafka 0.8.0+
|
never → 1 | Forcing fsync on every message ensures page cache data is committed to disk before acknowledging the write, protecting against OS-level crashes (not just JVM crashes). Without this, the OS can hold up to seconds of unflushed writes in page cache. • Synchronous fsync per message cuts broker throughput by 50-90% on HDD-backed brokers and 10-30% on NVMe SSDs. This setting is only justified when data integrity outweighs throughput, and only when disk hardware does NOT lie about write completion (battery-backed RAID or ZFS with sync=always). |
|
log.flush.interval.mscaution
Kafka 0.8.0+
|
null → 1s | If per-message fsync is too expensive, a 1-second periodic flush limits the data loss window to at most 1 second of writes in an OS crash scenario. This is a reasonable middle ground between pure OS-managed flushing (loss window = minutes) and per-message fsync. • Every partition flushes independently every 1 second; on a broker with 10,000 partitions this creates a thundering herd of simultaneous fsync calls every second, causing periodic latency spikes visible in p99 produce metrics. |
| Metadata & Connections | ||
|
auto.create.topics.enable
Kafka 0.8.0+
|
true → false | Auto-created topics inherit the default.replication.factor and num.partitions defaults. In durability-first clusters, topics must be explicitly created with correct replication factor, retention, and min.insync.replicas — auto-creation bypasses these governance controls. • Every topic must be explicitly provisioned; applications that silently rely on auto-creation will fail with UnknownTopicOrPartitionException. |