What and how are you timing?<br><br>Executing exactly this rule on three event types with just an int id, running with<br> <br>      long t0 = System.currentTimeMillis();<br>      int count = 50;<br>      for( int i = 1; i &lt; count; i++ ){<br>
          session.insert( new EventA( i ) );<br>          session.insert( new EventB( i ) );<br>          session.insert( new EventC( i ) );<br>      }     <br>      session.fireAllRules();<br>      long t1 = System.currentTimeMillis();<br>
      System.out.println( &quot;execution of &quot; + count + &quot; triples: &quot; + (double)(t1-t0)/1000.0 );<br><br>I get on a (not-too-hot) laptop (Linux, Eclipse)<br><br>       execution of 10 triples: 0.020<br>       execution of 20 triples: 0.023<br>
       execution of 30 triples: 0.026<br>       execution of 40 triples: 0.026<br><br>which is what I&#39;d expect.<br> - With a String id, add about 0.005s<br> - With fireAllRules in the loop, add another 0.015s<br><br>With fireUntilHalt issued from another thread, timing is trickier, so please explain this in detail.<br>
<br>-W<br><br><br><br><div class="gmail_quote">2010/11/15 Roess. Oliver <span dir="ltr">&lt;<a href="mailto:o.roess@seeburger.de">o.roess@seeburger.de</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">









<div link="blue" vlink="purple" lang="DE"><font size="1" color="#808080" face="Arial"></font><br>

<div>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">Hello everyone.</span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB">I’ve got a question regarding the performance
of Drools in STREAM mode. It seems to me, that either Drools is not very fast
here, or the problem is with the rule itself.</span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB"> </span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB">This is the rule.</span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB"> </span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB">rule &quot;ABC”</span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB">            no-loop</span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB">            when</span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB">                        $a
: Aevent()</span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB">                        $b
: Bevent(id == $<a href="http://a.id" target="_blank">a.id</a>)</span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB">                        $c
: Cevent(id == $<a href="http://a.id" target="_blank">a.id</a>)</span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB">            then</span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB">                        retract($c);</span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB">                        retract($a);</span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB">                        retract($b);</span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB">                        …(actions)</span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB">end</span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB"> </span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB">It basically says: act upon every group of A, B and C
events with the same ids. The retract statements will make sure, none of these
events will get matched again by this rule. Side question: is there any
possibility to do this rule without the retractions?</span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB"> </span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB">Regarding the performance:</span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB">If I put the arriving events in this sequence: A(x),
B(x), C(x) where x is the number of events being sent. No other events than A,
B and C with the same id being sent. And I repeat this sequence a small number
of runs (12 times in a row), then it will take Drools:</span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB"> </span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB">For x=8, on average 3 seconds to detect all 96
patterns,</span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB">for x=16, on average 30 seconds to detect all 192
patterns. </span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB"> </span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB">But the average is not very meaningful. Sometimes the
Engine does it in (x=16) 10 seconds, and sometimes it takes him over a minute
to detect everything, sometimes it takes him nearly forever for no reason. We
tested this on different machines and we cannot predict a “stable”
behaviour. We figured out, that this instability might come from fireUntilHalt,
which we invoke from a separate thread. Some ABC groups get detected faster
than others and the total duration is totally variable as stated before.</span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB">When calling fireAllRules upon every insert, the
total duration is stable (4,5 sec for x=16 and 12 runs) and also the detection
time for every ABC group seems to be even. </span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB"> </span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB">So a few questions: whats the problem with
fireUntilHalt? Are we using it the wrong way? If fireAllRules is used after every
insert, can rules be triggered by actions of other rules? For event stream
processing a solution that fires almost always is desirable.</span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB"> </span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB">Why is the overall performance so poor? If I do x=32
and do just one run, which means just a total of 32*3= 96 events being sent and
it takes him 2,6 seconds to detect all 32 patterns. That’s not very fast,
is it?</span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB"> </span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB">I’m using Drools 5.1.1 and the latest JDK.</span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB">It would be nice to get some opinions.</span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB"> </span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB">Best regards,</span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB">Oliver </span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB"> </span></font></p>

</div>

<br><table style="border-collapse: collapse;" width="100%" border="0">
<tbody><tr>
                <td style="border-bottom-style: double; border-bottom-width: 3px;" width="272"> </td>
                <td style="border-bottom-style: double; border-bottom-width: 3px;" width="45"> </td>
                <td style="border-bottom-style: double; border-bottom-width: 3px;"> </td>
</tr></tbody></table>

<br><br>

<table style="border-collapse: collapse;" width="100%" border="0">
        <tbody><tr>
                <td width="272"><font size="1" color="#808080" face="Arial"><b>SEEBURGER AG</b></font></td>

                <td width="45"> </td>
                <td><font size="1" color="#808080" face="Arial">Vorstand/Seeburger Executive Board:</font></td>
        </tr>
        <tr>
                <td width="272"><font size="1" color="#808080" face="Arial">Sitz der Gesellschaft/Registered Office:</font></td>
                <td width="45"> </td>
                <td><font size="1" color="#808080" face="Arial">Bernd Seeburger, Axel Haas, Michael Kleeberg</font></td>
        </tr>
        <tr>
                <td width="272"><font size="1" color="#808080" face="Arial">Edisonstr. 1</font></td>
                <td width="45"> </td>
                <td><font size="1" color="#808080" face="Arial"></font></td>
        </tr>
        <tr>
                <td width="272"><font size="1" color="#808080" face="Arial">D-75015 Bretten</font></td>
                <td width="45"><font size="1" color="#808080" face="Arial"></font></td>
                <td><font size="1" color="#808080" face="Arial">Vorsitzender des Aufsichtsrats/Chairperson of the Seeburger Supervisory Board:</font></td>
        </tr>
        <tr>
                <td width="272"><font size="1" color="#808080" face="Arial">Tel.: 07252 / 96 - 0</font></td>
                <td width="45"><font size="1" color="#808080" face="Arial"></font></td>
                <td><font size="1" color="#808080" face="Arial">Dr. Franz Scherer</font></td>
        </tr>
        <tr>
                <td width="272"><font size="1" color="#808080" face="Arial">Fax: 07252 / 96 - 2222</font></td>
                <td width="45"><font size="1" color="#808080" face="Arial"></font></td>
                <td><font size="1" color="#808080" face="Arial"></font></td>
        </tr>
        <tr>
                <td width="272"><font size="1" color="#808080" face="Arial">Internet: <a href="http://www.seeburger.de" target="_blank">http://www.seeburger.de</a></font></td>
                <td width="45"><font size="1" color="#808080" face="Arial"></font></td>
                <td><font size="1" color="#808080" face="Arial">Registergericht/Commercial Register:</font></td>
        </tr>
        <tr>
                <td width="272"><font size="1" color="#808080" face="Arial">e-mail: <a href="mailto:info@seeburger.de" target="_blank">info@seeburger.de</a></font></td>
                <td width="45"><font size="1" color="#808080" face="Arial"></font></td>
                <td><font size="1" color="#808080" face="Arial">HRB 240708 Mannheim</font></td>
        </tr>
        
        
</tbody></table>

<p><font size="2" face="Arial"><br></font></p>
<p align="justify"><font size="1" color="#808080" face="Arial">Dieses E-Mail ist
nur für den Empfänger bestimmt, an den es gerichtet ist und kann vertrauliches
bzw. unter das Berufsgeheimnis fallendes Material enthalten. Jegliche darin
enthaltene Ansicht oder Meinungsäußerung ist die des Autors und stellt nicht
notwendigerweise die Ansicht oder Meinung der  dar. Sind Sie nicht der Empfänger, so haben Sie diese E-Mail irrtümlich erhalten und jegliche Verwendung, Veröffentlichung, Weiterleitung, Abschrift oder jeglicher Druck dieser E-Mail ist strengstens untersagt. Weder die  noch der Absender (Oliver Roess) übernehmen die Haftung für Viren; es obliegt Ihrer Verantwortung, die E-Mail und deren 
Anhänge (0) auf Viren zu prüfen.
<br><br>
<p align="justify"><font size="1" color="#808080" face="Arial">The present email addresses only the addressee which it targets and may contain confidential material that may be protected by the professional secret. The opinions reflected herein are not necessarily the one of the . If you are not the addressee, you have accidentally got this email and are not enabled to use, publish, forward, copy or print it in any way. Neither the , nor the sender (Oliver Roess) are liable for viruses, being your own responsibility to check this email and its attachments (0) for this purpose. 
<br><br><br></font></p></font></p></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>