问题
Please help me find reasons why Circuit breaker and Bulkhead patterns are useful in a Spring Reactor application.
Since operations will be non-blocking in Reactor and those two patterns aim at saving potential hit to resources (mostly threads), in what cases can I benefit the patterns in my Spring Reactor app. The only thing I see at this point is if the requests are such a tremendously huge amount that keeping them in memory, while waiting for a timeout (instead of Circuit Breaker being up and falling back) we run OOM.
回答1:
Beside protecting your own application, these patterns also help you protect external services (REST API, database, etc): in case of increased latency and/or error rate, you give them room to recover. Failing fast in your application is also beneficial as you don't make your end-users wait too long for an error.
Resilience4j provides dedicated Reactor support for these patterns in place of the deprecated Hystrix library.
来源:https://stackoverflow.com/questions/62872623/why-use-circuit-breaker-and-bulkhead-when-working-with-spring-reactor