Circuit Breakers: How to Stop One Service Failure From Taking Down Your System
What happens when one service fails, but your entire system keeps calling it anyway ?
Imagine your payment service is down. Normally, every purchase request follows a path like this:
User ↓Order Service ↓Payment Service ↓Bank
Now the Payment Service is unavailable — or perhaps it’s simply extremely slow. A request that normally takes 200 ms now takes 10 seconds. If your system continues sending requests to it, what happens ?
- Request queues grow.
- Threads and connections remain occupied.
- Timeouts increase.
- Latency goes up.
And eventually, services that were perfectly healthy can start failing too.
In other words, one failing dependency can potentially bring down an entire system.
This is where the Circuit Breaker pattern comes in.
Instead of continuously calling a dependency that is already failing, the system temporarily stops sending requests to it and fails fast.
The goal isn’t to fix the broken service. The goal...
Copyright of this story solely belongs to hackernoon.com. To see the full text click HERE