<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Circuit-Breaker on Krishnatejaswi S</title>
    <link>https://KTS-o7.github.io/bear/tags/circuit-breaker/</link>
    <description>Recent content in Circuit-Breaker on Krishnatejaswi S</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <managingEditor>shentharkrishnatejaswi@gmail.com (Krishnatejaswi S)</managingEditor>
    <webMaster>shentharkrishnatejaswi@gmail.com (Krishnatejaswi S)</webMaster>
    <copyright>Krishnatejaswi S</copyright>
    <lastBuildDate>Sat, 02 May 2026 00:00:00 +0530</lastBuildDate>
    <atom:link href="https://KTS-o7.github.io/bear/tags/circuit-breaker/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Circuit Breakers: The Pattern That Stops Cascading Failures</title>
      <link>https://KTS-o7.github.io/bear/systems/circuit_breakers_distributed_systems/</link>
      <pubDate>Sat, 02 May 2026 00:00:00 +0530</pubDate><author>shentharkrishnatejaswi@gmail.com (Krishnatejaswi S)</author>
      <guid>https://KTS-o7.github.io/bear/systems/circuit_breakers_distributed_systems/</guid>
      <description>&lt;p&gt;The payment service starts timing out. The fraud detection API it depends on is slow. Your retry logic kicks in &amp;ndash; which makes sense, retries are good &amp;ndash; but now every incoming request is spawning 3x the load on a service that was already struggling. The fraud service falls over completely. Now the entire checkout flow is dead.&lt;/p&gt;&#xA;&lt;p&gt;This is a cascading failure. One slow dependency turned into a full outage because the upstream service kept hammering it instead of stopping.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>The payment service starts timing out. The fraud detection API it depends on is slow. Your retry logic kicks in &ndash; which makes sense, retries are good &ndash; but now every incoming request is spawning 3x the load on a service that was already struggling. The fraud service falls over completely. Now the entire checkout flow is dead.</p>
<p>This is a cascading failure. One slow dependency turned into a full outage because the upstream service kept hammering it instead of stopping.</p>
<h2 id="the-pattern">The Pattern</h2>
<p>Circuit breakers fix this by failing fast. The name comes from electrical circuit breakers: when the current exceeds a threshold, the breaker trips and cuts power before anything burns. Same idea here.</p>
<p>The circuit has three states:</p>
<p><strong>Closed</strong> &ndash; normal operation. Requests go through, failures are counted. When failures cross a configured threshold within a time window, the circuit trips.</p>
<p><strong>Open</strong> &ndash; the circuit has tripped. Requests immediately return an error without calling the downstream service at all. No network round-trips, no timeouts, no extra load on a service that&rsquo;s already struggling. After a cooldown period, the circuit moves to half-open.</p>
<p><strong>Half-open</strong> &ndash; one test request is allowed through. If it succeeds, the circuit closes and normal operation resumes. If it fails, the circuit trips back to open and the cooldown resets.</p>
<p>The key insight is that sometimes the most useful thing you can do is stop trying. Retrying a failing service doesn&rsquo;t help it recover. Backing off does.</p>
<h2 id="where-youll-find-it">Where You&rsquo;ll Find It</h2>
<p>Netflix Hystrix made this pattern famous, but it&rsquo;s now table stakes in most infrastructure:</p>
<ul>
<li>Istio has it built into the service mesh at the sidecar level &ndash; no application code needed</li>
<li>Resilience4j for Java</li>
<li>Polly for .NET</li>
<li>Most Redis clients ship with circuit breaking on connection failures</li>
</ul>
<p>The mesh-level implementations are interesting because they work across languages and don&rsquo;t require every service team to implement the pattern themselves. You configure thresholds in the mesh and it handles the state machine.</p>
<h2 id="the-gotcha-timeout-ordering">The Gotcha: Timeout Ordering</h2>
<p>There&rsquo;s one configuration mistake that makes circuit breakers useless: setting your request timeout longer than your circuit breaker&rsquo;s failure window.</p>
<p>If your timeout is 30 seconds but your circuit breaker trips after 5 failures within 10 seconds &ndash; and each failure takes 25 seconds to time out &ndash; you&rsquo;ll accumulate only one or two failures in any 10-second window. The circuit never trips because failures arrive too slowly to hit the threshold, even while the system is drowning in slow requests.</p>
<p>The rule: timeouts must be shorter than the failure window. If your breaker watches a 10-second window and trips at 5 failures, your per-request timeout needs to be well under 2 seconds. Otherwise the breaker is just decorative.</p>
]]></content:encoded>
    </item>
  </channel>
</rss>
