[rules-users] Rule set execution performance and memory consumption issues

Wolfgang Laun wolfgang.laun at gmail.com
Mon Aug 5 03:04:59 EDT 2013


Grüezi Joe,



On 05/08/2013, Joe Ammann <joe at pyx.ch> wrote:
> On 08/05/2013 06:29 AM, Wolfgang Laun wrote:
>
> That's one thing I already learnt :-) I'm not using any "from" clauses
> in my rule sets which are used against the "big" fact sets.
>
Fine. Although occasionally useful, "from <expression>" is often used
as a cover-up for inadequate design of fact types. (from
collect/accumulate is a different matter.)

>> And, in order to learn more, some monitoring should be considered. The
>> number of activation creations and deletions (not by firing) can
>> indicate wasted work that might be avoided.
> I tried to implement something like that, but must admit that I don't
> yet understand how I would do such a monitoring?! All I currently have
> are custom AgendaEventListener and WorkingMemoryEventListener. I would
> suspect that to implement such a monitoring, I would use
>
>     void activationCreated(ActivationCreatedEvent event);
>     void activationCancelled(ActivationCancelledEvent event);
>
> of the AgendaEventListener. Could you point me to some documentation
> that explains when exactly those events are triggered? Until now, I
> haven't found too much doc on these aspects of Drools :-/

Hmm, there isn't much. Perhaps I should consider writing another white
paper on monitoring.

Activations are created whenever WM changes (or rule base changes)
make LHSs true for some fact set. At first, an activation is added to
the agenda. Firing removes an activation, but so does any change to
the set of facts in the WM. For instance:
   rule AB when
      A( $aid: id )
      not B( id == $aid )
   then ... end
Inserting 100k As and *then* 100k matching Bs before calling
fireAllRules creates and deletes 100k activations; with Bs before As
nothing is wasted.

Activations can be destroyed by calling clear() on the Agenda, and
they can "evaporate" by being filtered away by an AgendaFilter that's
passed to the fireXY method.

Cheers
Wolfgang

>
> --
> CU, Joe
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



More information about the rules-users mailing list