[rules-users] Rule compilation errors under heavy load

Dean Jones dean.m.jones at gmail.com
Thu Jul 12 07:48:40 EDT 2007


Hello folks,

I'm experiencing some odd behaviour from Drools (or maybe the Eclipse
compiler) when load-testing my application, and wondered if anyone
else had experienced the same issue. I have a web service which, for
every request, loads in rules from the database, creates a
org.drools.lang.descr.PackageDescr and then uses this to create a
org.drools.rule.Package. The code is something like:

PackageBuilderConfiguration conf = new PackageBuilderConfiguration();
PackageBuilder builder = new PackageBuilder(conf);
PackageDescr packageDescr = new PackageDescr("MyRulebaseName");
populatePackageDescr(packageDescr);
builder.addPackage(packageDescr);
Package _package = builder.getPackage();
return _package;

This code gets run every request. The populatePackageDescr() method
adds imports, globals, functions and rules to the PackageDescr. My
load-test just repeatedly calls the same rulebase, so
populatePackageDescr() will be doing exactly the same thing for each
request. Occasionally (normally once or twice per 100 requests) I get
a rule compilation error (the exact error varies from request to
request) whereas most of the time the same rule compiles fine. This
makes me suspect a thread-safety issue in either the PackageBuilder or
the compiler (I'm using the eclipse compiler).

Initially, I suspected a problem in my
populatePackageDescr(packageDescr) method, but I think I've ruled this
out. There is nothing stateful in this method, and I've tried dumping
the XML representation of the packageDescr immediately after
populating it; it looks fine to me and is exactly the same whether
compilation succeeds or and fails.

Has anyone done this kind of thing successfully under a heavy load?

Thanks,

Dean.



More information about the rules-users mailing list