/*
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
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.