Drools Fusion speedup
by PF
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);
...
}
}
15 years, 3 months
infinite loops with "no-loop true"
by Nord, James
Hi all,
It seems to me that the no-loop only prevents a rule from triggering
itself - and doesn't make the rule only fire once (which is what I'm
after)
e.g. consider the following two contrived simple rules:
rule "addPriorityPrefix"
dialect "java"
no-loop true
when
$work : Work (priority >= 200)
then
modify($work) {
setTitle("!!! " + getTitle());
};
end
rule "re-assign low priority tasks"
dialect "java"
no-loop true
when
$work : Work (priority < -200)
then
modify($work) {
setOwner("nobody");
};
end
What I end up with is an infinte loop.
Whilst for the simple case I can re-write them like
$work : Work (priority >= 200, !title.startWith("!!!"))
however with the more complex rules this makes the rules get very
complex quickly and less easy to write. Is there a way to prevent these
loops - have I misunderstood or do you really need to check everything
in the rule that you may set?
How would you do the banking interest example?
rule "interest calculation"
no-loop
when
$account : Account( )
then
modify($account) {
setBalance((long)($account.getBalance() * 1.01) )
};
end
if there was another rule that if you where a gold customer and payed in
> $500 the previous month then you get $4 bonus?
rule "gold bonus"
no-loop
when
$account : Account(type="gold", previousMonthDeposit > 500 )
then
modify($account) {
setBalance((long)($account.getBalance() + 4) )
};
end
Regards,
/James
**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster(a)nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.
NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
**************************************************************************************
15 years, 3 months
3rd Event-driven Business Process Management Workshop (3rd edBPM '09) at CASCON 2009 - Call for Participation
by Adrian Paschke
[ our apologies should you receive this message more than one time ]
=====================================================================
CALL FOR PARTICIPATION
3rd Event-driven Business Process Management Workshop (3rd edBPM '09)
at CASCON 2009
November 3rd 2009, Toronto, Canada
https://www-927.ibm.com/ibm/cas/cascon/displayWorkshop?PublicView=true&Num=5
9
"Event-Driven Business Process Management" (EDBPM) refers to an enhancement
of traditional BPM through novel combinations of Service Oriented
Architectures (SOA), Event Driven Architectures (EDA), Software as a Service
(SaaS), Business Activity Monitoring (BAM) and the Processing of Complex
Events (CEP). BPM in turn, refers to a software platform which provides
companies and end-users the ability to model, manage and optimize business
processes.
This workshop introduces the state-of-art concepts underlying EDBPM
solutions, summarize standard best practices in event management, and
discusses the shortcomings, challenges and obstacles. Specifically, there
has been little understanding of service impact beyond event severity and
root-cause of business events. This brought attention to more sophisticated
correlation mechanisms and infrastructure to reason about dependency between
events and their sources. Also, we discuss the various methods of mapping
event incidents to customer SLA and KPI that are crucial for identifying any
escalating problems critical to the business.
============
Registration
============
CASCON registration and Workshop signups are now open. We invite you to
register and log-in.
https://www-927.ibm.com/ibm/cas/cascon/registration/index.shtml
Workshop Chair(s)
-------------------
Young Yoon University of Toronto
Dr. Hans-Arno Jacobsen University of Toronto
Allen Chan IBM
Phil Coulthard IBM
Adrian Paschke Freie Universität Berlin
=====================================================================
15 years, 3 months
Drools 5 OSGI bundle/plugin
by Vijay K Pandey
Hi,
Is there any OSGI bundle/plugin for Drools 5 or anyone has worked upon it?
Thanks
Vijay
15 years, 3 months
STATUS
by The Post Office
The original message was received at Wed, 23 Sep 2009 02:41:15 -0400
from 188.7.49.22
----- The following addresses had permanent fatal errors -----
rules-users(a)lists.jboss.org
----- Transcript of session follows -----
... while talking to mail server lists.jboss.org.:
>>> DATA
<<< 400-aturner; %MAIL-E-OPENOUT, error opening !AS as output
<<< 400-aturner; -SYSTEM-F-EXDISKQUOTA, disk quota exceeded
<<< 400
15 years, 3 months
loading rules from database
by Abarna Ramachandran
*Hi
Please help me making a decision regarding loading rules from database.
*1. How to* *programatically inject the rules into rule engine using drools
API. ? (i cant find any drools API to load into Knowledgebuilder as
rulesCondition,rulesConsequence etc. Should i create my own API? )
2. Which is better approach ?
The above method (1.) or creating a drl using templates and data from
database and then injecting into Knowledgebuilder.
Please help me with this.
3. How to serialize the rulebase and use it later at runtime?
thanks
*
Re: loading rules dynamically *
by cfili <http://www.nabble.com/user/UserProfile.jtp?user=865575> Nov 03,
2008; 11:49pm ::
<http://www.nabble.com/forum/Reply.jtp?post=20307811>
I think the better approach if possible is to serialize your rule base and
storing it in the database as such. Storing the DRL and recompiling your
rules at run time will be quite expensive. We have a similar setup and it
has worked out pretty well for us.
techy wrote:
Hi,
If the rules,conditions,consequences have to be loaded from the database. I
can think of following two approach. what would be right approach( I will
have upto 1200 rules in the db)
1. Programmatically inject the rules into rule engine using drools API.
2. Read the rules from the database and create drl or dsl file for them and
inject into rule engine.
Thanks
15 years, 3 months
what's the new way to set the agent cache directory ?
by Wesley Akio Imamura
Hi,
I'm trying to set the drools agent cache directory so that guvnor can be
down while the engine is still running.
I tried to set it by using -Ddrools.resource.urlcache=/rules-cache
and
KnowledgeAgentConfiguration kac =
KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
kac.setProperty("localCacheDir", "/rules-cache");
kagent = KnowledgeAgentFactory.newKnowledgeAgent("AcecAgent", kac);
Could not find this on the docs/api anymore. It seems that changed.
What's the new way to set the agent cache directory ? Can someone help ?
Thanks,
Wesley.
--
Wesley Akio Imamura
São Paulo - SP - Brazil
15 years, 3 months
"extends" in rules
by Chandana Pingle
Hi,
I found an example on using "extends" to extend a rule from another rule.
Using extends would only include the WHEN side of the rule.
I want to use the variable defined in the parent rule in sub rule
,something like below example,how do i do that?
rule A
when
$a:String( )
eval($a=="abc")
then
do something
end
rule B extends A
when
$b:String( )
$c:SomeClass()
then
$c.someMethod($a,$b) //i am not able to use $a here
end
Any suggestions?
Thanks
Chandana
15 years, 3 months
Problem in deploying drools-guvnor on websphere 6.1
by Nikhil D. Deshpande
Hi,
I am facing following issue :-
I am using Drools Guvnor 5.
I have deployed guvnor on Web Sphere 6.1 it is showing me :-
1. if I specify path like http://localhost:9080/drools-guvnor/.
Then it is giving me :-
Error 500: com.ibm.ws.wswebcontainer.extension.DefaultExtensionProcessor incompatible with com.ibm.wsspi.webcontainer.servlet.IServletWrapper
2. If I try to specify complete path like http://localhost:9080/drools-guvnor/index.jsp
Then it is giving me :-
Error 500: Filter [Seam Filter]: filter is unavailable.
How to solve this Problem.
Looking forward to Listen from you.
Thanks & Regards,
Nikhil
MASTEK LTD.
Mastek is in NASSCOM's 'India Top 20' Software Service Exporters List.
In the US, we're called MAJESCOMASTEK
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from desktop and server.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 years, 3 months
FW: Problem in deploying drools-guvnor on websphere 6.1
by Nikhil S. Kulkarni
From: Nikhil S. Kulkarni
Sent: Tuesday, September 22, 2009 12:25 PM
To: 'rules-users(a)lists.jboss.org'
Subject: Problem in deploying drools-guvnor on oc4j 10 and websphere 6.1
Hi,
I am facing following issue :-
I am using Drools Guvnor 5.
I have deployed guvnor on Web Sphere 6.1 it is showing me :-
1. if I specify path like http://localhost:9080/drools-guvnor/.
Then it is giving me :-
Error 500: com.ibm.ws.wswebcontainer.extension.DefaultExtensionProcessor incompatible with com.ibm.wsspi.webcontainer.servlet.IServletWrapper
2. If I try to specify complete path like http://localhost:9080/drools-guvnor/index.jsp
Then it is giving me :-
Error 500: Filter [Seam Filter]: filter is unavailable.
How to solve this Problem.
Looking forward to Listen from you.
Thanks & Regards,
Nikhil S. Kulkarni
MASTEK LTD.
Mastek is in NASSCOM's 'India Top 20' Software Service Exporters List.
In the US, we're called MAJESCOMASTEK
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from desktop and server.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 years, 3 months