Question 15 of 15 · CIE-2 QB · Set 2 · 6 marks
Open in ChatGPTDescribe the architecture of distributed coordination-based systems and explain the importance of naming and security in coordination.
Introduction
A coordination service is the small, strongly consistent core that other distributed applications lean on: who is the leader, who holds the lock, what the current configuration is. Its architecture is deliberately simple: a replicated log and a tree of small nodes: because everything else depends on it being right.
Architecture
- Replicated state machine. Every server keeps the same copy of the state and applies the same operations in the same order, agreed by a consensus protocol (Zab in ZooKeeper, Raft in etcd).
- Leader and followers. One server is the leader and orders writes; followers replicate and can serve reads that tolerate staleness.
- Data model. A hierarchical namespace of znodes (ZooKeeper) or a flat key-value store (etcd). A znode can be persistent, ephemeral (deleted when its session ends), or sequential (its name carries a counter).
- Watches. A client subscribes to a znode and is notified when it changes, so it waits without polling.
- Sessions and leases. A client holds a session with a timeout; an expired session deletes its ephemeral nodes, which is how a crashed process releases its lock.
- Quorum. A write commits once a majority acknowledges, so the service survives a minority of failures.
Why naming matters
- Every participant must refer to the same lock or leader entry. The znode path is that shared name.
- Ephemeral nodes tie a name to a live session, so the name disappears exactly when its owner does: that is leader election without a separate protocol.
- Sequential nodes give a total order for free: the lowest sequence number among contenders holds the lock.
- Configuration is stored under a path, so clients follow a name rather than a server address.
Why security matters
- Authorization: not every client may write the leader's node. ACLs per znode prevent a buggy client from taking the lock.
- Authentication: a session belongs to an authenticated identity, or any process could create an ephemeral node and claim the lock.
- Integrity of the log: a compromised server must not be able to forge an order, so servers authenticate each other.
- Availability is a target: a coordination service under attack is a single point of failure for everything using it, so it must resist resource exhaustion and be isolated from the data plane.
Example
- Every candidate creates an ephemeral sequential node under
/election. - The one with the lowest sequence number is the leader.
- The others watch the node just below them.
- If the leader dies, its session expires and its node vanishes.
- The next contender is notified and takes over.
Conclusion
A coordination service is a replicated log with a small tree on top and a lease underneath. Naming gives the shared identity, and security makes that identity trustworthy: without which every lock it grants is only a suggestion.