Measure Rule execution time

375 views
Skip to first unread message

Rodrigo Ornellas

unread,
Jul 25, 2016, 10:50:25 AM7/25/16
to Drools Usage
Hi guys... is there some way to get the statistics of the execution time per rule? We have a system wich runs hundreds of rules and we want to know about a average execution time per rule. Is there any way?


Att,

Rodrigo Ornellas

Mauricio Salatino

unread,
Jul 25, 2016, 11:09:56 AM7/25/16
to drools...@googlegroups.com
Well the evaluation time is minimal, but it can be tested. Notice that the execution cycle will take as much as your RHS takes to execute, but the evalaution phase is quite fast. Are you interested in just measuring the evaluation phase (LHS)? 

Regards

--
You received this message because you are subscribed to the Google Groups "Drools Usage" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-usage...@googlegroups.com.
To post to this group, send email to drools...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-usage/d0900d8d-a577-480b-9d3c-c58a63598950%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
 - MyJourney @ http://salaboy.com
 - Co-Founder @ http://www.jugargentina.org
 - Co-Founder @ http://www.jbug.com.ar
 
 - Salatino "Salaboy" Mauricio -

Rodrigo Ornellas

unread,
Jul 25, 2016, 12:52:45 PM7/25/16
to Drools Usage
Hi, thank's for the fast reply!

I need to check the LHS, because we have a pattern for the 'THEN' clause, the only things that changes pretty well are the verification done at the 'WHEN' clause. If possible, would be interesting to the both LHS and RHS, separetedly.

Some rules are taking to long to be executed, I need to keep the execution time for every LHS to have an average time for the execution for that rule.

Rodrigo Ornellas

unread,
Jul 26, 2016, 3:58:47 PM7/26/16
to Drools Usage
>>> I am sending again because I am not sure if I replied correctly

Hi, thank's for the fast reply!

I need to check the LHS, because we have a pattern for the 'THEN' clause, the only things that changes pretty well are the verification done at the 'WHEN' clause. If possible, would be interesting to the both LHS and RHS, separetedly.

Some rules are taking to long to be executed, I need to keep the execution time for every LHS to have an average time for the execution for that rule.

Em segunda-feira, 25 de julho de 2016 12:09:56 UTC-3, Salaboy Mauricio Salatino escreveu:

Mauricio Salatino

unread,
Jul 27, 2016, 4:00:10 AM7/27/16
to drools...@googlegroups.com
You can use the AgendaEventListener and RuleRuntimeEventListener event listeners to measure how much time does it take your rule RHS to be executed with the AgendaEventListener hook points: 

public void beforeMatchFired(BeforeMatchFiredEvent event)

public void afterMatchFired(AfterMatchFiredEvent event)

For the LHS, I recommend you to check if you are using the FROM keyword to get data from external services (that is usually the reason of slowdowns) 

Usually you shoudn't be worried about measuring the LHS, because the evaluation doesn't happen per rule, is more per your entire KBase, but you can always measure from the time that you insert all your data to the beforeMatchFired(BeforeMatchFiredEvent event) to get a good estimate. 

HTH

Cheers


For more options, visit https://groups.google.com/d/optout.

Rodrigo Ornellas

unread,
Mar 7, 2017, 3:04:09 PM3/7/17
to Drools Usage
Hi... I am back!

Before anything, thank's for your explanation. At that time I was so busy trying to resolve that situation that I forgot about saying thanks.

Now I have a different question. 

I have a large data set of clients and there is a rule that matches an attribute of the current client with the same attribute over 10 millions of other clients.I'll have to iterate that list of millions of lines to do that match. Is there a better way to do that, inside the rule code? Something like querying redis looking if there is someone with that same attributes? Is that a bad thing to require external resources inside the rule?


Thanks
Reply all
Reply to author
Forward
0 new messages