[rules-users] Rule compilation errors under heavy load

Edson Tirelli tirelli at post.com
Thu Jul 12 10:09:23 EDT 2007


   Is it possible for you to provide a test case capable of reproducing the
problem?

   At the same time, I would suggest you to not follow such approach in your
application. Compilation is an extremely heavy process and should not be
done for each request. The ideal approach is to pre-compile (for instance,
we have a contributed ant-task for that) and serialize your rulebase to your
database or filesystem, or at least, compile it only once and cache it at
runtime.

   []s
   Edson

2007/7/12, Dean Jones <dean.m.jones at gmail.com>:
>
> 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.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070712/da2d5ada/attachment.html 


More information about the rules-users mailing list