Design a Distributed Service Discovery / KV System (Consul)

Problem

Design a distributed service discovery + KV system like Consul, where services register and discover each other and share config.

Requirements

Functional:

  • Service register/deregister with health checks
  • Discover healthy instances of a service
  • Distributed KV for config
  • Watch/notify on changes

Non-functional:

  • Thousands of nodes across datacenters
  • Strong consistency for KV; AP for discovery reads
  • Survive node/network failures

Discussion points

  1. Consensus (Raft) for the KV/state store
  2. Gossip (SWIM) for membership and failure detection
  3. Health checking and anti-entropy
  4. Multi-datacenter replication
  5. Watches and consistency trade-offs
added …
LeaderboardSalaryAccount