Cascading failures are the silent killer of microservice architectures. A slow downstream service can hold goroutines/threads, exhaust connection pools, and take down your entire platform.

The circuit breaker pattern

Like an electrical circuit breaker, the software pattern trips to an open state when failure rate exceeds a threshold. In the open state, calls fail-fast without hitting the downstream service — giving it time to recover.

cb := nexabreaker.New(nexabreaker.Config{
    MaxFailures:  5,
    Timeout:      10 * time.Second,
    HalfOpenMax:  2,
})

Implementation across services

We built a shared library that wraps HTTP clients and gRPC stubs. Configuration lives in our service mesh — no code change required when tuning thresholds.

Observability

Every circuit state change emits a structured event to our log pipeline. We alert when any circuit stays open for more than 60 seconds, which almost always indicates a real outage.