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

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


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 listrules-users at lists.jboss.orghttps://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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110427/1b0319eb/attachment.html 


More information about the rules-users mailing list