← Lessons

quiz vs the machine

Gold1420

Concurrency

Zookeeper Style Coordination

A small consistent tree of nodes that many services use to coordinate.

5 min read · core · beat Gold to climb

A shared source of truth

Many coordination patterns reduce to one need, a small piece of state that every node agrees on. A coordination service in the Zookeeper style provides a tree of data nodes, kept consistent across a small ensemble of servers, that clients read and write to coordinate.

The data model

The tree looks like a filesystem. Each path holds a little data and may have children.

  • Persistent nodes stay until explicitly deleted.
  • Ephemeral nodes vanish when the client that made them disconnects.
  • Sequential nodes get a monotonically increasing number appended to their name.

The service keeps a quorum of servers in sync so reads return agreed values. Writes go through a leader and are committed only when a majority acknowledges.

Why it helps

Locks, leader election, and group membership all become simple tree operations. To elect a leader, every candidate creates a sequential ephemeral node and the lowest number wins. If that client dies, its node disappears and the next number takes over.

Key idea

A Zookeeper style service offers a small consistent tree with persistent, ephemeral, and sequential nodes, turning hard coordination problems into simple ordered tree operations backed by majority agreement.

Check yourself

Answer to earn rating on the learn ladder.

1. What makes an ephemeral node special?

2. When is a write committed in this model?

3. How can sequential ephemeral nodes elect a leader?