damiensmith.dev
← All projects2025 – 2026

Load Balancer Playground

A small load balancer in front of simulated backends that slow down, fail and crash, with a live dashboard comparing random, round-robin and a scoring strategy.

TypeScriptNode.jsNetworking
The web dashboard: traffic, failure and crash controls, three simulated backends with CPU, memory, latency and error rate, and success rates for the scoring, random and round-robin strategies.
Same traffic, three strategies: scoring 97.5%, random 99.3%, round-robin 100%.
About

What it does

A learning project. Three simulated backends have load-driven CPU, memory and latency, failure rates that climb under load, flaky health checks and the occasional crash. The balancer retries across backends, times out slow requests, and has a per-backend circuit breaker.

A browser dashboard runs all three strategies side by side and lets you change traffic, failure rates and presets from stable to chaos live, without restarting. There's a terminal view too.

The finding I didn't expect: my scoring balancer did consistently worse than round-robin and random. Traffic herded onto whichever backend looked best, it reacted to load it had caused itself, and its metrics lagged by two seconds. Power-of-two-choices is the fix I'd try next.

  • +Three strategies under identical traffic
  • +Circuit breakers, retries and timeouts
  • +Terminal and web dashboards