Peer Discovery

Published by

on

Service Discovery

Services(A,B,..) can discover each other through service registry servers

  • Apache Zookeeper can be an example of service registry server

How does service registry server know each other?

  1. Storing static hostname(IP)/port on each server

2. Using DNS (TXT record)

TXT record example

Gossip Protocol

Peer discovery can be accomplished through gossip protocol, which is actually being used from Apache Cassandra.

How does Gossip Protocol works on Apache Cassandra?

  1. There are Seed Nodes which are known to all of the other nodes in the cluster
    • At initial state, each sever knows only some of other nodes other than seed nodes
  2. Server A sends SYN to Server C, which contains information that it knows B/D/F
  3. Server C responds back with ACK including the information
    • Of other server that A doesn’t know.
    • Of the server C wants to know from A
  4. Server A responds back with ACK2 with the requested information

How do they know the failed nodes?

  • Using a periodic heartbeat from each other, the servers would know which server is dead or not

Reference

Leave a comment