I am currently trying to scale our implementation by farming
out request into mutliple threads. I am on a 4 CPU Mac.
1. Although I see an increase in CPU load when going from
single to multi-threaded processing the throughput increased
marginally. I am pretty sure that my measurements are correct. I have
checked the GC and this is not the source of congestion. My question
here is whether Drools is using lot's of synchronization that may
explain this.
2. When I share the RuleBase accross threads (which I think is
valid?) I get interesting errors during execution. eg:
org.drools.RuntimeDroolsException
: Exception executing predicate
org.drools.base.mvel.MVELPredicateExpression@bb981e
atorg.drools.rule.PredicateConstraint.isAllowedCachedRight(
PredicateConstraint.java:246)
at
org.drools.common.TripleBetaConstraints.isAllowedCachedRight(TripleBetaConstraints.java:200)
atorg.drools.reteoo.JoinNode.assertObject(JoinNode.java:150)
atorg.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:318)
atorg.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:153)
at
org.drools.reteoo.Rete.assertObject(Rete.java:175)
atorg.drools.reteoo.ReteooRuleBase.assertObject
(ReteooRuleBase.java:192)
at
org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:909)
atorg.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:881)
atorg.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:682)
atxxxx.DroolsPD.validate(DroolsPD.java:66)
at xxxx.DroolsMTRunner.run(DroolsMTRunner.java:30)
at java.lang.Thread.run(Thread.java:552)
Caused by: org.mvel.CompileException:
cannot invoke getter: getSAClass [declr.class: xxx.AbstractSA;
act.class: null]
atorg.mvel.optimizers.impl.refl.GetterAccessor.getValue(
GetterAccessor.java:52)
at
org.mvel.optimizers.impl.refl.VariableAccessor.getValue(VariableAccessor.java:39)
at
org.mvel.ast.VariableDeepPropertyNode.getReducedValueAccelerated(VariableDeepPropertyNode.java:22)
atorg.mvel.ast.PropertyASTNode.getReducedValueAccelerated(PropertyASTNode.java:21)
at
org.mvel.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:21)
at org.mvel.MVELRuntime.execute(MVELRuntime.java:88)
at
org.mvel.CompiledExpression.getValue(CompiledExpression.java:111)
atorg.mvel.MVEL.executeExpression(MVEL.java:235)
at
org.drools.base.mvel.MVELPredicateExpression.evaluate(MVELPredicateExpression.java:36)
atorg.drools.rule.PredicateConstraint.isAllowedCachedRight(PredicateConstraint.java:240)
... 13 more
Caused by: java.lang.NullPointerException
atsun.reflect.GeneratedMethodAccessor6.invoke
(Unknown Source)
atsun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
atjava.lang.reflect.Method.invoke(
Method.java:324)
at
org.mvel.optimizers.impl.refl.GetterAccessor.getValue(GetterAccessor.java:42)
... 22 more
* No data is shared between threads (with the exception of
the RuleBase, as outline above)
I would be grateful for any pointers for 'correct' use of
Drools in an MT environment.