Package me.internalizable.numdrassl.api.cluster
package me.internalizable.numdrassl.api.cluster
Cluster management API for distributed Numdrassl deployments.
This package provides abstractions for managing a cluster of proxy instances, including:
- Proxy discovery - Track which proxies are online
- Health monitoring - Detect proxy failures via heartbeats
- Global state - Aggregate player counts, server lists
- Load balancing - Find the best proxy for a region
Cluster Topology
Each proxy instance registers itself with the cluster on startup and sends periodic heartbeats. Other proxies receive these heartbeats and maintain a local view of the cluster state.
Failure Detection
If a proxy stops sending heartbeats, it is considered failed after a
configurable timeout (default: 30 seconds). Failed proxies are removed
from the cluster view and a ProxyLeaveClusterEvent
is fired.
Usage
ClusterManager cluster = proxy.getClusterManager();
// Get all online proxies
Collection<ProxyInfo> proxies = cluster.getOnlineProxies();
// Get global player count
int globalCount = cluster.getGlobalPlayerCount();
// Find proxies in a region
Optional<ProxyInfo> euProxy = cluster.getProxiesInRegion("eu-west")
.stream()
.min(Comparator.comparingInt(ProxyInfo::playerCount));
- See Also:
-
ClassDescriptionManages the cluster of proxy instances.Information about a proxy instance in the cluster.