Hello everybody,
I'm using drools 5.3.0-final to process events in stream mode with a pseudo
clock. I have created an do-nothing rule as follows:

rule "Do nothing"
        when
                $m : Message(  ) from entry-point fromDb
        then
                
end

Then I add a big number of events:

Calendar timestamp = new GregorianCalendar(2011, Calendar.DECEMBER, 10, 12,
0, 0);

for(int i = 0;i < 100000;i++) {
        
        Message message = new Message("test", timestamp.getTime());
        
        advanceSessionClock(pseudoClock, message.getTimestamp());
        fromDb.insert(message);   // <---
        ksession.fireAllRules();     // <---
        
        timestamp.add(Calendar.HOUR_OF_DAY, 1);
        
}

At the loop exit the memory usage is about 600MB. Increasing the number of
events increases also the ram usage up to about 1.4GB, then it remains
constant. If I don't insert the messages (lines with the comments), but I
still instantiate them, at the exit of the loop, the program requires only
90MB.

With the given rule, it's not necessary to store the events, so in theory
the insert() should do nothing... however, when the events are inserted, it
seems that drools performs a lot of useless work and allocates a lot of
memory. The fact that the consumption tops at 1.4GB (a quantity much higher
than the 90MB used by the messages alone) tells us that at that point the gc
is triggered and that drools correctly releases the references. 

It seems pointless to optimize the engine for this case, but this happens
also when the rules are used as "filters" between streams:

rule "Filter test messages"
        when
                $m : Message( message == "test" ) from entry-point fromDb
        then
                entryPoints["testMessages"].insert($m);
end

rule "Only test messages"
        when
                $m : Message(  ) from entry-point testMessages
        then
                
end

How can I decrease the memory footprint for these simple rules?

--

MM


--
View this message in context: 
http://drools.46999.n3.nabble.com/Empty-rule-and-event-retention-tp3616771p3616771.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to