[rules-users] Memory issue with drools (using 10000 rules)
Edson Tirelli
ed.tirelli at gmail.com
Tue Apr 26 22:27:28 EDT 2011
Besides all suggestions already made in other e-mails, it is also worth
considering if you can pre-compile rules and just load them at runtime
instead of compiling them at runtime.
I.e, the method:
knowledgeBuilder.add(resource, ResourceType.DRL);
Will call the JDT compiler to compile your rules and that uses quite a
lot of memory that is later disposed. Instead, you could compile the
knowledge base at build time and serialize it, and at runtime all you do is
deserialize you kbase and use it, saving the memory that was previously used
for compilation.
Edson
2011/4/26 Shebs, Liron <liron.shebs at hp.com>
> Hello All,
>
>
>
> I’m working at HP Software R&D and we are considering using drools in our
> product.
>
> Benchmarking tests showed that running 10,000 rules consumes 382mb.
>
> This is too high for our system requirements, and we would like to know how
> we can improve it.
>
> Technical details:
>
> - Drools version: 5.1 with default configuration.
>
> - All rules look like this:
>
>
>
> rule "status-Fixed-Open"
>
> when
>
> event : FieldChangedEvent(fieldName ==
> "status", oldValue == "Fixed");
>
> entity : Entity(entityType == "mock-entity");
>
> eval(((String)
> entity.getFieldValue("status")).equals("Open"));
>
> then
>
> do Something…
>
> end
>
>
>
> - Loading code:
>
>
>
> KnowledgeBuilder knowledgeBuilder =
> KnowledgeBuilderFactory.newKnowledgeBuilder();
>
> for(all resources)
>
> {
>
> knowledgeBuilder.add(resource, ResourceType.DRL);
>
> }
>
> knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase();
>
>
> knowledgeBase.addKnowledgePackages(knowledgeBuilder.getKnowledgePackages());
>
>
>
> Any insights are most appreciated.
>
>
>
> Thank You,
>
> Liron, HP Software R&D
>
>
>
>
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
--
Edson Tirelli
JBoss Drools Core Development
JBoss by Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110426/568d0a5c/attachment.html
More information about the rules-users
mailing list