Skip to content
Calcrivo

Circuit Breaker Threshold Calculator

Determine whether a circuit breaker should open given observed error rate and window, and calculate the half-open retry schedule.

Inputs

requests

Total requests observed in the evaluation window.

requests

Requests in the window that counted as failures (errors, timeouts).

%

Error rate that triggers the circuit to open.

requests

Minimum requests required in the window before the breaker will evaluate the threshold (avoids tripping on tiny samples).

seconds

Time the breaker stays fully open before allowing a trial request through (half-open state).

Circuit Breaker State

Open

Observed Error Rate

22.50%

Margin to Threshold

-2.50pp

Half-Open Retry After

0.50minutes

Step by step

  1. Observed error rate: failed ÷ total

    45 ÷ 200

    = 22.50%

  2. Sufficient volume check

    200 ≥ 20

    = yes

  3. Breaker decision: error rate > threshold?

    22.50% > 20%

    = Open

How it works

A circuit breaker opens once the observed error rate in its evaluation window exceeds a configured threshold, but only after a minimum request volume has been observed to avoid tripping on statistically insignificant samples: opens_when error_rate > threshold% AND volume ≥ min_volume. Once open, the breaker rejects requests immediately (failing fast) until the half-open timeout elapses, at which point it allows a limited number of trial requests through to test whether the downstream dependency has recovered.

Formula

trips_when = error_count >= threshold within rolling_window_sec

error_count
Number of consecutive failures or errors
threshold
Failure count that triggers the circuit breaker
rolling_window_sec
Time window for counting failures (seconds)

Frequently Asked Questions

Why is a minimum request volume required before evaluating the threshold?

With very few requests, a single failure can produce a misleadingly high error rate (e.g. 1 failure out of 3 requests = 33%) — requiring a minimum sample size before evaluating prevents the breaker from flapping open on statistical noise during low-traffic periods.

What happens during the half-open state?

The breaker allows a small number of trial requests through to the downstream dependency; if they succeed, the breaker closes and resumes normal traffic, if they fail, it reopens and restarts the half-open timeout, backing off from a struggling dependency.

What's a reasonable error threshold?

20-50% is common for general-purpose circuit breakers, tuned lower for critical dependencies where you want to fail fast sooner, and higher for naturally noisy or already-degraded-tolerant dependencies where occasional errors are expected and acceptable.

How does circuit breaking interact with retries?

Retries should generally be attempted before the circuit breaker's error count is affected by transient failures, or the breaker should count only post-retry failures — otherwise aggressive retrying can itself inflate the observed error rate and trip the breaker prematurely under partial degradation.

You might also need