6 Replies Latest reply on Apr 3, 2018 5:18 AM by Rajiv Shivane

    Reducing Rule Helper instances

    Rajiv Shivane Newbie

      Hello Andrew and team:

       

      We are observing that one instance of our custom Rule Helper is created for every execution of the Rule. To reduce the GC burden, it would be nice if the Rule Helper instances could be reused. In our use case, most of our Rule Helpers could be singleton ... ie only one instance per Rule. We are not using any Bindings in our rules. 

       

      Would it be possible to implement some sort of reuse of the Helpers? 1. We could mark them as SINGLETON in the rule file, in which case byteman could call MyHelper.getInstance(Rule).helperMethod(<params>) or 2. We could mark the Helper in the rule file as STATIC, in which case byteman could look for static helper methods instead of instance methods.

      Along with the custom Helper, the InterpretedHelper instances should be reused. Since InterpretedHelper uses a bindingMap field, it appears that using static helper methods would mean that the Rules cannot have Bindings.

       

      Thoughts?!

       

      -Rajiv

        • 1. Re: Reducing Rule Helper instances
          Andrew Dinn Master

          Hi Rajiv,

           

          Sorry for the late reply -- for some reason I did not get a notification for this post and I only just saw it.

           

          I am afraid the creation of a helper instance is integral to the way Byteman operates. The helper carries the rule trigger context which is unique to each specific triggering of the rule.

           

          I am not sure why you are worried about GC costs. Normally helper instances only exist across the lifetime of the rule triggering (i.e. while the rule is being executed). In most cases that means they are allocated and die in the Eden GC space. This normally causes no significant memory overhead and merely implies that young GC collections happen with a very small increase in frequency.

           

          Do you have any measurements to suggest that GC costs are significantly increased because of Helper instance creation? Are you retaining handles on Helper instances across rule triggerings? I'd be happy to look into any problems you have found if you can provide me further details to see if I can advise on ways to avoid them.

           

          regards,

           

           

          Andrew Dinn

          • 2. Re: Reducing Rule Helper instances
            Rajiv Shivane Newbie

            Hi Andrew, I did not get notified either. Is there an alternate channel

            I will try to quantify the GC costs and get back to you on this thread.

             

            Thanks,

            Rajiv

            • 3. Re: Reducing Rule Helper instances
              Rajiv Shivane Newbie

              The forums limits to two replies per hour! Definitely need an alternate channel for communication

              • 4. Re: Reducing Rule Helper instances
                Andrew Dinn Master

                Hi Rajiv,

                rajiv.shivane  wrote:

                 

                Hi Andrew, I did not get notified either. Is there an alternate channel

                I will try to quantify the GC costs and get back to you on this thread.

                 

                I see you already found the byteman IRC channel on irc.freenode.net. That is the quickest way to get the attention of a Byteman dev during work hours.

                 

                There is no other channel for persistent Byteman discussion besides the JBoss forums. I will contact the JBoss admins to see if they can retune the servers to avoid missing notifications.

                 

                I'd be very interested to see any numbers you can provide to quantify GC costs.

                 

                regards,

                 

                 

                Andrew Dinn

                • 5. Re: Reducing Rule Helper instances
                  Andrew Dinn Master

                  Hi Rajiv,

                   

                  I am afraid I cannot actually see any of the text in the screen image you posted. Can you tell me what it actually says?

                   

                  regards,

                   

                   

                  Andrew DInn

                  • 6. Re: Reducing Rule Helper instances
                    Rajiv Shivane Newbie

                    The email notifications seem to be working now. But good to know that I can reach out on IRC if/when a topic needs attention.

                     

                    I will get back to you on GC metrics. However, it might take me some time.