Skip to main content

HuddleCluster

PyPI version Python versions MIT License DOI CI

Penguin-inspired self-organizing load balancer with adaptive thermal eviction.


Emperor Penguins survive Antarctic blizzards without any central coordinator — each bird follows one rule: if you're cold, push inward; if you're warm, drift outward. The huddle self-organizes.

HuddleCluster applies this directly to server scheduling. Servers that run hot rotate to an outer ring to cool down. Cooled servers rotate back in. No manual tuning. No fixed thresholds. The cluster finds its own equilibrium.


Install

pip install huddle-cluster

Optional extras: fastapi · redis · grpc · kubernetes


Single-instance

from huddle_cluster import create_cluster
import requests

cluster = create_cluster([
    ("web-1", "10.0.0.1", 8080),
    ("web-2", "10.0.0.2", 8080),
    ("web-3", "10.0.0.3", 8080),
])
cluster.start()

with cluster.get_server_context() as server:
    response = requests.get(f"http://{server.host}:{server.port}/api")

What the cluster reports at any point:

print(cluster.health_report())
{
  "inner_servers": ["web-1", "web-3"],
  "outer_servers": ["web-2"],
  "fairness_score": 0.94,
  "rotation_count": 12,
  "requests_per_sec": 847.3,
  "cluster_health": "healthy"
}

Multi-node cluster

Coordinate a fleet of hosts — each node runs its own HuddleCluster; the master tracks enrollment, heartbeats, and health.

# Start the coordinator
huddle-cluster master start --port 7070

# Enroll nodes on each host
huddle-cluster agent start --id web-01 --master http://master:7070 --port 8080

# Inspect from anywhere
huddle-cluster nodes list
NODE ID                ADDRESS                STATUS       HB       LAST SEEN
─────────────────────────────────────────────────────────────────────────────
web-01                 10.0.0.1:8080          alive        142      0.8s ago
web-02                 10.0.0.2:8080          alive        139      1.1s ago
web-03                 10.0.0.3:8080          dead         41       34.2s ago

Ask the scheduler which node to send the next workload to:

curl http://master:7070/v1/scheduler/next
{ "ok": true, "node": { "node_id": "web-01", "address": "10.0.0.1", "port": 8080 } }

Live topology and Prometheus metrics are built in:

http://master:7070/dashboard      → real-time cluster topology
http://master:7070/v1/metrics     → Prometheus scrape endpoint
http://master:7070/v1/docs        → interactive API explorer (Swagger UI)

How it works

Concept What it means
Inner ring Active servers handling traffic right now
Outer ring Servers cooling down after a hot streak
Thermal score EMA of relative latency anomaly, CPU, memory, error rate
Rotation Overheated servers evict outward; cooled servers return inward
Relative anomaly Compared to the cluster median — adapts to any baseline automatically

No server is permanently marked bad. Every server gets rest and returns.


Performance

Under server failure, P95 latency stays under 86 ms where NGINX round-robin reaches 5,027 ms — a 58× reduction. Full methodology and results in the research paper below.


Documentation

Single-instance guide USAGE.md
Cluster system docs/CLUSTER.md — MasterNode, Scheduler, RBAC, dashboard, API
API explorer http://your-master:7070/v1/docs (live, once the master is running)
Research paper docs/HuddleCluster.pdf · arXiv preprint

Roadmap

  • Thermal eviction, relative anomaly scoring, adaptive thresholds — v1.x
  • Redis backend, gRPC routing, Kubernetes discovery, Prometheus, webhooks — v1.4
  • Cluster system: MasterNode, AgentNode, CLI — v2.0
  • Auto recovery, RBAC, metrics, dashboard, OpenAPI + Swagger UI — v2.x
  • Cluster Scheduler — thermal-fitness workload placement — v3.0
  • Cluster Auto Scaler — load-signal scale recommendations — v3.1
  • Rolling Updater — zero-downtime batch upgrades with health gate — v3.2
  • Service Discovery — health-aware registry, metadata-driven, DNS responder — v3.3
  • HA Master — simplified Raft leader election, state replication, write redirect — v3.4
  • Multi-Region — cross-datacenter topology, region-aware scheduling — v3.5
  • Cluster Circuit Breaker — error-rate-based automatic trip/reset, scheduler exclusion — v4.0
  • Rate Limiter — per-node token bucket, burst protection, scheduler exclusion — v4.1
  • Canary Deployment — weight-based traffic splitting, start/advance/promote/abort — v4.2
  • Observability — structured JSON logging, distributed trace IDs — v4.3, Level 4 complete

Citation

Bhuiya, R. (2025). HuddleCluster: A Penguin-Inspired Self-Organizing Load Balancer
with Adaptive Thermal Eviction. https://github.com/rahadbhuiya/HuddleCluster
Bhuiya, Rahad (2026). HuddleCluster. figshare. Journal contribution.
https://doi.org/10.6084/m9.figshare.32397180
Bhuiya, Rahad (2026). HuddleCluster. Zenodo. https://doi.org/10.5281/zenodo.20348019

Author: Rahad Bhuiya  ·  License: MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

huddle_cluster-4.3.0.tar.gz (186.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

huddle_cluster-4.3.0-py3-none-any.whl (131.4 kB view details)

Uploaded Python 3

File details

Details for the file huddle_cluster-4.3.0.tar.gz.

File metadata

  • Download URL: huddle_cluster-4.3.0.tar.gz
  • Upload date:
  • Size: 186.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for huddle_cluster-4.3.0.tar.gz
Algorithm Hash digest
SHA256 e02cde7c6827fbd6d79b0f47efd7bc32b23e3aebf2424ea809d5fb8856a07295
MD5 35af2ebb02ce13ffd3cb356f5ae25208
BLAKE2b-256 67091a2f5acaa5c04bfaacc523a275eba7ea5f036943f7622c6757228bbe7e03

See more details on using hashes here.

Provenance

The following attestation bundles were made for huddle_cluster-4.3.0.tar.gz:

Publisher: publish.yml on rahadbhuiya/HuddleCluster

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file huddle_cluster-4.3.0-py3-none-any.whl.

File metadata

  • Download URL: huddle_cluster-4.3.0-py3-none-any.whl
  • Upload date:
  • Size: 131.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for huddle_cluster-4.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 302ee7b1db5ba7a78077f409c8fee1ca3ace02e1bca6b15abebfb359c36afcc8
MD5 b089b39c0bf46512e8b6942a1382d63b
BLAKE2b-256 6d8e4f0b1ad2a3b1eb6501e810ba3af3270d900d99cee073f4f4a18bbe202ae3

See more details on using hashes here.

Provenance

The following attestation bundles were made for huddle_cluster-4.3.0-py3-none-any.whl:

Publisher: publish.yml on rahadbhuiya/HuddleCluster

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

4.14.0

2 files

4.13.0

2 files

4.12.0

2 files

4.10.0

2 files

This release

4.3.0 This release

2 files

4.2.0

2 files

4.1.0

2 files

4.0.0

2 files

3.5.0

2 files

3.4.0

2 files

3.3.0

2 files

3.2.0

2 files

3.1.0

2 files

3.0.0

2 files

2.6.0

2 files

2.3.0

2 files

2.2.0

2 files

2.1.0

2 files

2.0.0

2 files

1.4.1

2 files

1.4.0

2 files

1.3.2

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page