I&#39;m also seeing that you are not using fusion, because you are not using entry-points.<br>You are only creating POJOs and inserting them as facts in a loop.<br>did you check the fusion example project?<br><br><a href="http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-examples/drools-examples-fusion/">http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-examples/drools-examples-fusion/</a><br>
<br>you also should check the docs, specially:<br><a href="http://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-fusion/html_single/index.html#d0e232">http://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-fusion/html_single/index.html#d0e232</a><br>
<br>Greetings<br><br><div class="gmail_quote">On Thu, Sep 17, 2009 at 2:52 PM, Mauricio Salatino <span dir="ltr">&lt;<a href="mailto:salaboy@gmail.com">salaboy@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
heh that&#39;s my first approach...<br>The memory usage is normal I think, because you are creating a lot of objects and they are kept in memory.<br>Can you share the project that you are using with us? so I can t</blockquote>
<div> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">est the performance in my machine?<br>
your machine details will be also necessary.<br>Thanks!<div><div></div><div class="h5"><br><br><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;">
2009/9/17 Mauricio Salatino <span dir="ltr">&lt;<a href="mailto:salaboy@gmail.com" target="_blank">salaboy@gmail.com</a>&gt;</span><div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">



First of all you can try adding:<div><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><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></div><div><div> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; 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><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" 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><br>
</div></div><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><br>
<br></blockquote></div><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>

</div></div></blockquote></div><br><br clear="all"><br>-- <br> - <a href="http://salaboy.wordpress.com">http://salaboy.wordpress.com</a><br> - <a href="http://www.jbug.com.ar">http://www.jbug.com.ar</a><br> - Salatino &quot;Salaboy&quot; Mauricio -<br>