← Back to Kafka

Kafka — min.insync.replicas

KafkaSeniorkafka

The Question

What does min.insync.replicas control in Kafka?

What a Strong Answer Covers

  • only with acks=all
  • error when ISR too low
  • example config.

Senior-Level Answer

`min.insync.replicas` (commonly abbreviated `min.isr`) is a broker/topic-level configuration that specifies the minimum number of replicas that must be in the ISR for a produce request with `acks=all` to be accepted. If the current ISR falls below this threshold, the broker rejects produce requests with a `NotEnoughReplicasException`, effectively halting writes rather than accepting messages that could be lost.

The canonical safe configuration for a 3-broker cluster is `replication.factor=3` with `min.insync.replicas=2`. This means you can tolerate one broker failure and still accept writes — the remaining 2 replicas satisfy the minimum. Setting `min.insync.replicas=3` requires all three replicas to be in sync, meaning any single broker failure stops writes entirely. Setting it to 1 provides no durability benefit over `acks=1`.

This setting only takes effect when the producer uses `acks=all`. With `acks=1` or `acks=0`, the broker ignores `min.insync.replicas` entirely — a common source of confusion. The setting is purely a server-side guard for the strongest producer acknowledgment mode.

The trade-off is availability versus durability: a lower `min.insync.replicas` keeps writes flowing under degraded conditions but risks data loss if the leader fails before lagging replicas catch up. A higher value maximizes durability but reduces the failure tolerance window. In practice, `replication.factor=3, min.insync.replicas=2, acks=all` is the industry-standard baseline for durable Kafka deployments, giving you a one-failure tolerance with no data loss.

The setting can be configured at the broker level (`min.insync.replicas` in `server.properties`) as a default, and overridden per-topic via `kafka-configs.sh`, allowing you to apply stricter durability to critical topics without impacting higher-throughput, lower-durability topics.

What Separates a 2/3 from a 3/3

2/3 — Passing but Incomplete

Correctly explains that min.insync.replicas sets the floor on ISR size for acks=all writes, and knows that writes are rejected below this threshold rather than acknowledged with reduced durability.

3/3 — Strong Answer

Gives the canonical 3/2 example with reasoning, clarifies that the setting is a no-op with acks=0 or acks=1, and articulates the availability vs. durability trade-off. Mentions per-topic override capability.

Common Mistakes

  • Believing min.insync.replicas applies to all acks settings — it only matters when acks=all.
  • Setting min.insync.replicas equal to replication.factor, making the cluster unavailable on any single broker failure.
  • Confusing min.insync.replicas with replication.factor — replication.factor sets how many replicas exist; min.isr sets how many must be current.
  • Not knowing that writes return NotEnoughReplicasException (not a silent degradation) when the threshold is not met.

Follow-Up Questions

  • You have replication.factor=3 and min.insync.replicas=2. Two brokers go down. What happens to producers? — Only one replica remains — below the min.isr threshold — so acks=all producers get NotEnoughReplicasException. Writes halt.
  • Why is min.insync.replicas=1 effectively the same as acks=1 from a durability standpoint? — Only the leader needs to have the message — if the leader fails before replication, the message is lost in both cases.
  • Can you set min.insync.replicas differently for different topics? — Yes — per-topic configs via kafka-configs.sh override the broker-level default. Critical topics can have stricter settings.
  • What is the relationship between min.insync.replicas and ISR shrinkage? — When replicas fall out of ISR, the ISR shrinks. If it shrinks below min.isr, writes are rejected. ISR size is dynamic; min.isr is the floor policy.

Related Questions

  • Kafka — acks=0/1/all
  • Kafka — Why Is It Fast
  • Kafka — Consumer Lag
  • Kafka — ISR
  • Kafka — Consumer Group

Can You Explain This Cold?

Reading the answer is step one. Explaining it unprompted — under interview pressure — is what actually matters. Get AI-graded feedback on your answer with follow-up probes on your weak points.

Get Graded — Free Assessment
GrindQuestionsAITechnical interview assessment
TermsPrivacyAbout