tezvyn:

Split-Brain: When a Cluster Disagrees With Itself

AI-drafted, machine-checkedSource: Wikipedia: Split-brain (computing)advanced

A split-brain is when a cluster partitions and nodes on each side think they're the leader, accepting writes independently. This is a classic failure in high-availability systems.

WHY IT EXISTS Distributed systems use redundant nodes to ensure high availability, allowing a new node to take over if a leader fails. A split-brain occurs when the system can't agree on who the leader is, typically because of a network failure that isolates nodes from each other, leading to data inconsistency.

THE MENTAL MODEL The name comes from the medical condition where a patient's brain hemispheres are severed. Each side can process information and act, but they can't coordinate, leading to conflicting actions. Similarly, a partitioned cluster has two or more "brains" that act independently, unaware of each other's state changes.

HOW IT WORKS Imagine a cluster with one leader and several followers. A network partition occurs, isolating a group of followers from the leader. These followers, no longer receiving a heartbeat from the original leader, may hold an election and promote one of their own to be the new leader. Now you have two nodes, each believing it is the sole leader for the same cluster. Both accept writes from clients, creating two divergent histories of the data.

WHEN TO USE IT Split-brain is not a technique to be used; it is a critical failure mode that systems must be designed to prevent. Understanding this concept is essential when building or operating any system that requires a single, consistent source of truth across multiple machines, such as clustered databases, message queues, or service discovery platforms.

WHEN NOT TO USE IT Preventing split-brain is the goal. The primary mechanism for prevention is requiring a quorum—a majority of nodes, typically (N/2) + 1—to be present to elect a new leader. This ensures that a minority of nodes isolated by a partition cannot form their own valid cluster. If a group of nodes cannot see a majority of the cluster, they step down instead of trying to elect a new leader.

ONE CANONICAL EXAMPLE Consider a 5-node database cluster. A network partition isolates two nodes from the other three. The group of three still has a quorum (3 out of 5) and continues operating normally with its leader. The two isolated nodes, however, cannot form a quorum (they need 3 votes). Because they can't achieve a majority, they are prevented from electing a new leader among themselves. This avoids a split-brain. Without a quorum mechanism, the two nodes might have elected a new leader, creating data conflicts.

Read the original → en.wikipedia.org

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.