Hi Liron,<br><br>Are you planning on using a stateful or a stateless session afterwards? Do you have the memory numbers for rules execution? How many facts?<br><br>-Leonardo.<br><br><div class="gmail_quote">2011/4/27 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: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div link="blue" vlink="purple" lang="EN-US"><div><p class="MsoNormal"><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);">Hi All,</span></p>
<p class="MsoNormal"><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);"> </span></p><p class="MsoNormal"><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);">Thank you all for your responses and ideas.</span></p>
<p class="MsoNormal"><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);"> </span></p><p class="MsoNormal"><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);">Here are some answers to questions raised by you</span></p>
<p><span style="font-family: Symbol; color: rgb(153, 51, 255);"><span>·<span style="font: 7pt &quot;Times New Roman&quot;;">         </span></span></span><span dir="LTR"></span><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);">10,000 rules is what we estimate a real system will contain.</span></p>
<p><span style="font-family: Symbol; color: rgb(153, 51, 255);"><span>·<span style="font: 7pt &quot;Times New Roman&quot;;">         </span></span></span><span dir="LTR"></span><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);">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.</span></p>
<p><span style="font-family: Symbol; color: rgb(153, 51, 255);"><span>·<span style="font: 7pt &quot;Times New Roman&quot;;">         </span></span></span><span dir="LTR"></span><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);">Measurements of memory consumption where done after the rules loading was completed + GC, so I’m sure pre-compiling will help.</span></p>
<p><span style="font-family: Symbol; color: rgb(153, 51, 255);"><span>·<span style="font: 7pt &quot;Times New Roman&quot;;">         </span></span></span><span dir="LTR"></span><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);">When I say memory consumption I mean memory footprint (production memory).</span></p>
<p><span style="font-family: Symbol; color: rgb(153, 51, 255);"><span>·<span style="font: 7pt &quot;Times New Roman&quot;;">         </span></span></span><span dir="LTR"></span><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);">Removing “eval” from the rules saved ~80mb (10,000 rules, same environment).</span></p>
<p class="MsoNormal"><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);"> </span></p><p class="MsoNormal"><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);">Mark, reading all these clarifications, does 30kb per rule sound reasonable? Do you think that we can improve this number somehow?</span></p>
<p class="MsoNormal"><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);"> </span></p><p class="MsoNormal"><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);">Thank you,</span><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);"></span></p>
<p class="MsoNormal"><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 102, 255);">-- Liron</span></p><p class="MsoNormal"><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);"> </span></p>
<p class="MsoNormal"><b><span style="font-size: 10pt;">From:</span></b><span style="font-size: 10pt;"> <a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a> [mailto:<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>] <b>On Behalf Of </b>Leonardo Gomes<br>
<b>Sent:</b> Wednesday, April 27, 2011 12:10 PM<br><b>To:</b> Rules Users List<br><b>Subject:</b> Re: [rules-users] Memory issue with drools (using 10000 rules)</span></p><div><div></div><div class="h5"><p class="MsoNormal">
 </p><p class="MsoNormal" style="margin-bottom: 12pt;"><a href="http://drools.46999.n3.nabble.com/maven-drools-plugin-to-compile-DRL-s-at-build-time-td725751.html" target="_blank">http://drools.46999.n3.nabble.com/maven-drools-plugin-to-compile-DRL-s-at-build-time-td725751.html</a></p>
<div><p class="MsoNormal">2011/4/27 Geoffrey De Smet &lt;<a href="mailto:ge0ffrey.spam@gmail.com" target="_blank">ge0ffrey.spam@gmail.com</a>&gt;</p><div><p class="MsoNormal">there&#39;s a maven-drools-plugin out there in the wild to precompile your rules.<br>
<br>Op 27-04-11 04:27, Edson Tirelli schreef: </p><div><div><blockquote style="margin-top: 5pt; margin-bottom: 5pt;"><div><p class="MsoNormal"> </p></div><p class="MsoNormal">   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. </p>
<div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">   I.e, the method:</p></div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal" style="margin-left: 37.5pt; text-indent: 34.5pt;"><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);">knowledgeBuilder.add(resource, ResourceType.DRL);</span></p>
<div><p class="MsoNormal"> </p></div><p class="MsoNormal">   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.</p>
</div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">   Edson</p></div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal"> </p><div><p class="MsoNormal">2011/4/26 Shebs, Liron &lt;<a href="mailto:liron.shebs@hp.com" target="_blank">liron.shebs@hp.com</a>&gt;</p>
<div style="margin-left: 37.5pt;"><p class="MsoNormal"></p><div><p class="MsoNormal"><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);">Hello All,</span></p><p class="MsoNormal"><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);"> </span></p>
<p class="MsoNormal"><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);">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: rgb(153, 51, 255);">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: rgb(153, 51, 255);">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: rgb(153, 51, 255);">Technical details:</span></p><p><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);">-</span><span style="font-size: 7pt; color: rgb(153, 51, 255);">      </span><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);">Drools version: 5.1 with default configuration. </span></p>
<p><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);">-</span><span style="font-size: 7pt; color: rgb(153, 51, 255);">      </span><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);">All rules look like this:</span></p>
<p class="MsoNormal"><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);"> </span></p><p class="MsoNormal"><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);">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: rgb(153, 51, 255);">               when</span></p><p class="MsoNormal" style="margin-left: 37.5pt;"><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);">                             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: rgb(153, 51, 255);">                             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: rgb(153, 51, 255);">                             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: rgb(153, 51, 255);">               then                          </span></p><p class="MsoNormal" style="margin-left: 75pt;">
<span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);">                  do Something…</span></p><p class="MsoNormal"><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);">end </span></p>
<p class="MsoNormal"><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);"> </span></p><p><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);">-</span><span style="font-size: 7pt; color: rgb(153, 51, 255);">      </span><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);">Loading code:</span></p>
<p class="MsoNormal"><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);"> </span></p><p class="MsoNormal"><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);">KnowledgeBuilder knowledgeBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();</span></p>
<p class="MsoNormal"><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);">for(all resources)</span></p><p class="MsoNormal"><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);">{</span></p>
<p class="MsoNormal" style="margin-left: 37.5pt; text-indent: 34.5pt;"><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);">knowledgeBuilder.add(resource, ResourceType.DRL);</span></p><p class="MsoNormal">
<span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);">}</span></p><p class="MsoNormal"><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);">knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase();</span></p>
<p class="MsoNormal"><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);">knowledgeBase.addKnowledgePackages(knowledgeBuilder.getKnowledgePackages());</span></p><p class="MsoNormal"><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);"> </span></p>
<p class="MsoNormal"><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);">Any insights are most appreciated.</span></p><p class="MsoNormal"><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);"> </span></p>
<p class="MsoNormal"><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);">Thank You,</span></p><p class="MsoNormal"><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);">Liron, HP Software R&amp;D</span></p>
<p class="MsoNormal"><span style="font-family: &quot;Comic Sans MS&quot;; color: rgb(153, 51, 255);"> </span></p><div><p class="MsoNormal"><span style="font-size: 11pt; color: rgb(153, 51, 255);"> </span></p></div><p class="MsoNormal">
 </p></div></div><p class="MsoNormal" style="margin-bottom: 12pt;"><br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org" target="_blank">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></p></div><p class="MsoNormal"><br><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>
  JBoss by Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a></p></div><pre> </pre><pre>_______________________________________________</pre><pre>rules-users mailing list</pre><pre><a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a></pre>
<pre><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a></pre></blockquote><p class="MsoNormal"> </p></div></div><pre>-- </pre><pre>With kind regards,</pre>
<pre>Geoffrey De Smet</pre></div><p class="MsoNormal" style="margin-bottom: 12pt;"><br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org" target="_blank">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></p></div><p class="MsoNormal"> </p></div></div></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>