[rules-users] How to avoid stateless session rule fire on every fact ?
viraj
mayuraviraj at gmail.com
Wed Aug 7 04:14:05 EDT 2013
Hi all,
In my project I have 20,000 rules to reason with 20,000 facts. The rules are
embedded in facts. Therefore for each rule , there is one fact object which
that rule belongs to. I'm using following condition to find this matching
object.
rule "Book Rule 1 - 187970786749253 "
no-loop true
when
$book : Book( bookId == 187970786749253 , $eligible : eligible == false )
UserProfile( userType == UserType.STUDENT , status == 1 ) //... other
conditions
then
//Do something here...
end
So above rule is belongs to Book object which has id = 187970786749253 (
This is a unique id ). I'm using stateless sequential rule engine.
Following is the my understanding how rules are executed over facts.
For first rule it needs to check all the 20,000 objects in worst case to
find matching Book. For second rule the worst case should be 19,999 object
search since one object is found and processed. But I used
AgendaEventListener to find the time for each rule. It has nearly constant
time for each rule , which means for each rule, engine search all the 20,000
object. I need to avoid this still keeping stateless session. Any ideas how
to do this ?
Thanks !
--
View this message in context: http://drools.46999.n3.nabble.com/How-to-avoid-stateless-session-rule-fire-on-every-fact-tp4025383.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
More information about the rules-users
mailing list