Here are a few advantages of a circuit breaker:
- Monitoring: The circuit breaker is very valuable for monitoring. If a service goes down, it should be monitored, properly logged somewhere, and recovered from a failure state.
- Fault-tolerant: When you test various states in your circuit breaker, this helps you add logic to create a fault-tolerant system. For example, if service1 is unavailable, then we can add logic to fetch the service1 page from the cache.
- Reduced load: If service1 is slow or down, a circuit breaker can handle this situation by serving a cached page or a timeout page and help the services to recover by reducing their load.
As we can see in the following diagram, the circuit breaker pattern ...