Hi.
My environment: Win XP SP3, 2x2.13 GHz cpu, 3GB RAM, Drools 4.0.7, JDK
1.4.2_11, java compiler: JANINO, dialect: java.
We have about 850 drl's with 5 - 10 conditions in each. 0 -2 evals in each.
The drl's only contain one rule each.
We are using Drools programatically by compiling the drls using
PackageBuilder.addPackageFromDrl and adding them to a RuleBase using
RuleBase.addPackage(PackageBuilder.getPackage())
When we are building our rule base we are never able to compile more than 1
-2 rules per second, which means we need over 10 minutes (at 100% cpu) to
build our rulebase.
Profiling shows 68% cpu time in
org.drools.rule.builder.GroupElementBuilder.build and 18% cpu time in
org.codehaus.janino.Compiler.compile.
We have experimented by changing the compiler to ECLIPSE and the dialect to
mvel but the results are the same.
We have experimented using one PackageBuilder instance per drl or grouping
drls by package and sharing a builder per package. Same result in both
scenarios.
We have also expermimented with compiling concurrently in serveral threads.
Again, about the same result.
My question is: Is this the performance we can expect from the compiler or
are we doing something fundamentally wrong?
Below is an example of one of our drls. This one contains no evals, but
still takes more than 1 second to compile. If anyone can spot some issues
with the way we are doing things the feedback would be much apreciated :)
------------------------------------
package domain.core.productoffer.rules.subscriptiontype
import type.productoffer.ProductOfferRuleEvent
import domain.core.subscription.Subscription
import domain.core.subscription.SubscribedService
import type.subscription.ActionTypeEnum
import domain.core.productoffer.ProductOffer
import domain.rules.RuleEvent
global domain.core.productoffer.RuleValidationReport validationResult
rule "RequiredVProducts"
when
ProductOfferRuleEvent(id == '3')
ProductOffer(id.value == 31963)
$subscription:Subscription()
not ( SubscribedService(status != ActionTypeEnum.REMOVE_CANCEL &&
productId.value in (57, 69) ) from
$subscription.getAllChildSubscribedServices())
then
validationResult.addValidationMessage("2069", "For product offer
rule event with id '3' and product offer with id=31963 subscription must
have one of the following VProducts: 57, 69.");
end
------------------------------------
Regards
Christian Nedregård