5

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.

Martin Tarjányi
  • 8,863
  • 2
  • 31
  • 49
LIvanov
  • 1,126
  • 12
  • 30
  • Bulkheads provide guard rails against overflowing Memory due to creation of unlimited threads. I also agree with this thought that it is not needed in a non-blocking IO – Hexy Apr 23 '21 at 00:13

1 Answers1

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.

Martin Tarjányi
  • 8,863
  • 2
  • 31
  • 49
  • 2
    Protecting external service is none of my concern in my case and I guess the external service should take care of itself. Apart from that, failing fast is indeed beneficial, thanks for you answer - looking forward to more ideas, though – LIvanov Jul 13 '20 at 18:13