Repository navigation
Releases
loadbear v0.4.0
Defaults unchanged. New opt-in proxy.circuit_count_tunnel_errors: tunnels that end with an upstream I/O error count as one circuit breaker failure. Clean upstream closes are never counted, because a normal WebSocket close handshake looks the same as a backend closing the tunnel at the TCP level. Test with your own WebSocket server before enabling it in production.
Added
- Tunnel active gauges, duration histogram, and per-backend close-reason counters; ambiguous close causes are reported as
unknown. - Opt-in
proxy.circuit_count_tunnel_errorsbreaker accounting for upstream tunnel I/O errors only. Clean upstream closes are never counted because a normal WebSocket close handshake is indistinguishable at the TCP level; the feature defaults off.
loadbear v0.3.0
Behavior change: consecutive upstream 5xx responses now open the circuit breaker by default (previously they reset the failure count and the breaker never opened).
Changed
- Behavior change: With the default empty
proxy.circuit_failure_statuses, consecutive upstream 5xx responses now accumulate towardproxy.circuit_failure_thresholdand open the circuit. They still do not mark the backend unhealthy or trigger status-based retries. - The reverse proxy reuses response-copy buffers to reduce per-request allocation observed in the profile benchmark; request and response behavior is unchanged.
Fixed
- Upstream 5xx responses no longer reset the consecutive circuit-failure count before being recorded. Unlisted 429/404 responses remain non-failures.
- A health check canceled while reloading settings no longer marks its backend unhealthy.
Added
- SIGHUP reload of health-check path, interval, timeout, and healthy/unhealthy thresholds. Changed settings replace the checker loop without overlapping loops and preserve health flags for unchanged backends.
- Opt-in
admin.pprof_enabledprofiling handlers on the admin listener and a reproducible proxy profile benchmark. - A Linux CI benchmark smoke test that runs
loadgenthrough the proxy and checks request/error counts without performance thresholds.
loadbear v0.2.1
Added
- Standard-library
cmd/loadgenwith bounded latency sampling and JSON/Markdown summaries. - Reproducible Linux/macOS and Windows benchmark scripts for direct-backend and proxy strategy scenarios.
proxy.circuit_failure_statusesto configure additional breaker failure statuses, with retries only for eligible requests before response commitment.- Graceful tracking and force-close of upgraded tunnels when shutdown grace expires.
- Cumulative Prometheus latency buckets with
_sum/_count, per-backend request/failure and circuit metrics, and a rate-limited counter.
Changed
- Prometheus backend labels now use escaped
backendvalues and stable backend ordering. - Backend request counters include each upstream attempt; terminal transport errors no longer double-count backend failures.
loadbear v0.2.0
Note: in v0.1.x, sending SIGHUP terminated the process. Upgrade if you rely on signals.
Added
- Linux/macOS
SIGHUPreload of backend URLs, weights and selection strategy. Unchanged backends keep their state (health, counters, circuit breaker) and in-flight requests are not interrupted. An invalid config is rejected and the running config is kept. Other settings (listen addresses, timeouts, health-check settings, rate limiting, logging) still require a restart. - Integration tests for HTTP/1.1 upgrade handshakes and bidirectional byte echo through the proxy.
Fixed
SIGHUPterminated the process instead of reloading. It is now handled separately from the shutdown signals.UpgradeandConnectionheaders were stripped from every request, which broke WebSocket upgrades. They are now preserved for upgrade requests only; upgrade requests are never retried.- The access-log response wrapper did not implement
http.Hijackerandhttp.Flusher, which prevented upgrade tunnels. - Backend lists held by the metrics and health-check components were read and written without synchronization.
loadbear v0.1.1
Breaking: rate_limit.trusted_proxy (bool) was replaced by rate_limit.trusted_proxies (list of IPs/CIDRs). The admin listener now binds to 127.0.0.1:9090 by default.
Fixed
- Circuit breaker half-open state admitted unlimited concurrent probes; now exactly one, released on every exit path
- Retries no longer happen for requests with non-replayable bodies or after a response has started
- Retry backoff now respects the client's original deadline
X-Forwarded-Foris only trusted from configured proxy addresses
Added
- Fake backend modes:
hang,close,drop-mid,slow - Regression tests for all of the above
loadbear v0.1.0
First public release of loadbear, a small, friendly load balancer written in Go.
Features
- Reverse proxy with request ID propagation and forwarded headers
- Four balancing strategies: round robin, smooth weighted round robin, least connections and IP hash
- Active health checks with healthy/unhealthy thresholds, plus passive detection on proxy errors
- Retries for idempotent requests (GET, HEAD, OPTIONS) on upstream errors, with configurable backoff
- Per-backend circuit breaker
- Per-IP token-bucket rate limiting with
429andRetry-After - YAML configuration with
LOADBEAR_LISTENandLOADBEAR_LOG_LEVELoverrides - Separate admin listener with
/statusand/metrics(Prometheus text format) - Structured access logs and graceful shutdown
- Multi-stage Dockerfile and a Docker Compose demo
Quick start
go run ./cmd/fakebackend --port 8081 --name b1
go run ./cmd/fakebackend --port 8082 --name b2
go run ./cmd/fakebackend --port 8083 --name b3
go run ./cmd/loadbear --config examples/config.example.yamlOr run everything with docker compose up --build.
Known limitations
- WebSocket upgrades are not verified and should be treated as unsupported.
- SIGHUP hot reload is not implemented.
- Metrics are a small hand-written Prometheus text endpoint, not a full client implementation.
- No load or performance benchmarks are provided yet.
See the README for configuration details.