[rules-users] Drools Fusion speedup

Mauricio Salatino salaboy at gmail.com
Fri Sep 18 07:57:32 EDT 2009


I'm also seeing that you are not using fusion, because you are not using
entry-points.
You are only creating POJOs and inserting them as facts in a loop.
did you check the fusion example project?

http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-examples/drools-examples-fusion/

you also should check the docs, specially:
http://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-fusion/html_single/index.html#d0e232

Greetings

On Thu, Sep 17, 2009 at 2:52 PM, Mauricio Salatino <salaboy at gmail.com>wrote:

> heh that's my first approach...
> The memory usage is normal I think, because you are creating a lot of
> objects and they are kept in memory.
> Can you share the project that you are using with us? so I can t



> est the performance in my machine?
> your machine details will be also necessary.
> Thanks!
>
>
> 2009/9/17 PF <pif1979 at gmail.com>
>
>> 2009/9/17 Mauricio Salatino <salaboy at gmail.com>
>>
>>> First of all you can try adding:
>>>  $ae1 :Event(symbol == 1, $Pr1 : price) and
>>>  $ce1 :Event(this != $ae1, symbol == 1, price > ($Pr1/1.2), this after
>>> $ae1 )
>>>
>>> That will avoid the cross product.
>>> Post again the result with that.
>>
>> Hi Mauricio,
>> 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's more helpful this
>> way.
>> New run:
>> No. of events/second is: 7135.
>> No. of events/second is: 8358.
>> No. of events/second is: 8218.
>> No. of events in total is: 23715.
>> No. of total events/second is: 7905.333333333333
>> Memory used:16872192
>>
>> Old rule file:
>> No. of events/second is: 7441.
>> No. of events/second is: 8133.
>> No. of events/second is: 7688.
>> No. of events in total is: 23263.
>> No. of total events/second is: 7754.666666666667
>> Memory used:16892760
>>
>> Paul.
>>
>>
>>> 2009/9/17 PF <pif1979 at gmail.com>
>>>
>>>> Hi guys,
>>>> 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):
>>>> Number of events Drools 5.0 Fusion Esper 3.1.0 Etalis with SWI Prolog
>>>> Etalis with Yap Prolog
>>>> 10000 1179 453 328 265 (time in miliseconds to process the stream of
>>>> events)
>>>> 20000 2359 828 701 531
>>>> 30000 3538 1141 1023 780
>>>> 40000 4718 1500 1356 1078
>>>> 50000 5897 1813 1702 1329
>>>>
>>>> I can provide some of our code if someone needs it (beside what I pasted
>>>> below).
>>>> 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.
>>>> Thank you, regards,
>>>> Paul Fodor
>>>> Our program has 5 rules to detect complex events:
>>>> fusion.drl:
>>>> rule "experiment A -Rule 0/0"
>>>> when
>>>>  $ae1 :Event(symbol == 1, $Pr1 : price) and
>>>>  $ce1 :Event(this after $ae1 , symbol == 1, price > ($Pr1/1.2) )
>>>> then
>>>>  //System.out.println("Ce1 fired !");
>>>> end
>>>> rule "experiment A -Rule 0/1"
>>>> when
>>>>  (
>>>>  $ae2 :Event(symbol == 2,$Pr2 : price) and
>>>>  $ce2 : Event(this after $ae2 , symbol == 2,price > ($Pr2/1.2) )
>>>>  )
>>>> then
>>>>  //System.out.println("Ce2 fired !");
>>>> end
>>>> rule "experiment A -Rule1"
>>>> when
>>>>  (
>>>>  $ae1 :Event(symbol == 1, $Pr1 : price) and
>>>>  $ce1 :Event(this after $ae1 , symbol == 1, price > ($Pr1/1.2) )
>>>>  )
>>>>   or
>>>>  (
>>>>  $ae2 :Event(symbol == 2,$Pr2 : price) and
>>>>  $ce2 : Event(this after $ae2 , symbol == 2,price > ($Pr2/1.2) )
>>>>  )
>>>> then
>>>>  //System.out.println("Ce3 fired !");
>>>> end
>>>>
>>>> rule "experiment A -Rule4"
>>>> when
>>>>  (
>>>>  $ae1 :Event(symbol == 1, $Pr1 : price) and
>>>>  $ce1 :Event(this after $ae1 , symbol == 1, price > ($Pr1/1.2) )
>>>>  )
>>>>   and
>>>>  (
>>>>  $ae2 :Event(symbol == 2,$Pr2 : price) and
>>>>  $ce2 : Event(this after $ae2 , symbol == 2,price > ($Pr2/1.2) , this
>>>> after[0,20m] $ce1 )
>>>>  )
>>>> then
>>>>  //System.out.println("Ce4 fired !");
>>>> end
>>>>
>>>> rule "experiment A -Rule5"
>>>> when
>>>>  (
>>>>  $ae1 :Event(symbol == 1, $Pr1 : price) and
>>>>  $ce1 :Event(this after $ae1 , symbol == 1, price > ($Pr1/1.2))
>>>>  )
>>>>   and
>>>>  (
>>>>  $ae2 :Event(symbol == 2,$Pr2 : price) and
>>>>  $ce2 : Event(this after $ae2 , symbol == 2,price > ($Pr2/1.2) , this
>>>> overlaps $ce1)
>>>>  )
>>>> then
>>>>  //System.out.println("Ce5 fired !");
>>>> end
>>>>
>>>> We have an Event class for events with its parameters and an EventStream
>>>> class to fire the events:
>>>> EventStream.java:
>>>> ...
>>>> import org.drools.runtime.StatefulKnowledgeSession;
>>>> public class EventStream {
>>>>  public StatefulKnowledgeSession get_working_session() { return
>>>> ksession;}
>>>> ...
>>>>  void generateEventStream(double duration, double p) {
>>>>   ...
>>>>   //Drools
>>>>   Event temp = new Event(symbol,currValue);
>>>>   ksession.insert(temp);
>>>>   ...
>>>>  }
>>>> }
>>>>
>>>>
>>>> _______________________________________________
>>>> rules-users mailing list
>>>> rules-users at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>>
>>>>
>>>
>>>
>>> --
>>> - http://salaboy.wordpress.com
>>> - http://www.jbug.com.ar
>>> - Salatino "Salaboy" Mauricio -
>>>
>>> _______________________________________________
>>> rules-users mailing list
>>> rules-users at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
>
> --
> - http://salaboy.wordpress.com
> - http://www.jbug.com.ar
> - Salatino "Salaboy" Mauricio -
>



-- 
- http://salaboy.wordpress.com
- http://www.jbug.com.ar
- Salatino "Salaboy" Mauricio -
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090918/5b5ec7f5/attachment.html 


More information about the rules-users mailing list