On 07/08/2013, viraj <[email protected]> wrote: > 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
This very unusual. What is the point in defining one rule for each book? Apparently these rules should reflect library procedures and I can't imagine any library to need different processing for each book. (There may be different processing per *category*, i.e., books that can be taken out and books that can't etc. Perhaps you describe the requirements of your application project. > > 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. You can't measure the time required for the evaluation of a rule set against a fact set by lisstening to agenda events. This will give you the time required for the execution of the consequence (the then-part) of a rule. You can measure the time required for inserting the 20000 facts, but I don't think that this will vary much, either. -W > 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. > _______________________________________________ > rules-users mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/rules-users > _______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
