BunLoad BalancerAuto-scalingDevInfra
Dynamic Load Balancer with Auto-Scaling — Bun + Express
// Built a local auto-scaling load balancer that spins instances, health-checks, and routes traffic based on load — shipped in ~4 hours.
TL;DR: I prototyped a dynamic, CPU-aware load balancer that spins backend instances locally using bun run, performs health checks, and auto-scales based on real-time traffic. Built in a focused 4-hour sprint.
Why build a local ASG replacement?
I wanted to understand ASG mechanics without vendor lock-in. The goal was to replicate the core behaviors (spawn, route, health-check, scale) in a minimal, transparent system.
Features
- Spins backend instances (each on configurable ports)
- Health checks + route only to healthy targets
- Auto-scale up/down based on configured thresholds
- CPU-aware sharding for the balancer itself to avoid single-threaded bottlenecks
- Simple
config.yamlfor instance definitions and scaling policies - Live /lb-status dashboard for quick monitoring
Implementation notes
- Core runner: Bun (fast startup) launching child processes
- Router: Express for HTTP routing and dashboard
- Health checks: periodic, pluggable handlers for HTTP/TCP
- Configuration: YAML (easy to edit and read)
Repo & demo
- Quick start: clone repo and run
bun run start --config config.yaml - Repository: https://github.com/Adityaadpandey/Load_Balancer (check README for examples) — or see my GitHub profile for the project. :contentReference[oaicite:3]{index=3}
END OF LOGReturn Home