TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Designing a distributed circuit breaker in Golang

18 pointsby subomi5 months ago

1 comment

nzach5 months ago
&gt; Our Solution: Use Redis and Postgres Database Polling + leader election using RedLock<p>To me this seems one of the worst architectural choices they could have made. I&#x27;m assuming they had some constraints that were not mentioned in the article to justify this decision. But for a simple distributed circuit breaker this seems far from a reasonable solution.<p>Besides that, there is one implicit assumption that was made that I&#x27;m not sure is true. By having a &#x27;leader&#x27; you are basically saying that your network connections never fail or that they always fail at the same time. Sure, under normal conditions this assumption doesn&#x27;t seem that bad. But as soon as things start to degrade you may have a pretty bad outage in your hands.<p>If I had to implement this feature I would probably use raft[0] to communicate between pods. And would also keep track of 2 values for each host. One is the local failure rate and the second one is the global failure rate. This way I can change my behavior according to current network conditions.<p>[0] - <a href="https:&#x2F;&#x2F;github.com&#x2F;hashicorp&#x2F;raft">https:&#x2F;&#x2F;github.com&#x2F;hashicorp&#x2F;raft</a>