Explore how replication.factor, min.insync.replicas, and ISR interact in Kafka. When one replica dies and min.insync.replicas is 2, writes with acks=all are rejected until the remaining replica is in sync. Understand durability, leader reads vs. write acknowledgments, and what happens during partial failures.

Multiple Choice

If replication.factor=2 and min.insync.replicas=2, what happens when one replica goes down or falls out of sync?

The behavior hinges on how min.insync.replicas and in-sync replicas (ISR) control write acknowledgments. With replication.factor set to 2, there are two replicas: a leader and one follower. If one goes down or falls out of sync, the number of in-sync replicas drops to 1. Since min.insync.replicas is 2, the cluster no longer meets the required threshold for a write to be acknowledged when acks=all. As a result, writes are rejected until the remaining replica comes back in sync and the ISR count again reaches the minimum. This protects durability by ensuring writes aren’t considered committed unless enough copies are in sync. It won’t automatically reassign partitions, and the cluster doesn’t keep accepting writes in this degraded state; reads from the leader can continue, but new writes won’t be accepted until the ISR requirement is satisfied.

Kafka durability isn’t magic. It’s a carefully designed balance among replication, in-sync replicas (ISR), and how the cluster acknowledges writes. When you lock in replication.factor=2 and min.insync.replicas=2, you’re telling the system: two copies must be kept in sync for a write to be considered durable. That little sentence has a big ripple effect, especially when something goes wrong.

Let me walk you through what happens when one replica goes down or falls out of sync, and why the system behaves the way it does.

The core mechanics: replication, ISR, and acks

  • Replication.factor=2 means every partition has exactly two replicas: a leader and a follower. The leader handles reads and writes, while the follower stays in sync by replicating data from the leader.

  • In-sync replicas (ISR) are those replicas that are fully caught up with the leader. If a follower lags, it drops out of the ISR.

  • min.insync.replicas=2 sets a hard threshold: at least two replicas must be in sync for a write that uses acks=all (the strongest acknowledgment) to be considered successful.

  • acks=all means the leader will only acknowledge a write when all ISR members have confirmed the write. If a follower is out of sync or missing, it can’t contribute to the acknowledgment.

So, what happens when one replica goes down or loses sync?

  • Availability vs. durability tension. With two replicas, you’re counting on both to stay in sync. If you lose one, you’re left with a single copy that’s potentially vulnerable to data loss if the remaining copy also fails before it’s replicated to a new follower.

  • The ISR shrinks. The follower that dropped off the pace or failed to respond is removed from ISR. You can’t count on it for durability anymore.

  • The threshold is breached. Since min.insync.replicas is 2, you no longer meet the required number of in-sync replicas for a write to be acknowledged under acks=all.

  • Writes get blocked (for the strong acknowledgment path). With the threshold not being met, the system won’t consider the write durable enough to acknowledge. The producer won’t get a success response for those writes until the ISR count recovers—i.e., the remaining follower catches up and the ISR list includes both replicas again.

A concrete mental picture

Imagine a single partition with two hands (the leader and one follower). Each hand must clap in unison for a note to count as delivered. If one hand goes quiet or drops out, you only have one hand clapping. The note won’t be counted if you’re insisting on both hands clapping the moment the music ends. In Kafka terms, that means the write won’t be acknowledged when acks=all and min.insync.replicas=2. Read operations aren’t paralyzed—readers can still fetch data from the leader—but the system guards against committing new data that hasn’t been seen by enough copies.

What about reads during this degraded moment?

  • Reads from the leader can continue. Since the leader still has the most up-to-date data, you can keep serving reads for the latest committed data. The limitation is on new writes, not on existing read paths.

  • If you care about strongly linearizable reads under certain failure scenarios, you’d look at additional patterns, like follower reads from in-sync replicas (if configured), but that’s more about how you design your microservices than a default, automatic behavior.

Why not automatically reassign partitions?

  • Reassignment is a separate operation, and it’s not triggered solely by a replica going down. The system prioritizes preserving data durability and preventing split-brain or data loss. Automatically reassigning partitions could cause data movement and disruption, and without a planned, coordinated rebalance, you risk introducing more instability. The usual pattern is to bring the failed broker back online, or to reassign partitions intentionally as part of maintenance, not automatically in response to a single failure with strict min.insync.replicas in place.

  • In practice, administrators often monitor ISR sizes and take manual or scripted actions to restore redundancy—like bringing a broker back online, fixing network issues, or adding a replacement broker to reestablish the replication factor and ISR.

A few nuanced angles worth noting

  • The role of replication lag. If the follower is alive but lagging, it stays out of ISR. The cluster will not consider it for durability until it catches up. That lag can be caused by network hiccups, heavy load, or hardware issues.

  • The impact of a higher replication factor. If you bumped replication.factor to, say, 3 or more, you’d still have two in-sync replicas at minimum, but you’d be operating with more redundancy. The dynamics shift: a single failure doesn’t instantly drop you below min.insync.replicas as long as enough replicas stay in sync.

  • The importance of acks settings. acks=all is the strictest mode, favoring durability over latency. If you loosen to acks=1, you’ll get quicker acknowledgments as soon as the leader has written the data, even if some followers aren’t in sync yet. That’s a trade-off that changes the entire durability semantics under failure.

  • Timeouts and producer retries. Producers have their own timeout and retry behavior. When a write isn’t acknowledged due to ISR constraints, the producer may retry, potentially placing more burden on the cluster during degraded periods. Understanding those controls helps you tune behavior to match your service level expectations.

Real-world implications for a production-ish environment

  • You must plan for degradation. No cluster runs perfectly all the time. The moment one broker or follower falters, you need a plan to restore the ISR to its full strength. That means monitoring tools, alerting on ISR shrinking, and a runbook for bringing a failed broker back online or scaling out.

  • Durability vs. latency trade-offs. If your workloads require ultra-high durability, you might keep min.insync.replicas=2 and rely on the strong acks path. If your workload is more latency-sensitive and can tolerate the risk of a slightly looser durability guarantee, you might adjust to a higher tolerance for in-sync replicas or alter acks behavior.

  • Operational hygiene matters. Regular health checks, automated failover patterns, and proactive maintenance reduce the chance that ISR drops become prolonged. In environments with auto-scaling or ephemeral brokers, you’ll want to ensure that new brokers promptly join the ISR and keep up with the leader.

Practical takeaways you can apply

  • If you want to maintain strong durability with two replicas, be prepared for a temporary write stall when a replica falls out of sync. The system is doing exactly what you asked: it refuses to consider a write durable unless both copies are in sync.

  • If you frequently observe stalled writes during minor blips, consider whether min.insync.replicas should be relaxed, or whether you need a larger replication factor to cushion against single-node outages.

  • Always monitor ISR. A healthy cluster shows a stable ISR size, with occasional small blips during traffic spikes or maintenance. Sustained ISR reductions deserve attention.

  • Plan maintenance windows. If you need to remove or replace a broker, coordinate it during a period of low traffic, and ensure you have enough replication capacity to keep the cluster healthy during the transition.

A quick analogy to seal the idea

Think of a two-person relay race where both runners must cross the finish line with the baton for the time to count. If one runner gets delayed or falls behind, the team can’t claim a finish yet—the clock won’t stop until the second runner catches up and both hands pass the moment of truth together. That’s the essence of how min.insync.replicas and ISR govern writes in this setup. It’s a guardrail that protects data integrity, even if it means a brief pause in new data flowing through.

If you’re curious about tailoring this behavior to your specific stack, you’ll likely start by reviewing your current replication factor, ISR health, and acks configuration across your topics. Then map that against your latency and durability requirements. It’s a balancing act, but with a clear view of what each control knob does, you can tune for resilience without sacrificing too much speed.

In the end, resilience isn’t just a feature—it’s a mindset. With two replicas and a committed threshold, the system is signaling: we’ll keep the data safe, we’ll wait for the necessary mirrors to align, and we’ll move forward with confidence once the chorus of in-sync replicas returns. That patience isn’t laziness; it’s a quiet, powerful promise to your services that data won’t drift or disappear in the noise of a single hiccup. And in the world of data-streaming, that promise matters as much as the speed at which you deliver.