Software Architecture in Golang: Circuit Breaker Cloud Design Pattern for Reliability
Welcome to another Software Architecture in Go video, in today’s episode we are covering a Cloud Design Pattern for improving Reliability called “Circuit Breaker”.
What is “Circuit Breaker”, this pattern handles errors that could take some amount of time to fix when connecting to a remote service, like a microservice. The idea is to detect those errors, determine how to react to them and have a process to retry the requests that previously failed.
Behind the scenes this pattern defines three states: “closed”, “half-open” and “open”, those are used to determine the steps to execute when failures stop and/or failures start.
For this specific example we are using: github.com/mercari/go-circuitbreaker, but there are few other implementations like:
* https://github.com/sony/gobreaker
* https://github.com/cep21/circuit
* https://github.com/afex/hystrix-go
* https://github.com/rubyist/circuitbreaker
In the end all of them follow the same pattern, I like mercari’s because it uses context.Context as a way to also determine failures.
—
RELEVANT LINKS
* Example code: https://github.com/MarioCarrion/todo-api-microservice-example/tree/bed67f7aaca477d5aa1cd7ff20b20245974ab5fc
* Previous Episode: “Software Architecture in Golang: Quality Attributes, Non-Functional Requirements and ilities”: https://youtu.be/pPHgT-p2Pco
* Playlist “Software Architecture in Go”: https://www.youtube.com/playlist?list=PL7yAAGMOat_GCd12Lrv_evJ3Zhv1dl8B-
* Playlist “Learning Go”: https://www.youtube.com/playlist?list=PL7yAAGMOat_F7bOImcjx4ZnCtfyNEqzCy
* Playlist “Building Microservices in Go”: https://www.youtube.com/playlist?list=PL7yAAGMOat_Fn8sAXIk0WyBfK_sT1pohu
* Playlist “GoTools and Packages”: https://www.youtube.com/playlist?list=PL7yAAGMOat_HEEOvH99agDs_5g51A0Ls3
* Playlist “Testing in Go”: https://www.youtube.com/playlist?list=PL7yAAGMOat_HSeW4zF0uRL9EaHadE4ZZq
00:00 Start
00:11 What is the Circuit Breaker Cloud Design Pattern?
01:23 Why is the Circuit Breaker Cloud Design Pattern needed??
04:17 Circuit Breaker Golang Demo
10:57 Circuit Breaker Pattern Conclusions
—
Who am I:
HelloππΌ! I’m Mario, a Hands-on Software Architect and Lead Backend Engineer with more than 16 years of professional experience building all kinds of software including on-premise Industrial Automation Systems, Linux Accessibility Desktop and Browser Components as well as Distributed Advertising Microservices.
Every week I will share with you different topics I’ve learned while working for small startups and large companies including the processes I’ve followed over the years for successfully delivering complex enterprise systems from start to end.
Subscribe if you like Software Development, Software Architecture and Systems Design!
Keep it up. Don’t give up!
#golang #microservices #softwarearchitecture
— Our affiliate links below
Shop our Amazon favorites β https://www.amazon.com/shop/rubycarrion
Shop my IG feed on my LIKEtoKNOWit (LTK) page β https://www.liketoknow.it/RubyCarrion
Shop Top Deals and Featured Offers at Best Buy β https://bestbuy.7tiv.net/c/2558226/687081/10014
Get a 30 day FREE Trial of Epidemic Sound β https://www.epidemicsound.com/referral/szx441/
Try Amazon Prime 30-day FREE Trial β https://amzn.to/3yf9a0f
I love getting Cash Back and think you will too! Join for FREE and get $30 when you spend $30. https://www.rakuten.com/r/RUBYRA132?eeid=28187
— Our Vlog Channel
https://www.youtube.com/c/RubyCarrion/videos
Comments are closed.