Skip to content
WeftKitBeta
Ecosystem

Discovery

Know your cluster. Track health. Manage groups.

Lightweight service registry for WeftKit instances. SWIM-based membership protocol with heartbeat monitoring, group management, and health status tracking.

SWIM gossip membership protocol
Heartbeat health monitoring
Database group management
Automatic peer detection
mTLS secured registry
REST + gRPC management API

Discovery is the lightweight service registry that enables WeftKit components to find each other in a cluster. Using the SWIM gossip protocol, instances broadcast their presence, capabilities, and health status to all peers without a central coordinator.

Every WeftKit instance that participates in a distributed deployment should register with Discovery. Distribution requires it. Pool Manager uses it to locate Standalone backends. Persistence uses it to find the target Standalone instance.

Internals

How It Works

Step-by-step walkthrough of the internal architecture.

1

Instance Registration

Each WeftKit component registers itself with a unique node ID, database type, wire protocol, and endpoint address on startup.

2

SWIM Gossip

Members exchange state via random-walk gossip. Each round, a node selects random peers and exchanges membership information within 2-3 gossip rounds per topology change.

3

Heartbeat Monitoring

Nodes send periodic heartbeats (configurable interval). Missed heartbeats trigger suspicion state. Sustained silence marks a node as failed.

4

Group Management

Instances can declare group membership (e.g., "relational-primary"). Distribution queries groups to find replication peers.

5

Health API

REST and gRPC APIs expose cluster state, node health, group membership, and last-seen timestamps for operators and automated tooling.

Applications

Use Cases

Common deployment patterns and scenarios.

Cluster Formation

Bootstrap distributed WeftKit deployments without static IP configuration. Nodes find each other automatically.

Health Monitoring

Track the health of all WeftKit instances in your cluster from a single endpoint.

Dynamic Scaling

New instances register automatically. Discovery propagates their presence to existing cluster members.

Load Balancer Integration

Poll Discovery's health API to feed dynamic backend lists to your load balancer or service mesh.

Configuration

Configuration Reference

TOML configuration options for this component.

[discovery]
# Bind address
bind = "0.0.0.0:7474"

# Seed peers for initial cluster join
seeds = ["node1:7474", "node2:7474"]

# Gossip interval
gossip_interval_ms = 500

# Suspicion timeout before marking failed
suspicion_timeout_ms = 5000

# mTLS configuration
tls_cert = "/etc/weftkit/tls/server.crt"
tls_key = "/etc/weftkit/tls/server.key"