[rules-users] Executing Rules in Sequential Mode
Mark Proctor
mproctor at codehaus.org
Wed Aug 15 12:25:34 EDT 2007
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
>
>
More information about the rules-users
mailing list