Skip to content
Multi-Node Deployment

Multi-Node Deployment

Deploy smtp-probe across multiple geographic regions for low-latency verification. Nodes coordinate via heartbeat and route requests to the geographically closest node.

Architecture

Client Request → Node A (Singapore)
                    ↓ (if MX server is closer to US)
              Route to Node B (US West)
                    ↓
            Node B performs verification

Starting a Node

smtp-probe serve --port 8080 \
  --node-id sg-01 --region asia-southeast1 \
  --lat 1.35 --lon 103.82 \
  --peers http://us-node:8080,http://eu-node:8080

Multi-Node Flags

FlagDefaultDescription
--node-id(auto)Unique identifier for this node
--regionRegion name
--lat0Latitude of this node
--lon0Longitude of this node
--peersInitial peer addresses (comma-separated)
--heartbeat30sHeartbeat interval

How Routing Works

  1. Each node registers with all peers via heartbeat (every 30s)
  2. When a verification request arrives, the node resolves the target MX server’s IP
  3. GeoIP lookup determines the MX server’s location
  4. Request is routed to the closest node (Haversine distance)
  5. If the remote node is unavailable, the request falls back to local execution

Peer API Endpoints

EndpointMethodDescription
/v1/peer/registerPOSTRegister a new peer node
/v1/peer/peersGETList registered peers
/v1/peer/heartbeatPOSTHeartbeat signal
/v1/peer/geoGETGeoIP lookup for an IP

Example: 3-Node Setup

# Singapore
smtp-probe serve --port 8080 \
  --node-id sg-01 --region asia-southeast1 \
  --lat 1.35 --lon 103.82 \
  --peers http://us-node:8080,http://eu-node:8080

# US West
smtp-probe serve --port 8080 \
  --node-id us-01 --region us-west1 \
  --lat 37.77 --lon -122.42 \
  --peers http://sg-node:8080,http://eu-node:8080

# EU (Frankfurt)
smtp-probe serve --port 8080 \
  --node-id eu-01 --region eu-west1 \
  --lat 50.11 --lon 8.68 \
  --peers http://sg-node:8080,http://us-node:8080