Course contentsShow
← System Design
Lesson 1049 of 1,91927. Circuit Breakers and BulkheadsFree lesson

Timeout as a Failure Signal

How timeouts interact with circuit breakers and why slow responses should also count as failures.

Timeout as a Failure Signal

You'll learn why slow responses can be just as harmful as errors and how circuit breakers use timeouts to protect your system.

The Problem with Slow Failures

When a service crashes, you get a clear error immediately. But when a service becomes slow—stuck in a database query, waiting on an overloaded dependency, or experiencing network delays—your requests don't fail quickly. They just... hang.

These slow responses are actually worse than outright failures because:

  • They tie up threads and connections in your service
  • They cascade timeouts to upstream callers
  • They drain connection pools and memory
  • They create a "zombie horde" of half-dead requests consuming resources

How Circuit Breakers Track Timeouts

Circuit breakers monitor both explicit errors AND timeouts when counting failures against their threshold. A request that exceeds your configured timeout (say, 500ms) counts just like a 500 error or connection refused.

This is critical: if your payment service normally responds in 50ms but suddenly takes 10 seconds, the circuit breaker should trip before dozens of slow requests pile up and crash your system.

The Detection Logic

When counting failures toward your threshold, the circuit breaker treats these equally:

  • Connection errors
  • HTTP 5xx responses
  • Timeout exceeded ← This is your early warning system

The timeout acts as your "failure detector" for degraded-but-not-dead services. You're saying: "I don't care why you're slow—if you can't answer in 500ms, you're failing my SLA."

Key Takeaway: Timeouts are failure signals. Circuit breakers must count slow responses as failures because resource exhaustion from slow calls kills systems faster than clean errors. Set aggressive timeouts to fail fast and protect your upstream services.