[rules-users] How many objects we can assert into working memorymaximum

Edson Tirelli tirelli at post.com
Wed Feb 28 07:41:16 EST 2007


   Ramesh,

   It is not easy to help you having only that much of information.
   What I can assure you is that I personally had worked in the 
development of a system where in production asserts more than 1 million 
facts into working memory. So, it is not a soft/hard limitation in the 
engine itself.
   Your use case must be profiled to see where the memory is going. 
Question: how much memory does your "ExtendedEvent" objects use? how 
much the engine use? how much the rest of the application use?

   On a rule writing tip, you realized by yourself that eval() is evil!! 
and yet, you are not the only one that tried to use it... :) maybe we 
should start a crusade against eval for people to be aware of how much 
it hurts performance. :) We have to support it because some really 
specific cases, need it, but it is not supposed to be used lightly.

   So, going back to the point, 15000 facts is really not that much. But 
the only way of understanding why you are having problems is profiling.

   []s
   Edson

Reddy Ramesh-in2259c wrote:

> Hi all,
>  
> This is Ramesh Reddy, trainee, in Motorola India Electronics pvt ltd.
>  
> I have a rule something like this....,
>  
>  
>  
> package com.motorola.nmatg.nms.nfm.suppression
>  
> import com.motorola.nmatg.nms.nfm.suppression.ExtendedEvent;
>
> /*
> This rule compress duplicates
> */
> rule "Compress"
>  salience 10
>  when
>   event_1 : ExtendedEvent ( moid1 : source , severity1 : severity , 
> eventType1 : eventType , eventTime1 : time )
>   event_2 : ExtendedEvent ( moid2 : source , severity2 : severity , 
> eventType2 : eventType , eventTime2 : time )
>  
>     
>   eval (
>             moid1.equals(moid2) &&
>             severity1.intValue() == severity2.intValue() &&
>             eventType1.equals(eventType2) &&
>             eventTime2.longValue() >= eventTime1.longValue()
>          )
>   
>  then
>  
>       event_1.setStatus("compress");
>       event_2.setStatus("compress");
>
> end
>  
>  
>  
> This is the rule which i am using in my DRL file. I am asserting 
> events into working memory such that all the events are matching with 
> the rule. But i am unable to assert more than around 1000 events into 
> workingMemory, I am keep asserting events into working memory, by the 
> time it reaches the count to around 1000 events, it is throwing memory 
> out of bound exception. I increased heap size from default 64mb to 
> 512mb. with this i could able to assert more 300 events thats it.
>  
> when i got this problem, i modified my rule in the following way,
>  
>  
> rule "Compress"
>  salience 10
>  when
>   event_1 : ExtendedEvent ( moid1 : source , severity1 : severity , 
> eventType1 : eventType , eventTime1 : time )
>   event_2 : ExtendedEvent ( source == moid1 , severity == severity1 , 
> eventType == eventType1 , time >= eventTime1 )
>     
>  then
>  
>       event_1.setStatus("compress");
>       event_2.setStatus("compress");
>
> end
>  
>  
> If i write my rule like this, then i could able to assert more 500 
> event objects. i.e i could able to assert in total around 1700 event 
> objects with this modified rule.
>  
> As per my understanding,
>  
>         when we assert objects into working memory, pattern matching 
> is done at the time of assertion only, while this process, if we 
> create more variables in "when" part and using "eval" creating more 
> overhead(memory perspective) while pattern matching. When we assert 
> thousands of objects(events) into working memory, i think Drools 
> engine creates several objects internally(in rete network which i am 
> not aware), i think that would be the overhead.
>  
> But in my project, i need to work with around 15,000 event objects in 
> the working memory, of them, around 10,000 objects will match the rule. 
>  
>  
> Can any one in the group help me how to approach to solve this 
> problem.  Is there anyway.. Ultimately, i have to work with 10000 
> events in working memory, given all the events matches with the rule 
> in DRL.
>  
>  
>  
> Thanks,
> Ramesh
>
> ------------------------------------------------------------------------
> *From:* rules-users-bounces at lists.jboss.org 
> [mailto:rules-users-bounces at lists.jboss.org] *On Behalf Of *Michael Neale
> *Sent:* Tuesday, February 27, 2007 12:52 PM
> *To:* Rules Users List
> *Subject:* Re: [rules-users] How many objects we can assert into 
> working memorymaximum
>
> The answer is:
>
> 42.
>
> Or, perhaps, the length of a piece of string.
>
> It really varies with how much memory you want to throw at it, thats 
> all really. The effectiveness of the RETE network may also add some 
> overhead.
>
> I have heard of people pushing in millions of facts into one working 
> memory, but that would tend to be extreme - and it will use a lot of 
> memory.
>
> IN 3.2 there are some added efficiencies over 3.0, when it comes out.
>
> On 2/27/07, *Reddy Ramesh-in2259c* <in2259c at motorola.com 
> <mailto:in2259c at motorola.com>> wrote:
>
>     Hi,
>      
>            Is working memory size increases dynamically?? How many
>     objects we can assert into workingmemory? given, all the objects
>     are matching with rule in a drl file...
>      
>     can anyone please tell me this...?
>      
>     thanks,
>     Ramesh
>
>
>     _______________________________________________
>     rules-users mailing list
>     rules-users at lists.jboss.org <mailto:rules-users at lists.jboss.org>
>     https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>rules-users mailing list
>rules-users at lists.jboss.org
>https://lists.jboss.org/mailman/listinfo/rules-users
>


-- 
 Edson Tirelli
 Software Engineer - JBoss Rules Core Developer
 Office: +55 11 3124-6000
 Mobile: +55 11 9218-4151
 JBoss, a division of Red Hat @ www.jboss.com





More information about the rules-users mailing list