
This device pictured above, part of all electrical systems(you hope so
) has a feature to  put a break in electricity supply if something goes wrong.
WHY: Wherever there is overcurrent or short circuit, this prevents further damage to the whole system.
In software the current flowing through the network is the data. If one of the service your app depends on is down or slow, retrying it could cause more damage than solve the problem.
As part of making your application resilient and keeping the relevant services healthy, usually two patterns of retry are clubbed together. Circuit Breaker and Exponential Backoff.  In case of failure in service calls, following diagram explains how retry, exponential backoff and eventual circuit break looks like on a timeline.

Here it is re-trying a failing request four times, increasing the delay in calls each time, eventually giving up(break)
Alright, show me the code already…
An example in C# with Polly and Flurl
Don’t worry, you can copy or tinker the code here

Doing this just helped me wrap my head around it a bit better, production quality implementation will always look more detailed.




