2009/9/17 Mauricio Salatino <span dir="ltr">&lt;<a href="mailto:salaboy@gmail.com">salaboy@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

First of all you can try adding:<div class="im"><br> $ae1 :Event(symbol == 1, $Pr1 : price) and<br></div>

 $ce1 :Event(this != $ae1, symbol == 1, price &gt;  ($Pr1/1.2), this after $ae1 )<br><br>That will avoid the cross product.<br>Post again the result with that.</blockquote><div></div><div>Hi Mauricio,</div><div>Your advice helped a bit, but not very much (please see below). I also modified the test for Drools to show the event/sec throughput using Timer instead of fixed number of events per time. I think it&#39;s more helpful this way. </div>

<div></div><div>New run:</div><div>No. of events/second is: 7135.<br>No. of events/second is: 8358.<br>No. of events/second is: 8218.<br>No. of events in total is: 23715.<br>No. of total events/second is: 7905.333333333333<br>

Memory used:16872192<br><br></div><div>Old rule file:</div><div>No. of events/second is: 7441.<br>No. of events/second is: 8133.<br>No. of events/second is: 7688.<br>No. of events in total is: 23263.<br>No. of total events/second is: 7754.666666666667<br>

Memory used:16892760<br><br></div><div>Paul.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="gmail_quote">2009/9/17 PF <span dir="ltr">&lt;<a href="mailto:pif1979@gmail.com" target="_blank">pif1979@gmail.com</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><div class="h5"><div>Hi guys,<br></div><div>We made some experiments with Drools Fusion and we wonder if there is any way to speed it up. In our experiments, we detected complex events in streams of stock tickers and got times significantly slower with Drools than with other CEP systems (and also higher memory consumption in the same order of magnitude):</div>




<div>Number of events        Drools 5.0 Fusion        Esper 3.1.0        Etalis with SWI Prolog        Etalis with Yap Prolog<br>10000        1179        453        328        265 (time in miliseconds to process the stream of events)<br>20000        2359        828        701        531<br>30000        3538        1141        1023        780<br>




40000        4718        1500        1356        1078<br>50000        5897        1813        1702        1329<br><br></div><div>I can provide some of our code if someone needs it (beside what I pasted below). </div><div>Please tell me if you know any obvious optimizations? Or if you think this is due to Java (vs. C in other implementations), or any other reasons.</div>




<div>Thank you, regards,</div><div>Paul Fodor </div><div>Our program has 5 rules to detect complex events:</div><div>fusion.drl:</div><div>rule &quot;experiment A -Rule 0/0&quot;<br>when<br> $ae1 :Event(symbol == 1, $Pr1 : price) and<br>




 $ce1 :Event(this after $ae1 , symbol == 1, price &gt; ($Pr1/1.2) )<br>then<br> //System.out.println(&quot;Ce1 fired !&quot;);<br>end<br>rule &quot;experiment A -Rule 0/1&quot;<br>when<br> (<br> $ae2 :Event(symbol == 2,$Pr2 : price) and<br>




 $ce2 : Event(this after $ae2 , symbol == 2,price &gt; ($Pr2/1.2) )<br> ) <br>then <br> //System.out.println(&quot;Ce2 fired !&quot;);<br>end<br>rule &quot;experiment A -Rule1&quot;<br>when<br> (<br> $ae1 :Event(symbol == 1, $Pr1 : price) and<br>




 $ce1 :Event(this after $ae1 , symbol == 1, price &gt; ($Pr1/1.2) )<br> ) <br>         or <br> (<br> $ae2 :Event(symbol == 2,$Pr2 : price) and<br> $ce2 : Event(this after $ae2 , symbol == 2,price &gt; ($Pr2/1.2) )<br> ) <br>then<br>




 //System.out.println(&quot;Ce3 fired !&quot;);<br>end<br><br>rule &quot;experiment A -Rule4&quot;<br>when<br> (<br> $ae1 :Event(symbol == 1, $Pr1 : price) and<br> $ce1 :Event(this after $ae1 , symbol == 1, price &gt; ($Pr1/1.2) )<br>




 ) <br>         and<br> (<br> $ae2 :Event(symbol == 2,$Pr2 : price) and<br> $ce2 : Event(this after $ae2 , symbol == 2,price &gt; ($Pr2/1.2) , this after[0,20m] $ce1 )<br> )<br>then<br> //System.out.println(&quot;Ce4 fired !&quot;);<br>




end<br><br>rule &quot;experiment A -Rule5&quot;<br>when<br> (<br> $ae1 :Event(symbol == 1, $Pr1 : price) and <br> $ce1 :Event(this after $ae1 , symbol == 1, price &gt; ($Pr1/1.2))<br> ) <br>         and<br> (<br> $ae2 :Event(symbol == 2,$Pr2 : price)  and<br>




 $ce2 : Event(this after $ae2 , symbol == 2,price &gt; ($Pr2/1.2) , this overlaps $ce1)<br> )<br>then<br> //System.out.println(&quot;Ce5 fired !&quot;);<br>end <br><br></div><div>We have an Event class for events with its parameters and an EventStream class to fire the events:</div>




<div>EventStream.java:</div><div>...</div><div>import org.drools.runtime.StatefulKnowledgeSession;<br>public class EventStream {<br> public StatefulKnowledgeSession get_working_session() { return ksession;}<br></div><div>




...</div><div> void generateEventStream(double duration, double p)  { <br>         ...<br>         //Drools <br>         Event temp = new Event(symbol,currValue);<br>         ksession.insert(temp); <br>         ...<br> }<br>}<br><br></div>
<br></div></div>_______________________________________________<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><br>
<br></blockquote></div><font color="#888888"><br><br clear="all"><br>-- <br> - <a href="http://salaboy.wordpress.com" target="_blank">http://salaboy.wordpress.com</a><br> - <a href="http://www.jbug.com.ar" target="_blank">http://www.jbug.com.ar</a><br>

 - Salatino &quot;Salaboy&quot; Mauricio -<br>

</font><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><br>