RE: [rules-users] Drools 4 poor performance scaling?
hi , please provide more information on the above technique . Let me put what i have understood from the above explanation . u have around 700k - 900k total facts. first u are inserting single fact ie (ColdStarting fact) and retracts it ( how to retract it ?) when all the Jobs and Workers have been loaded.( it means all the other facts are loaded ??) This changed our startup time from over 50 minutes to under 5. what time it is ?? There's some sort of strange propagation and looping going on with accumulation on the fly, at least with our facts and rules. please exaplin more on this ? please provide the url on the wiki where we get more info on this . Thank you . Fenderbosch, Eric wrote: FYI for the group. We seem to have solved our performance problem. I'll describe our problem space a bit some people have some context. We load up about 1200 Jobs with about 3000 Stops and about 1500 Vehicles with about 2000 Workers. We then calculate Scores for each Vehicle for each Job. Some combinations get excluded for various reasons, but we end up with 700k - 900k total facts. We do score totaling and sorting using accumulators. One of our teams members (nice find Dan) decided to try to isolate the accumulation rules until all our other facts are loaded. Those rules now have a not ColdStarting() condition and our startup code inserts a ColdStarting fact as the first fact and retracts it when all the Jobs and Workers have been loaded. This changed our startup time from over 50 minutes to under 5. There's some sort of strange propagation and looping going on with accumulation on the fly, at least with our facts and rules. I'll put an entry on the wiki as well. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Fenderbosch, Eric Sent: Monday, June 30, 2008 11:46 AM To: Rules Users List Subject: RE: [rules-users] Drools 4 poor performance scaling? We are having a similar problem, although our fact count is much higher. Performance seems pretty good and consistent until about 400k facts, then performance degrades significantly. Part of the degradation is from bigger and more frequent GCs, but not all of it. Time to load first 100k facts: ~1 min Time to load next 100k facts: ~1 min Time to load next 100k facts: ~2 min Time to load next 100k facts: ~4 min This trend continues, going from 600k to 700k facts takes over 7 minutes. We're running 4.0.7 on a 4 CPU box with 12 GB, 64 bit RH Linux and 64 bit JRockit 5. We've allocated a 9 GB heap for the VM using large pages, so no memory paging is happening. JRockit is started w/ the -XXagressive parameter, which enables large pages and the more efficient hash function in HashMap which was introduced in Java5 update 8. http://e-docs.bea.com/jrockit/jrdocs/refman/optionXX.html The end state is over 700k facts, with the possibility of nearly 1M facts in production. After end state is reached and we issue a few GC requests, if looks like our memory per fact is almost 9k, which seems quite high as most of the facts are very simple. Could that be due to our liberal use of insertLogical and TMS? We've tried performing a commit every few hundred fact insertions by issuing a fireAllRules periodically, and that seems to have helped marginally. I tried disabling shadow proxies and a few of our ~390 test cases fail and one loops indefinitely. I'm pretty sure we could fix those, but don't want to bother if this isn't a realistic solution. Any thoughts? Thanks Eric -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ron Kneusel Sent: Thursday, June 26, 2008 12:47 PM To: rules-users@lists.jboss.org Subject: [rules-users] Drools 4 poor performance scaling? I am testing Drools 4 for our application and while sequential mode is very fast I get very poor scaling when I increase the number of facts for stateful or stateless sessions. I want to make sure I'm not doing something foolish before deciding on whether or not to use Drools because from what I am reading online it should be fast with the number of facts I have. The scenario: I have 1000 rules in a DRL file. They are all of the form: rule rule when Data(type == 0, value 0.185264); Data(type == 3, value 0.198202); then insert(new AlarmRaised(0)); warnings.setAlarm(0, true); end where the ranges checked on the values and the types are randomly generated. Then, I create a Stateful session and run in a loop timing how long it takes the engine to fire all rules as the number of inserted facts increases: // Run for(j=0; j 100; j+=5) { if (j==0) { nfacts = 1; } else { nfacts = j; } System.out.println(nfacts + :); // Get a working memory
Re: [rules-users] How to avoid circular rule activation for non circular problems?
On Thu, Jul 24, 2008 at 3:28 PM, Ralph Ammon [EMAIL PROTECTED] wrote: I'd like to get some hints to improve the rules of my simple planning system. My simple planning system is derived from the HelloWorld Drools Project. The job of my planning system is to calculate startTime and endTime as function of duration and predecessors for each task. Each task has the fields long duration; SetTask predesessors; long startTime; long endTime; For each task the rule (endTime = startTime + duration) should hold. If a task has no predecessors, then its startTime should be 0. If a task has predecessors, then is should start at the latest endTime of all predecessors. Maybe something like this would work? rule Calc EndTime no-loop true when $t : Task(endTime != (startTime+duration)) then $t.setEndTime( $t.getStartTime() + $t.getDuration() ); System.out.println( Drools: Set + $t.getName() + .EndTime to + $t.getEndTime() ); update( $t ); end Afaik, this will also enable Drools to only check this rule if one of the attributes used in the LHS is changed. So if you change any other field of your object at some point, this rule will not be evaluated again. Please note that I haven't checked the syntax but I think that it should work like this. Best regards Marcus ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] How to avoid circular rule activation for non circular problems?
I'd like to get some hints to improve the rules of my simple planning system. My simple planning system is derived from the HelloWorld Drools Project. The job of my planning system is to calculate startTime and endTime as function of duration and predecessors for each task. Each task has the fields long duration; SetTask predesessors; long startTime; long endTime; For each task the rule (endTime = startTime + duration) should hold. If a task has no predecessors, then its startTime should be 0. If a task has predecessors, then is should start at the latest endTime of all predecessors. These are my DRL-rules: rule Calc EndTime no-loop true when $t : Task() then $t.setEndTime( $t.getStartTime() + $t.getDuration() ); System.out.println( Drools: Set + $t.getName() + .EndTime to + $t.getEndTime() ); update( $t ); end rule Calc StartTime without predecessors lock-on-active true when $t : Task(predecessorCount == 0) then $t.setStartTime( 0 ); System.out.println( Drools: + $t.toString() + can start immediately ); update( $t ); end rule Calc StartTime with predecessors when $t : Task(predecessorCount 0, $predecessors : predecessors ) # Checking EndTime 0 for all predecessors means that all EndTimes are # initialy calculated. This is not what we realy want. Actually we'd like # to recalculate the successors EndTime, when ever it is needed. forall ( $succTask : Task( this == $t ) $predTask : Task( this memberOf $predecessors, endTime 0 ) ) $endTime : Number() from accumulate( $p : Task() from $predecessors, max($p.getEndTime()) ) then $t.setStartTime( $endTime.longValue() ); System.out.println( Drools: + $t.toString() + has new StartTime ); # If we did an update($t); here, we would get an infinite recursion. end My TestClass creates three tasks: task0, task1 and task2. Each task has an initial duration and (task0, task1) are predecessors of task2. It is important that this example has no circular dependencies; otherwise the rules, mentioned above, couldn't be applied. After fireAllRuels() the endTime of task2 is calculated wrong, so obviously the rule Calc EndTime should be activated. Is the rule-attribute (no-loop = true) not the right solution to avoid circularity here? Then the duration of task0 is updated outside of the rule engine. After a second fireAllRuels() the endTime of task0 is recalculated, but task2 is not recalculated at all. How can I tell the rule engine, that a task depends on its predecessors? I'd appreciate any input that could help me making this example work and if it works very efficient on a big number of tasks it's brilliant. If anybody is interested in my TestClass, to run this example with some logging, please tell me. Ralph Ammon ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] generic properties
Thanks, but I've still Problems if I try to use io: InputObject ( stringParameters[InputObject.Parameter.ParameterName] == something) =Field/method 'InputObject' not found for class 'com.rules.InputObject'Rule Compilation error Parameter is an enum witch contains all allowed Parameters of InputObject Kind Regards Thomas 2008/7/23 Edson Tirelli [EMAIL PROTECTED]: If you make your map available through a get, you can use simplified Map syntax like this: public Map getStringParameters() { return stringParameter; } io: InputObject ( stringParameters[propertyname] == something) []s Edson 2008/7/23 thomas kukofka [EMAIL PROTECTED]: Hello , I just recognized, that this doesn't work. But it is possible to use plain Java code in the rule, also if-conditions and for and while-loops etc.. However more Java code makes the rule less readable and elegant. Is there another possibility to use generic input objects? Thomas ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli JBoss Drools Core Development JBoss, a division of Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Is or allowed in a rule? Can I link the rules?
I'm a beginner user of Jboss, please bear with my maybe dumb questions: 1. Seems to me that the conditions in a rule are always connected with AND relation: such as the following rule if C1 C2 C3 then D1 it means if C1 and C2 and C3, then D1 Is or allowed? I mean , can I express: if (C1 or C2 or C3) and C4, then D1 in 1 rule? Right now, I can only use 3 rules to express it: if C1 C4 then D1 if C2 C4 then D1 if C3 C4 then D1 2. Can I form a link of rules? Can rule A's decision (the Then part) be rule B's condition (The When part)? for instance: rule A: if C1, C2, C3 then D1 rule B: if D1, C4 then D2 When the complexity increases, the number of rules explodes. I browsed the document and didn't find a clue. I'm using the 4.0.7. Your help is highly appreciated. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Is or allowed in a rule? Can I link the rules?
1. Seems to me that the conditions in a rule are always connected with AND relation: True. AND is the default. Is or allowed? I mean , can I express: if (C1 or C2 or C3) and C4, then D1 in 1 rule? You can have an explicit OR, see section 6.5.2.3 of the 4.0.7 documentation. Can I form a link of rules? Can rule A's decision (the Then part) be rule B's condition (The When part)? for instance: rule A: if C1, C2, C3 then D1 rule B: if D1, C4 then D2 usually the consequence (RHS) of would modify facts which you can test in rule B. A common way is to assert a fact. When the complexity increases, the number of rules explodes. What's your definition of explodes? This suggest that you should have another go at your rule/fact model. Cheers, --Ingomar Am 24.07.2008 um 17:25 schrieb Yu Wang: I'm a beginner user of Jboss, please bear with my maybe dumb questions: 1. Seems to me that the conditions in a rule are always connected with AND relation: such as the following rule if C1 C2 C3 then D1 it means if C1 and C2 and C3, then D1 Is or allowed? I mean , can I express: if (C1 or C2 or C3) and C4, then D1 in 1 rule? Right now, I can only use 3 rules to express it: if C1 C4 then D1 if C2 C4 then D1 if C3 C4 then D1 2. Can I form a link of rules? Can rule A's decision (the Then part) be rule B's condition (The When part)? for instance: rule A: if C1, C2, C3 then D1 rule B: if D1, C4 then D2 When the complexity increases, the number of rules explodes. I browsed the document and didn't find a clue. I'm using the 4.0.7. Your help is highly appreciated. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Is or allowed in a rule? Can I link the rules?
Thank you so much for the quick reply! Guess I need to study the documentation more thoroughly. When I say explode, I mean I have to use many rules to represents 1 business rule expressed in human language. I believe the problem can be solved if the two questions in my last email are solved. Thanks again, Ingomar. On 7/24/08, Ingomar Otter [EMAIL PROTECTED] wrote: 1. Seems to me that the conditions in a rule are always connected with AND relation: True. AND is the default. Is or allowed? I mean , can I express: if (C1 or C2 or C3) and C4, then D1 in 1 rule? You can have an explicit OR, see section 6.5.2.3 of the 4.0.7 documentation. Can I form a link of rules? Can rule A's decision (the Then part) be rule B's condition (The When part)? for instance: rule A: if C1, C2, C3 then D1 rule B: if D1, C4 then D2 usually the consequence (RHS) of would modify facts which you can test in rule B. A common way is to assert a fact. When the complexity increases, the number of rules explodes. What's your definition of explodes? This suggest that you should have another go at your rule/fact model. Cheers, --Ingomar Am 24.07.2008 um 17:25 schrieb Yu Wang: I'm a beginner user of Jboss, please bear with my maybe dumb questions: 1. Seems to me that the conditions in a rule are always connected with AND relation: such as the following rule if C1 C2 C3 then D1 it means if C1 and C2 and C3, then D1 Is or allowed? I mean , can I express: if (C1 or C2 or C3) and C4, then D1 in 1 rule? Right now, I can only use 3 rules to express it: if C1 C4 then D1 if C2 C4 then D1 if C3 C4 then D1 2. Can I form a link of rules? Can rule A's decision (the Then part) be rule B's condition (The When part)? for instance: rule A: if C1, C2, C3 then D1 rule B: if D1, C4 then D2 When the complexity increases, the number of rules explodes. I browsed the document and didn't find a clue. I'm using the 4.0.7. Your help is highly appreciated. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
AW: [rules-users] How to avoid circular rule activation for noncircular problems?
Thank you Marcus, with your constraint I got rid of the no-loop true and the endTime is recalculated when needed. So my first problem is really solved! So I tried a similar constraint for the rule Calc StartTime with redecessors rule Calc StartTime with predecessors when $t : Task(predecessorCount 0, $predecessors : predecessors ) forall ( $succTask : Task( this == $t ) $predTask : Task( this memberOf $predecessors, endTime 0 ) ) $endTime : Number() from accumulate( $p : Task() from $predecessors, max($p.getEndTime()) ) # new constraint Task(this == $t, eval($t.getStartTime() != $endTime.longValue())) then $t.setStartTime( $endTime.longValue() ); System.out.println( Drools: + $t.toString() + has new StartTime ); # new update update( $t ); end The improvement is that I can do an update in the RHS without infinite recursion. But the rule is still wrong, because it doesn't fire when the maximum of predecessors endTimes changes. Best regards Ralph ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users