{
  "id": 6856710,
  "title": "Circuit Breaker Pattern",
  "url": "https://urgent.news/2026/09/12/circuit-breaker-pattern",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-12T04:00:00.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/gouranga-das-khulna/circuit-breaker-pattern-39op"
  },
  "original_language": "en",
  "account": "The circuit breaker pattern is a technique that prevents a failing service from being repeatedly called, allowing it time to recover. This protects the entire system from cascading failures that occur when one slow service causes a chain reaction, exhausting thread pools and timeouts which then bring down everything upstream.\n\nThere are three states in a circuit breaker: CLOSED (normal operation), OPEN (service is down), and HALF-OPEN (testing recovery). When the failure threshold is exceeded, the circuit trips to the OPEN state, immediately failing requests without making a network call and returning cached or default responses. After a reset timeout, the circuit enters HALF-OPEN state to test if the service has recovered. If successful, it returns to CLOSED; if not, it remains in OPEN.\n\nCircuit breakers are implemented in various programming languages, such as Java (Resilience4j, Hystrix), Node.js (opossum), Go (sony/gobreaker), Python (pybreaker), and .NET (Polly). They can also be integrated into service meshes like Istio, requiring no code changes.\n\nUsing circuit breakers offers several benefits: preventing cascading failures, providing quick responses instead of long timeouts, and enabling graceful degradation with fallback strategies like cached responses or static pages. However, implementing circuit breakers adds complexity, and tuning the failure threshold can be tricky to avoid flapping or slow tripping. Probes during the HALF-OPEN state may still allow some failures to pass through, and stale cached data as fallback can mislead users.\n\nCircuit breakers are particularly useful when calling external APIs, microservices, or synchronous calls with timeout risks. They should be avoided for local in-process functions, async message queues, or when already using a service mesh that handles circuit breaking.",
  "summary": "One-liner: A circuit breaker stops calling a failing service to give it time to recover — instead of hammering it with requests that are guaranteed to fail. ❓ The Problem: Cascading Failures User Request ↓ Service A ──► Service B ──► Service C (DOWN 💥) ↑ ↑ Threads hang Threads hang (timeout 30s) (timeout 30s) → Service A's thread pool exhausts → Service A goes down → Everything upstream dies →…",
  "key_points": [
    "Circuit breaker pattern prevents repeated calls to failing services, allowing recovery time.",
    "Three states: CLOSED, OPEN, HALF-OPEN; circuit trips to OPEN on failure threshold exceedance.",
    "Implemented in Java, Node.js, Go, Python, .NET; integrated into service meshes like Istio."
  ],
  "editors_take": "Adopting the circuit breaker pattern means developers can prevent cascading system failures and ensure quicker responses during service outages, but requires careful tuning and adds complexity to system design.",
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}