potential enhancement for our microprofile fault tolerance impl

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

potential enhancement for our microprofile fault tolerance impl

Romain Manni-Bucau
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 |  Blog | Old BlogGithub | LinkedIn | Book
Reply | Threaded
Open this post in threaded view
|

Re: potential enhancement for our microprofile fault tolerance impl

Francois Papon
Hi Romain,

I can try to take a look and push a PR :)

regards,
François
[hidden email]
Le 22/04/2020 à 15:48, Romain Manni-Bucau a écrit :
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 |  Blog | Old BlogGithub | LinkedIn | Book
Reply | Threaded
Open this post in threaded view
|

Re: potential enhancement for our microprofile fault tolerance impl

Francois Papon

Hi,

I pushed a PR for this thread:

https://github.com/apache/geronimo-safeguard/pull/4

TCK passed.

regards,

François
[hidden email]
Le 22/04/2020 à 16:14, Francois Papon a écrit :
Hi Romain,

I can try to take a look and push a PR :)

regards,
François
[hidden email]
Le 22/04/2020 à 15:48, Romain Manni-Bucau a écrit :
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 |  Blog | Old BlogGithub | LinkedIn | Book
Reply | Threaded
Open this post in threaded view
|

Re: potential enhancement for our microprofile fault tolerance impl

Romain Manni-Bucau
Thanks a lot François, exactly what I had in mind.
Merged ;)

Romain Manni-Bucau
@rmannibucau |  Blog | Old BlogGithub | LinkedIn | Book


Le ven. 1 mai 2020 à 18:21, Francois Papon <[hidden email]> a écrit :

Hi,

I pushed a PR for this thread:

https://github.com/apache/geronimo-safeguard/pull/4

TCK passed.

regards,

François
[hidden email]
Le 22/04/2020 à 16:14, Francois Papon a écrit :
Hi Romain,

I can try to take a look and push a PR :)

regards,
François
[hidden email]
Le 22/04/2020 à 15:48, Romain Manni-Bucau a écrit :
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 |  Blog | Old BlogGithub | LinkedIn | Book