You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Romain Manni-Bucau <rm...@gmail.com> on 2020/04/22 13:48:11 UTC

potential enhancement for our microprofile fault tolerance impl

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>

Re: potential enhancement for our microprofile fault tolerance impl

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Thanks a lot François, exactly what I had in mind.
Merged ;)

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>


Le ven. 1 mai 2020 à 18:21, Francois Papon <fr...@openobject.fr> a
écrit :

> Hi,
>
> I pushed a PR for this thread:
>
> https://github.com/apache/geronimo-safeguard/pull/4
>
> TCK passed.
>
> regards,
>
> Françoisfpapon@apache.org
>
> 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çoisfpapon@apache.org
>
> 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 <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>
>
>

Re: potential enhancement for our microprofile fault tolerance impl

Posted by Francois Papon <fr...@openobject.fr>.
Hi,

I pushed a PR for this thread:

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

TCK passed.

regards,

François
fpapon@apache.org

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
> fpapon@apache.org
> 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 <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>

Re: potential enhancement for our microprofile fault tolerance impl

Posted by Francois Papon <fr...@openobject.fr>.
Hi Romain,

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

regards,

François
fpapon@apache.org

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 <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>