Java Zero to All All questionsPractise free
Interview questions › Distributed Systems & Messaging › Microservice Patterns & Architecture

Explain circuit breaker states and the specific failure it prevents.

Level III · MidMicroservice Patterns & Architecture
Short answer

It prevents cascading failure: when a downstream is slow/down, callers pile up threads waiting on timeouts until the caller itself exhausts its pool and falls over, taking its own callers with it.

Explanation

CLOSED passes calls through while counting failures over a sliding window; OPEN fast-fails without a network call once a failure-rate threshold trips; after a cooldown it goes HALF-OPEN and lets a few probes through, closing on success or reopening on failure. The breaker must be paired with sane timeouts (the original cause), bulkheads, and a fallback for graceful degradation — a breaker with infinite timeouts still hangs.

Common mistakes
  • Saying a circuit breaker retries calls.
  • Not explaining the half-open state.

Can you say this out loud in two minutes? Drill it in a timed mock interview, with flashcards and runnable code for Microservice Patterns & Architecture.

Practise free

More on Microservice Patterns & Architecture