Circuit Breaker - SDLC
It’s a software designs best practice to avoid cascading failures when an application cannot process the request or fails for some reason. Let’s say service A calls Service B. When service B has issues, can calling service like A will get 5xx errors and this can have cascading effects on the service which invoked A. To avoid this issue, it’s good to have a circuit break pattern. When a service fails continuously for 3 times then we have open the “Circuit Breaker”, • Service B will no longer accept requests from service A. • Service B handles the request by queueing them to process later once service B is recovered. • It can fail over the request to some other service. • It can half open after certain amount of time to see if the service recovered. Simple Python Program Implementing Circuit Breaker: The program uses random.random function to generate numbers between 0.0 to 1.0. If the generated number is lesser than 0.5 for 3 times, its calls another function ...