To limit the duration of operations, we can use timeouts. Timeouts can prevent hanging operations and keep the system responsive. However, using static, fine-tuned timeouts in microservices communication is an anti-pattern; we are in a highly dynamic environment where it's almost impossible to come up with the right timing limitations that work well in every case.
Circuit breakers insulate a service from its dependencies by preventing remote calls when a dependency is determined to be unhealthy, just as electrical circuit breakers protect homes from burning down due to excessive use of power. Circuit breakers are implemented as state machines:
In the closed state, all calls ...