[rules-users] high memory usage for rules with more than 6 facts ascondition

Swindells, Thomas TSwindells at nds.com
Wed Apr 14 05:55:10 EDT 2010


What conditions are you placing on the rule?
If you haven't got any conditions on them then the number of possible combinations (and so activations) that the rule can match will grow exponentially.
If you rule has 10 objects all of the same type and no conditions preventing them from being set to the same value then:
With 1 object in working memory there will be only 1 activation.
With 2 objects in working memory then there will be 2 possible values for the first object, 2 for the second, 2 for the third... eg 2*2*2*2*2*2*2*2*2*2 = 2^10 = 1024 activations
With 3 objects 3^10 =         59049 activations
With 4 objects 4^10 =       1048576 activations
With 5 objects 5^10 =       9765625 activations
With 6 objects 6^10 =      60466176 activations
With 7 objects 7^10 =     282475249 activations
With 8 objects 8^10 =    1073741824 activations
With 9 objects 9^10 =    3486784401 activations
With 10 objects 10^10 = 10000000000 activations

If you put some restrictions on so that you aren't matching every single combination then your memory usage should shrink.

> -----Original Message-----
> From: rules-users-bounces at lists.jboss.org [mailto:rules-users-
> bounces at lists.jboss.org] On Behalf Of murphy
> Sent: 14 April 2010 10:41
> To: rules-users at lists.jboss.org
> Subject: [rules-users] high memory usage for rules with more than 6 facts
> ascondition
>
>
> Hello,
>
> I did some tests to get an opinion about the performance of drools (5.0.1).
>
> At one test I have a rule with 10 objects (same object-type) declared as
> condition and got an OutOfMemoryException. I noticed that the memory usage
> increases when I insert the last facts into my
> StatefulKnowledgeSession. On fact 7 it increases with 10MB, on fact 8 with
> 46MB and on fact 9 with 170MB.
>
> I debuged a little bit in the drools-source and noticed that the
> LeftTupleMemory increased exponential with the number of facts I inserted.
>
> My question about this behaviour:
> Is a condition limited to a handful of facts or do I have to change the
> syntax to get it working? I know that I could insert the same object-types
> as a list, but assume that I have 10 facts with different object-types.
>
> Thanks in reply,
> Christian
>
> --
> View this message in context: http://n3.nabble.com/high-memory-usage-for-
> rules-with-more-than-6-facts-as-condition-tp718114p718114.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users


**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster at nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
**************************************************************************************

This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster at nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes.
To protect the environment please do not print this e-mail unless necessary.

An NDS Group Limited company. www.nds.com




More information about the rules-users mailing list