<div><br></div>   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.<div><br></div><div>   I.e, the method:</div>
<div><br></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 37.5pt; text-indent: 34.5pt; "><span style="font-family: &#39;Comic Sans MS&#39;; color: rgb(153, 51, 255); ">knowledgeBuilder.add(resource, ResourceType.DRL);</span></p>
<div><span style="font-family: &#39;Comic Sans MS&#39;; color: rgb(153, 51, 255); "><br></span></div>   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.</div>
<div><br></div><div>   Edson</div><div><br></div><div><br></div><div><br><div class="gmail_quote">2011/4/26 Shebs, Liron <span dir="ltr">&lt;<a href="mailto:liron.shebs@hp.com">liron.shebs@hp.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div bgcolor="white" background="?ui=2&amp;ik=968454d97d&amp;view=att&amp;th=12f9185d7a3272e4&amp;attid=0.0.1&amp;disp=emb&amp;zw" lang="EN-US" link="blue" vlink="purple" style="margin-left:37.5pt"><img src="?ui=2&amp;ik=968454d97d&amp;view=att&amp;th=12f9185d7a3272e4&amp;attid=0.0.1&amp;disp=emb&amp;zw" width="0" height="0" style="width:0;min-height:0"><div>
<p class="MsoNormal"><span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF">Hello All,</span></p><p class="MsoNormal"><span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF"> </span></p><p class="MsoNormal">
<span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF">I’m working at HP Software R&amp;D and we are considering using drools in our product.</span></p><p class="MsoNormal"><span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF">Benchmarking tests showed that running 10,000 rules consumes 382mb. </span></p>
<p class="MsoNormal"><span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF">This is too high for our system requirements, and we would like to know how we can improve it.</span></p><p class="MsoNormal"><span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF">Technical details:</span></p>
<p><span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF"><span>-<span style="font:7.0pt &quot;Times New Roman&quot;">      </span></span></span><span dir="LTR"></span><span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF">Drools version: 5.1 with default configuration. </span></p>
<p><span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF"><span>-<span style="font:7.0pt &quot;Times New Roman&quot;">      </span></span></span><span dir="LTR"></span><span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF">All rules look like this:</span></p>
<p class="MsoNormal"><span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF"> </span></p><p class="MsoNormal"><span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF">rule &quot;status-Fixed-Open&quot;</span></p>
<p class="MsoNormal" style="margin-left:37.5pt"><span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF">               when</span></p><p class="MsoNormal" style="margin-left:37.5pt"><span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF">                             event : FieldChangedEvent(fieldName == &quot;status&quot;, oldValue == &quot;Fixed&quot;);</span></p>
<p class="MsoNormal" style="margin-left:37.5pt"><span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF">                             entity : Entity(entityType == &quot;mock-entity&quot;);</span></p><p class="MsoNormal" style="margin-left:37.5pt">
<span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF">                             eval(((String) entity.getFieldValue(&quot;status&quot;)).equals(&quot;Open&quot;));</span></p><p class="MsoNormal" style="margin-left:37.5pt">
<span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF">               then                          </span></p><p class="MsoNormal" style="margin-left:75.0pt"><span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF">                  do Something…</span></p>
<p class="MsoNormal"><span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF">end </span></p><p class="MsoNormal"><span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF"> </span></p><p><span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF"><span>-<span style="font:7.0pt &quot;Times New Roman&quot;">      </span></span></span><span dir="LTR"></span><span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF">Loading code:</span></p>
<p class="MsoNormal"><span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF"> </span></p><p class="MsoNormal"><span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF">KnowledgeBuilder knowledgeBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();</span></p>
<p class="MsoNormal"><span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF">for(all resources)</span></p><p class="MsoNormal"><span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF">{</span></p><p class="MsoNormal" style="margin-left:37.5pt;text-indent:34.5pt">
<span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF">knowledgeBuilder.add(resource, ResourceType.DRL);</span></p><p class="MsoNormal"><span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF">}</span></p>
<p class="MsoNormal"><span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF">knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase();</span></p><p class="MsoNormal"><span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF">knowledgeBase.addKnowledgePackages(knowledgeBuilder.getKnowledgePackages());</span></p>
<p class="MsoNormal"><span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF"> </span></p><p class="MsoNormal"><span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF">Any insights are most appreciated.</span></p>
<p class="MsoNormal"><span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF"> </span></p><p class="MsoNormal"><span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF">Thank You,</span></p><p class="MsoNormal">
<span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF">Liron, HP Software R&amp;D</span></p><p class="MsoNormal"><span style="font-family:&quot;Comic Sans MS&quot;;color:#9933FF"> </span></p><div><p class="MsoNormal">
<span style="font-size:11.0pt;color:#9933FF"> </span></p></div><p class="MsoNormal"> </p></div></div><br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss by Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>
</div>