Hi everyone,

I'm not a big user of Microprofile fault tolerance (without entering into
the details cause it is not the goal but I'm putting the features elsewhere
in the app), but I realized implementing a custom circuit breaker with more
or less the same kind of configuration than MP one that we can optimize our
circuit breaker implementation. Long story short the spec requires to have
a rolling window which is basically an array of boolean representing
successes and failures.
However, our current impl uses an array of boolean, which means for a
window of 1024 we'll have 1024 boolean.

Using a BitSet we can make it pass to 16 longs instead of 1024 booleans
which is quite different.
Implementation change is not that complicated, it will just require to
handle an "int count" next to the BitSet to replace the array.length usage
and bitSet.cardinality() will give us the number of "true" (so false are
1-that).
With that we can reduce a lot the memory usage of our circuit breaker.

If anyone wants to have a go, feel free to open a PR.

Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>

Reply via email to