The Circuit Breaker Pattern

Circuit Breaker Definition

A good analogy : the Order service getting a break while it processes current requests…
  • Closed : Non-intuitively this state means that requests will go through, as no faults or timeouts were detected.
  • Open : In this state all requests are temporarily rejected for a set period of time. This gives the opportunity for the failing service to recover.
  • Half-open : This state always follows the Open state, a limited number of requests are allowed to go through, if they fail we go back to the Open state, if they succeed we assume the dependency has recovered and we go to the Closed state.
Circuit Breaker Decision Diagram
0 closed
1 closed
Get https://404.google.com: lookup 404.google.com: no such host
2 closed
Get https://404.google.com: lookup 404.google.com: no such host
3 open
circuit breaker is open
4 open
5 half-open
6 closed
Get https://404.google.com: lookup 404.google.com: no such host
7 closed
Get https://404.google.com: lookup 404.google.com: no such host
8 open
circuit breaker is open
9 open
10 half-open

--

--

--

Freelance Software Developer living in London. I love Golang, Microservices and well-designed software.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Setting Up A Small Windows Domain

🥇🦍🦍🦍

The Bootcamp Launch Event

Fourth destination — Faces of Polymorphism

Write software like Bruce Lee

Most Promising and Finest VSCode Extensions I Use Daily.

Adventures in cloud computing: welcome to AWS re/Start

Git…How Not to Get Got with Source Control

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mehdi Souihed

Mehdi Souihed

Freelance Software Developer living in London. I love Golang, Microservices and well-designed software.

More from Medium

Distributed communication patterns with NATS

Kafka multi-broker in Go

Use pprof to view go program stack traces

Generating JSON data from Go (Golang) structs with Go2JSON