[rules-users] Executing Rules in Sequential Mode

Mark Proctor mproctor at codehaus.org
Wed Aug 15 13:12:59 EDT 2007


Also sequential is aimed for stateless services, it's rule building time 
is a slighter longer. So Once the RuleBase is built try running the test 
a few hundred times, once Sequential and once Rete. Also check memory, 
it should use less memory. Its hard to get any real perf numbers in 
3.44s. All tests need to run under load for preferably 2 minutes, this 
allows for several generations of GC to kick in, which is what normally 
hampers performance in a Rule System. If sequential uses less memory and 
makes less objects its real advantage will kick in once GC happens.

To help with normalisation I often don't do how long for X iterations, 
instead i say how many iterations in 2 minutes.

Mark
Mark Proctor wrote:
> If the rules and data don't push the system then you won't see a huge 
> amount. As the rules and data grow in size, but we are talking 50K 
> facts and thousands of rules to see a 350% increase. I'm surprised a 
> RuleBase with a 1000 rules only sees a 2% increase though, while not 
> large its still at the lower end of medium. If the data is small and 
> the rules well written then that could account for it.
>
> but the following, which you are doing, is correct:
>
> RuleBaseConfiguration conf  = new RuleBaseConfiguration();
> conf.setSequential(true);
> RuleBase  rb  = RuleBaseFactory.newRuleBase(conf);
> StatelessSession session = rb.newStatelessSession();
>
>
> Are you doing any function calls or reasoning that relies on outside 
> calculations? That could account for it, if the bottleneck is outside 
> of the engine reasoning, the advnatages gained will not be noticeable.
>
> Mark
>
>
> Jin, Ming wrote:
>> My rules engine test showed virtually no difference between Rete and
>> Sequential execution modes: 3.44s for Rete while 3.50s for Sequential.
>> Those are the average timing from several runs, each with 1,000 rule
>> execution calls.  Since I do not have a controlled environment, the
>> difference seems insignificant.  (The other rules engine I tested showed
>> huge improvement for the same rule set comparing Sequential with Rete).
>>
>>
>> The following code segments show how RuleBaseConfiguration is set and
>> the rule execution.  Traced into the code a little bit, and did see the
>> sequential flag set and the order() method was called.
>>
>> Please advise if this is the proper way to set sequential.  Otherwise, I
>> would just conclude that sequential mode has no effect for this
>> particular rule set under Drools. 
>> I would like to add that even without sequential, Drools performance was
>> fantastic.
>>
>> Thanks,
>> -Ming
>>
>>   /**
>>    * Creates a RuleBase instance with the given package object and the
>> sequential execution flag.
>>    * @param pkg
>>    * @param sequential true for sequential mode, false defaults to Rete
>>    * @return the created RuleBase with the given package and execution
>> mode.    * @throws Exception
>>    */
>>   private static RuleBase createRuleBase(Package pkg, boolean
>> sequential) throws Exception {
>>     RuleBaseConfiguration conf  = new RuleBaseConfiguration();
>>     conf.setSequential(sequential);
>>     RuleBase  rb  = RuleBaseFactory.newRuleBase(conf);
>>
>>     rb.addPackage(pkg);
>>     return rb;
>>   }
>>
>>       // code segments for rule execution
>>       StatelessSession  session = rulebase.newStatelessSession();
>>       StatelessSessionResult  result  =
>> session.executeWithResults(list);
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>   
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>




More information about the rules-users mailing list