I am using resilience4j with Spring Boot 2.x What is the impact of using Retry and circuit breaker modules on memory and cpu?
Also what is the memory impact if I have 2000 events/s incoming each payload around 10Mb and I have kept the wait duration of retry as 15 seconds with exponential backoff multiplier as 2? I have 8Gb of application memory
The best way is to monitor your application with a profile like VisualVM. Then you can know where is the bottleneck.
One thing that I know that matters is where you create your circuitbreaker instance. In the end there is a collector that remove the instances not used. But in your case it seems to be a good idea to not place the creation of the circuit breaker on the get method like here
But create the circuitbreaker on the constructor.
There are also discussions to place one circuitbreaker per host. Other thing that you can do is to remove the instance of the Registry by yourself and not wait for the circuitbreaker component rome it in the future.
Here is a discussion also about to clean up the Registry memory.