'What is the difference between Circuit Breaker and Connection Timeout?
From my understanding, circuit breaker is a thing that can "disconnect" a connection when there is a issue (takes a long time than usual) when communicating to other service. Instead of always retrying to communicate with broken service, it will wait for a moment to give the broken service time to recover.
But we also already have "connection timeout", if a connection takes a long time it will stop and return error.
Therefore what is the difference?
Solution 1:[1]
The two ideas are certainly similar, and can be used to achieve similar properties.
A connection timeout is often implemented at a lower level. In your question, you say that "we already have" it. And it's true: most TCP or HTTP libraries will offer this feature by default. It might help to know that there are some services where it will not apply - for example connectionless services like UDP.
Sometimes, there can be a problem even if the connection is successful. It may be that the service you're connecting to keeps returning an error. Or maybe it takes a long time to respond with a useful answer, even though the connection doesn't drop. It's these higher-level aspects that can be caught with a circuit breaker pattern.
Some references that I find helpful:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | John |
