<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
    <title></title>
  </head>
  <body text="#000000" bgcolor="#ffffff">
    there'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:
    <blockquote
      cite="mid:BANLkTikYvU=0OfY+x0f3tfVZ5thOLEv3Rg@mail.gmail.com"
      type="cite">
      <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=windows-1252">
        <p class="MsoNormal" style="margin: 0px 0px 0px 37.5pt;
          text-indent: 34.5pt;"><span style="font-family: 'Comic Sans
            MS'; color: rgb(153, 51, 255);">knowledgeBuilder.add(resource,
            ResourceType.DRL);</span></p>
        <div><span style="font-family: 'Comic Sans MS'; 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
              moz-do-not-send="true" 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 bgcolor="white"
background="?ui=2&amp;ik=968454d97d&amp;view=att&amp;th=12f9185d7a3272e4&amp;attid=0.0.1&amp;disp=emb&amp;zw"
              link="blue" vlink="purple" style="margin-left: 37.5pt;"
              lang="EN-US"><img moz-do-not-send="true"
src="?ui=2&amp;ik=968454d97d&amp;view=att&amp;th=12f9185d7a3272e4&amp;attid=0.0.1&amp;disp=emb&amp;zw"
                style="width: 0pt; min-height: 0pt;" height="0"
                width="0">
              <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:
                        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);">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:
                        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);">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 "status-Fixed-Open"</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 == "status",
                    oldValue == "Fixed");</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 == "mock-entity");</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("status")).equals("Open"));</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:
                        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);">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>
            <br>
            _______________________________________________<br>
            rules-users mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
            <a moz-do-not-send="true"
              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 moz-do-not-send="true"
          href="http://www.jboss.com">www.jboss.com</a><br>
      </div>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
With kind regards,
Geoffrey De Smet</pre>
  </body>
</html>