Circuit Breaker/Throttle Pattern
Circuit Breaker and Throttle Pattern

Circuit Breaker/Throttle Pattern


"We did not expect such a spike from the upstream server"

OR

"Downstream service was very slow to respond which led to exhaustion of all our threads causing this major outage"

How often do you hear the above statements in an RCA. If it is common, then you need to seriously look into circuit breaker/Throttle pattern. CB is a resiliency pattern that assures that upstream/downstream systems wont be able to take your application down.

Circuit Breaker (CB) Pattern

When an application wants defensive measures to protect itself from primarily slow failures of the downstream services it leverages the CB pattern. The implementation is agnostic to the business logic, anytime you make a 2nd party call you annotate your code with the CB library method and the library will take care of managing the resiliency. You will be able to control the various properties like error rate, response time, cool-down period and other params to give the best experience to your upstream services.

To be resilient, fail fast and escalate faster!

Circuit breaker creates a FSM(finite state machine) where the service gets to define when will it change the state.

  1. Circuit Open : calls are failing, calls not being made to the downstream services
  2. Circuit Closed: All is good, nothing to worry about.
  3. Circuit half-open: It had tripped, now testing if we can try again

Throttle Pattern

When the application defends itself against the incoming traffic (vs outbound in CB) it leverages throttling pattern. Throttling is typically used with autoscaling to minimize downtime and remove any human intervention.


Visual representation of Throttle and CB together.

Tools to implement

Please share with us your experience and any other library that you tried and how was the experience.

I used https://sketchboard.me/ and https://creately.com/ to create the illustrations.

Anowar I.

Engineering Leader, Identity Platform at Microsoft

6 年

Nice post! This pattern is a great enabler in the micro-service world. I was introduced to it in my last project when we moved a monolith banking application to an event-driven CQRS system, this was one of the major questions, how do you handle when the vendor is down, or the communication to them is broken etc.?One additional viewpoint around throttling is, the app should be able to defend itself and also defend?its downstream service.

Ellery Addington-White

Founding Engineer at Momento | AWS Community Builder

6 年

When I was on TTO Platform last year we used hystrix and I loved it. Not only for circuit breaker and throttling but also added benefit of servo which we used to replace Wiley. Huge fan of Netflix java tooling. Was one of the major factors that helped us move to AWS and is still in there today running great. Great write up! Love the diagrams.

要查看或添加评论,请登录

Rachit Lohani的更多文章

  • Power of Rituals

    Power of Rituals

    As the CTO of Paylocity, I've witnessed firsthand the transformative impact of rituals within our high-growth…

    6 条评论
  • Customer as co-creator

    Customer as co-creator

    “Customer as co-creator” is a guiding principle of our product development lifecycle. We actively involving customers…

    2 条评论
  • Help us grow SMBs in the US

    Help us grow SMBs in the US

    There are 32M small and medium businesses in the US that employ over 50% of the working population (65M lives). They…

    1 条评论
  • 7 Laws that Guide Tech Leaders

    7 Laws that Guide Tech Leaders

    Remember Laws of Motion and how they are used to figure out how an object moves. Similarly, in tech organizations we…

    3 条评论
  • Why do you need a Serverless strategy

    Why do you need a Serverless strategy

    I recently was asked what is the use case for leaning towards Serverless when the same can be done with microservices…

    5 条评论
  • Subscription Economy

    Subscription Economy

    After reading your early morning articles on the well curated and personalized Medium Platform, you head over to the…

    3 条评论
  • AWS, you Beast!

    AWS, you Beast!

    I personally did not buy anything on Prime day but closely watched to see how it unfolds for AWS throughput and amazons…

    2 条评论
  • Fintech - Hot or Not

    Fintech - Hot or Not

    Fintech is one of the most interesting and hottest areas of growth. CBinsights released their Quarterly report on how…

  • What is #noops or #gitops

    What is #noops or #gitops

    In the previous blog we talked about Journey of Operations. This is part#2 of that blog where we cover what is GitOps…

  • Operations Engineering Evolution

    Operations Engineering Evolution

    It is a well known fact scaling is hard, be it in people, process or technology. In hypergrowth markets, it is well…

    5 条评论

社区洞察

其他会员也浏览了