[rules-users] Memory issue with drools (using 10000 rules)

Leonardo Gomes leonardo.f.gomes at gmail.com
Wed Apr 27 09:23:02 EDT 2011


Hi Liron,

Are you planning on using a stateful or a stateless session afterwards? Do
you have the memory numbers for rules execution? How many facts?

-Leonardo.

2011/4/27 Shebs, Liron <liron.shebs at hp.com>

> Hi All,
>
>
>
> Thank you all for your responses and ideas.
>
>
>
> Here are some answers to questions raised by you
>
> ·         10,000 rules is what we estimate a real system will contain.
>
> ·         The rules are similar to each other on the testing environment,
> but in the real system we expect more variance, making parameterized rules
> difficult to implement.
>
> ·         Measurements of memory consumption where done after the rules
> loading was completed + GC, so I’m sure pre-compiling will help.
>
> ·         When I say memory consumption I mean memory footprint
> (production memory).
>
> ·         Removing “eval” from the rules saved ~80mb (10,000 rules, same
> environment).
>
>
>
> Mark, reading all these clarifications, does 30kb per rule sound
> reasonable? Do you think that we can improve this number somehow?
>
>
>
> Thank you,
>
> -- Liron
>
>
>
> *From:* rules-users-bounces at lists.jboss.org [mailto:
> rules-users-bounces at lists.jboss.org] *On Behalf Of *Leonardo Gomes
> *Sent:* Wednesday, April 27, 2011 12:10 PM
> *To:* Rules Users List
> *Subject:* Re: [rules-users] Memory issue with drools (using 10000 rules)
>
>
>
>
> http://drools.46999.n3.nabble.com/maven-drools-plugin-to-compile-DRL-s-at-build-time-td725751.html
>
> 2011/4/27 Geoffrey De Smet <ge0ffrey.spam at gmail.com>
>
> there's a maven-drools-plugin out there in the wild to precompile your
> rules.
>
> Op 27-04-11 04:27, Edson Tirelli schreef:
>
>
>
>    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
>
>
>
> _______________________________________________
>
> rules-users mailing list
>
> rules-users at lists.jboss.org
>
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
> --
>
> With kind regards,
>
> Geoffrey De Smet
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110427/bc79ab4e/attachment.html 


More information about the rules-users mailing list