Menu

I built a leaderless service-discovery system in Go. Here's what broke along the way
πŸ“°

I built a leaderless service-discovery system in Go. Here's what broke along the way

DEV Community: goΒ·Manzi Niyongira OseeΒ·2 days ago
#8OPtOYbR
#devtogo#devto#dev#node#atlas
Reading 0:00
15s threshold

For the past few weeks I've been building Atlas , a distributed service-discovery system in Go. It answers one question every microservice setup eventually asks:

Where is the payments service right now, and which copies of it are actually alive?

Most tools answer that with a central database or a leader node (Consul's servers, etcd, ZooKeeper). I wanted to see how far I could get without any leader at all .

πŸ”— GitHub: https://github.com/manziosee/atlas

🟒 Live demo (read-only): open the dashboard

How it works

Every node runs the same ~14 MB binary. Nodes find each other with SWIM gossip , the same family of protocols behind HashiCorp's memberlist:

Each node pings a random peer every second.

No answer? It asks up to three other nodes to try ( ping-req ).

Still nothing? The peer is marked suspect , and the rumour spreads by gossip.

If the peer is actually alive, it refutes by bumping its incarnation number. Otherwise it's declared dead within seconds.

On top of that sits a service registry .…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.