Performance of JBoss Rules
by Dandrea Francesco
Hi all,
I have to evaluate if JBoss Rules is a viable solution in this scenario:
We have to monitor a large network using performance alarms. These
alarms arrive every 15 minutes. We don't know the real rate, but peaks
of many tens of thousands of alarms every 15 minutes must be managed in
a timely way.
We want to use JBoss Rules to correlate these alarms, in order to show
less higher level alarms to the users .
We have basically 2 use cases:
1) I have to correlate the alarms on a single node of the network. (for
example in node A I have 2 alarms of different severity about the
connection with node B, so I aggregate everything in a third alarm
saying "I cannot connect to node B from node A"). In this scenario I
have many workingMemories (one for each node) and not so many facts for
each working memory. The performance of JBossRules is very very good
(almost linear with the number of nodes)
2) I have to correlate alarms among the nodes. (for example all nodes
connecting with a node A have an alarm "I cannot connect to node A from
node ...", I want to create an alarm "The node A is unreachable").
In this scenario I'm very worried about the performance of JBoss Rules,
as I prepared a test case (in attachment) and I inferred that the growth
is highly non linear on the number of the facts. Is this performance
data wrong? Am I doing something stupid? Can someone comment?
Here are the numbers (The numbers are not so important, but rate they
grows is)
Number of Facts Time to assert alla the new allarms (seconds) Time to
modify the alarms to close them (seconds) Total
1000 1.735 0.969 2.704
2000 5.875 3.000 8.875
3000 12.281 6.406 18.687
4000 23.672 11.672 35.344
6000 52.282 23.250 75.532
8000 87.188 42.532 129.720
12000 200.767 94.642 295.409
16000 360.909 176.579 537.488
20000 518.019 263.158 781.177
Or in a graph:
Thanks a lot for your interest.
--------------------------------------------------------------------
CONFIDENTIALITY NOTICE
This message and its attachments are addressed solely to the persons above and may contain confidential information. If you have received the message in error, be informed that any use of the content hereof is prohibited. Please return it immediately to the sender and delete the message. Should you have any questions, please contact us by replying to webmaster(a)telecomitalia.it.
Thank you
www.telecomitalia.it
--------------------------------------------------------------------
18 years
RE: [rules-users] RE: Why not retracting?
by Grimshaw, Jeffrey
Hi Michael. I've only been using JBoss Rules for about 2 weeks, so keep
that in mind when reading my reply.
The way I understand it works is that facts are evaluated against the
LHS of all the rules in the ruleset as they are asserted. That is, when
a fact is added to the WorkingMemory, the engine determines which rules
apply to that fact. You may expect that evaluation to take place when
the rules are "run". This may have something to do with the behavior
you are seeing.
For more info on what I'm talking about, see section 1.6.4.2 of the user
docs.
http://labs.jboss.com/file-access/default/members/jbossrules/freezone/do
cs/3.0.5/html/index.html
Cheers,
--Jeff
________________________________
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Anstis,
Michael (M.)
Sent: Friday, January 26, 2007 8:08 AM
To: Rules Users List
Subject: [rules-users] RE: Why not retracting?
By way of an update; if the retraction is made within a different Agenda
Group the rules work as expected.
However the problem of the retraction having no obvious affect when
operated within the same Agenda Group remains.
Is this a bug?
_____________________________________________
From: Anstis, Michael (M.)
Sent: 26 January 2007 11:32
To: 'Rules Users List'
Subject: Why not retracting?
Hello,
I have the following rules; one removes "Prices" that do not
have the required "Economic Level" from working memory, the other
calculates a "Costs":-
rule "Cost - remove prices that do not have the required
'Economic Level'"
agenda-group "stamping-costs"
//salience 1
when
p : Price ( economicLevel != (
Utilities.makeDate(1, 1, 2007) ) )
then
System.out.println("Retracting "+p.toString());
retract(p);
end
rule "Cost - calculate cost for 'Stamping process' on a
process"
agenda-group "stamping-costs"
//salience 2
when
r : ResourceEntry ( m : machine )
//p : Price ( economicLevel == (
Utilities.makeDate(1, 1, 2007) ), machine == ( m ) )
p : Price ( machine == ( m ) )
then
Cost cost = new Cost(r, p);
cost.setCost((float) (r.getUsage() *
p.getRate()));
assert(cost);
end
The problem is that the "Cost" rule still works upon ALL
"Prices" (even those with an incorrect "Economic Level").
If I change the line in the "Cost" rule to also check the
"Economic Level" the rules work as expected (i.e. "Costs" are only
calculated using "Prices" with an "Economic Level" of 01/01/2007).
I've tried using "salience" levels too (as commented in the
above Rules) but this doesn't have any effect either.
What am I doing wrong?
Cheers,
Mike
18 years
RE: Why not retracting?
by Anstis, Michael (M.)
By way of an update; if the retraction is made within a different Agenda
Group the rules work as expected.
However the problem of the retraction having no obvious affect when
operated within the same Agenda Group remains.
Is this a bug?
> _____________________________________________
> From: Anstis, Michael (M.)
> Sent: 26 January 2007 11:32
> To: 'Rules Users List'
> Subject: Why not retracting?
>
> Hello,
>
> I have the following rules; one removes "Prices" that do not have the
> required "Economic Level" from working memory, the other calculates a
> "Costs":-
>
> rule "Cost - remove prices that do not have the required
> 'Economic Level'"
> agenda-group "stamping-costs"
> //salience 1
> when
> p : Price ( economicLevel != ( Utilities.makeDate(1, 1,
> 2007) ) )
> then
> System.out.println("Retracting "+p.toString());
> retract(p);
> end
>
> rule "Cost - calculate cost for 'Stamping process' on a process"
> agenda-group "stamping-costs"
> //salience 2
> when
> r : ResourceEntry ( m : machine )
> //p : Price ( economicLevel == ( Utilities.makeDate(1,
> 1, 2007) ), machine == ( m ) )
> p : Price ( machine == ( m ) )
> then
> Cost cost = new Cost(r, p);
> cost.setCost((float) (r.getUsage() * p.getRate()));
> assert(cost);
> end
>
> The problem is that the "Cost" rule still works upon ALL "Prices"
> (even those with an incorrect "Economic Level").
>
> If I change the line in the "Cost" rule to also check the "Economic
> Level" the rules work as expected (i.e. "Costs" are only calculated
> using "Prices" with an "Economic Level" of 01/01/2007).
>
> I've tried using "salience" levels too (as commented in the above
> Rules) but this doesn't have any effect either.
>
> What am I doing wrong?
>
> Cheers,
>
> Mike
18 years
Why not retracting?
by Anstis, Michael (M.)
Hello,
I have the following rules; one removes "Prices" that do not have the
required "Economic Level" from working memory, the other calculates a
"Costs":-
rule "Cost - remove prices that do not have the required
'Economic Level'"
agenda-group "stamping-costs"
//salience 1
when
p : Price ( economicLevel != ( Utilities.makeDate(1, 1,
2007) ) )
then
System.out.println("Retracting "+p.toString());
retract(p);
end
rule "Cost - calculate cost for 'Stamping process' on a process"
agenda-group "stamping-costs"
//salience 2
when
r : ResourceEntry ( m : machine )
//p : Price ( economicLevel == ( Utilities.makeDate(1,
1, 2007) ), machine == ( m ) )
p : Price ( machine == ( m ) )
then
Cost cost = new Cost(r, p);
cost.setCost((float) (r.getUsage() * p.getRate()));
assert(cost);
end
The problem is that the "Cost" rule still works upon ALL "Prices" (even
those with an incorrect "Economic Level").
If I change the line in the "Cost" rule to also check the "Economic
Level" the rules work as expected (i.e. "Costs" are only calculated
using "Prices" with an "Economic Level" of 01/01/2007).
I've tried using "salience" levels too (as commented in the above Rules)
but this doesn't have any effect either.
What am I doing wrong?
Cheers,
Mike
18 years
Major problems with dynamic rules
by Justine Hlista
Hello,
I am having some major problems working with dynamic rules. This may be a
showstopper for us. Perhaps I have missed something in the docs.
The main problem is significantly different behavior depending on when I
assert facts versus when I read drl files that use them.
It *appears* that I must class load all potential fact classes by
referencing them in a dummy rule before I assert facts and and begin using
dynamic rules against them. But that is a guess.
An example:
I have 2 rule files and 1 fact class (class factA with a String field1).
---------------------
testCase1.drl:
---------------------
rule Bootstrap
when
a : factA(field1=="blah")
then
System.out.println("bootstrap: a blah");
end
---------------------
testCase2.drl:
---------------------
rule "aIsHello"
when
a: factA(field1=="hello")
then
System.out.println("a: " + a.getField1());
a.setField1("world");
modify(a);
end
rule "aIsWorld"
when
a: factA(field1 == "world")
then
System.out.println("Retracted a with field1 = " + a.getField1());
retract(a);
end
If I first assert my factA (workingMemory.assertObject( new factA("hello"))
) before loading either drl file, only rule "aIsHello" fires.
If I first load testCase1.drl and then assert factA and then load
testCase2.drl, then both rule "aIsHello" and rule "aIsWorld" both fire. This
is the expected behavior (at least for me).
If I modify testCase1.drl such that it does not reference class factA but
some other class (e.g. factAtoo), then only rule "aIsHello" fires (as in the
first case).
I am extremely confused, as I would at least expect the same behavior in all
cases. For our application, it is critical that we be able to assert facts
and modify rules independently and dynamically. What am I missing about how
dynamic rules should work??
Any help is greatly appreciated!
Justine
18 years
Why would addPackageFromDrl() takes more time even for a small drl file with one rule
by Raja.Bobbala@sanofi-aventis.com
I have the following code to add a drl to the package.It takes 2-3 secs to load even a small drl file with one rule.
Appreciate if anyone in the group throw some light on this.
PackageBuilder builder = new PackageBuilder();
Date startTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("H:mm:ss:SSS");
String datenewformat = formatter.format(startTime);
System.out.println("Before Add Package from DRL-->" + datenewformat);
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "/test.drl" )));
Date endTime = new Date();
SimpleDateFormat formatter1 = new SimpleDateFormat("H:mm:ss:SSS");
String datenewformat1 = formatter1.format(endTime);
System.out.println("After Add Package from DRL-->" + datenewformat1);
18 years
NPE with modify
by Scott Reed
I am getting an NPE when I uncomment the modify call in the rule below.
I am running version 3.0.4.
I'd appreciate any ideas as to why this is happening.
Thanks,
Scott
rule "TEST"
when
$paystub: Paystub( $grossPay: grossPay )
eval( $grossPay.getState() == FPConstants.INACTIVE )
then
$grossPay.setState( FPConstants.READY );
//modify( $paystub );
end
With modify uncommented I get the following exception:
java.lang.NullPointerException
at org.drools.reteoo.beta.DefaultRightMemory.remove(Unknown Source)
at org.drools.reteoo.BetaMemory.remove(Unknown Source)
at org.drools.reteoo.JoinNode.modifyObject(Unknown Source)
at org.drools.reteoo.ObjectSource.propagateModifyObject(Unknown Source)
at org.drools.reteoo.ObjectTypeNode.modifyObject(Unknown Source)
at org.drools.reteoo.Rete.modifyObject(Unknown Source)
at org.drools.reteoo.ReteooRuleBase.modifyObject(Unknown Source)
at org.drools.reteoo.ReteooWorkingMemory.modifyObject(Unknown Source)
at org.drools.base.DefaultKnowledgeHelper.modifyObject(Unknown Source)
at
org.fp.findata.Rule_Precalc___TEST_0.consequence(Rule_Precalc___TEST_0.java:14)
at
org.fp.findata.Rule_Precalc___TEST_0ConsequenceInvoker.evaluate(Rule_Precalc___TEST_0ConsequenceInvoker.java:29)
at org.drools.common.DefaultAgenda.fireActivation(Unknown Source)
at org.drools.common.DefaultAgenda.fireNextItem(Unknown Source)
at org.drools.common.AbstractWorkingMemory.fireAllRules(Unknown Source)
at org.drools.common.AbstractWorkingMemory.fireAllRules(Unknown Source)
at org.fp.util.RuleEngineManager$RunTask.run(RuleEngineManager.java:159)
18 years
Re: identity vs equality question - drools use of equals()
by Edson Tirelli
Guillaume,
Unfortunatelly, I don't think it is possible right now. We have an
idea of making possible to disable the TruthMaintananceSystem through
configuration for users that don't use logical assertions, but this is
not implemented yet.
Isn't it possible for you to wrap or proxy (intercepting equals()
calls) those classes that are raising exceptions?
[]s
Edson
guillaume.tardif(a)sgcib.com wrote:
>Hi,
>
>Thanks for the quick answer!
>
>The configuration you describe actually works fine.
>My issue is that I'm using objects where the equals method throws an
>exception when 2 objets are not of the same type.
>(which is far from being ideal, I must admit, but I don't have much control
>on these classes in my context)
>I assert these objects using the assertObject() method (no logical assert)
>
>I thought that the Identity behavoir will prevent JBoss Rules from calling
>equals() at all.
>Apparently this is not the case, I understand that this behavior allows to
>have A!= B and A.equals(B) and still put the 2 objects in the working
>memory, but the equals() method is still invoked for other purposes.
>
>Is there any way to fully prevent JBoss Rules from calling equals() on the
>facts to avoid potential exceptions?
>(I do realise that correcting the equals() method on the fact objects would
>make much more sense... )
>With your explaination below, I don't have much hope, but I still give it a
>shot :-)
>
>Thanks
>Guillaume
>
>
>mercredi 24 janvier 2007 2:58
>To: Guillaume TARDIF/fr/socgen@socgen
>cc:
>From: tirelli(a)post.com
>Subject: identity vs equality question - drools use of equals()
>
>
> Guillaume,
>
> This is a complex part of the engine, so we need to understand better
> what problems you are finding.
>
> Just as an overview, we have 2 separate types of check we need to do
> in the engine.
> One for normal asserted objects (identity by default) and one for
> logically asserted objects (equals by default). So, when you assert an
> object into working memory, we will decide asserting it or not, based on
> identity, but we will also update the TruthMaintenanceSystem with the
> object information (that is equals() based) with your newly asserted
> object. So, equals() WILL be called anyway, but it does not mean that
> the engine is not working on WM_IDENTITY_BEHAVIOR.
> So, if you don't use logical asserts, you don't need to worry with
> the results of your equals method. If you do use normal asserts and
> logical asserts, then there are some interactions that may need
> additional attention.
>
> A simple test you can do to check if the engine is indeed working
> fine is just create 2 different objects whose equals/hashcode methods
> evaluate to true/equals and assert both into working memory with normal
> assert method. Both instances will be added to the working memory.
>
> Can you ellaborate on the problem you are seeing?
>
> []s
> Edson
>
>guillaume.tardif(a)sgcib.com wrote:
>
>
>
>>Hi,
>>
>>I have a similar problem when using objects from an external framework
>>as facts : the equals method is invoked despite using the
>>/WM_BEHAVIOR_IDENTITY/property.
>>
>>Here is an exmple reproducing this with JBoss Rules 3.0.5 : I have
>>created a JBoss Rules project under Eclipse, and created 2 classes
>>MyObject and MyObject2.
>>These classes have hashCode() returning 0 and equals throwing a
>>ClassCastException when comparing 2 object of different classes
>>
>>
>>
>>Actually, after debugging a bit, it seems that the equals method is
>>invoked by the TruthMaintenanceSystem.assertMap, which has a hardcoded
>>EqualityKeyComparator (never set to IdentityKeyComparator).
>>The WorkingMemory.assertMap has its KetComparator set correctly to
>>IdentityKeyComparator
>>Also, the equals method is not called when the hashCode() method
>>returns different values for different objects, which makes it a bit
>>harder to reproduce the issue.
>>
>>This is a roadblock for using JBoss Rules in our context ; has someone
>>any idea for a workaround?
>>
>>Thanks in advance,
>>Guillaume
>>
>>*************************************************************************
>>This message and any attachments (the "message") are confidential and
>>
>>
>intended solely for the addressee(s).
>
>
>>Any unauthorised use or dissemination is prohibited. E-mails are
>>
>>
>susceptible to alteration.
>
>
>>Neither SOCIETE GENERALE nor any of its subsidiaries or affiliates shall
>>
>>
>be liable for the message if altered, changed or falsified.
>
>
>> ************
>>Ce message et toutes les pieces jointes (ci-apres le "message") sont
>>
>>
>confidentiels et etablis a l'intention exclusive de ses
>
>
>>destinataires. Toute utilisation ou diffusion non autorisee est interdite.
>>
>>
>Tout message electronique est susceptible d'alteration.
>
>
>>La SOCIETE GENERALE et ses filiales declinent toute responsabilite au
>>
>>
>titre de ce message s'il a ete altere, deforme ou falsifie.
>
>
>>*************************************************************************
>>
>>
>>------------------------------------------------------------------------
>>
>>java.lang.ClassCastException
>> at com.sample.MyObject.equals(MyObject.java:7)
>> at org.drools.common.EqualityKey.equals(Unknown Source)
>> at org.drools.common.EqualityKeyComparator.areEqual(Unknown Source)
>> at org.drools.util.FastMap.getEntry(Unknown Source)
>> at org.drools.util.FastMap.get(Unknown Source)
>> at org.drools.common.TruthMaintenanceSystem.get(Unknown Source)
>> at org.drools.common.AbstractWorkingMemory.assertObject(Unknown
>>
>>
>Source)
>
>
>> at org.drools.common.AbstractWorkingMemory.assertObject(Unknown
>>
>>
>Source)
>
>
>> at com.sample.DroolsTest.main(DroolsTest.java:28)=
>>
>>
>>
>
>
>--
>Edson Tirelli
>Software Engineer - JBoss Rules Core Developer
>Office: +55 11 3124-6000
>Mobile: +55 11 9218-4151
>JBoss, a division of Red Hat @ www.jboss.com
>
>
>
--
Edson Tirelli
Software Engineer - JBoss Rules Core Developer
Office: +55 11 3124-6000
Mobile: +55 11 9218-4151
JBoss, a division of Red Hat @ www.jboss.com
18 years
Fw: [drools-user] identity vs equality question - drools use of equals()
by guillaume.tardif@sgcib.com
Hi,
I have a similar problem when using objects from an external framework as
facts : the equals method is invoked despite using the
WM_BEHAVIOR_IDENTITYproperty.
Here is an exmple reproducing this with JBoss Rules 3.0.5 : I have created
a JBoss Rules project under Eclipse, and created 2 classes MyObject and
MyObject2.
These classes have hashCode() returning 0 and equals throwing a
ClassCastException when comparing 2 object of different classes
Actually, after debugging a bit, it seems that the equals method is
invoked by the TruthMaintenanceSystem.assertMap, which has a hardcoded
EqualityKeyComparator (never set to IdentityKeyComparator).
The WorkingMemory.assertMap has its KetComparator set correctly to
IdentityKeyComparator
Also, the equals method is not called when the hashCode() method returns
different values for different objects, which makes it a bit harder to
reproduce the issue.
This is a roadblock for using JBoss Rules in our context ; has someone any
idea for a workaround?
Thanks in advance,
Guillaume
*************************************************************************
This message and any attachments (the "message") are confidential and intended solely for the addressee(s).
Any unauthorised use or dissemination is prohibited. E-mails are susceptible to alteration.
Neither SOCIETE GENERALE nor any of its subsidiaries or affiliates shall be liable for the message if altered, changed or falsified.
************
Ce message et toutes les pieces jointes (ci-apres le "message") sont confidentiels et etablis a l'intention exclusive de ses
destinataires. Toute utilisation ou diffusion non autorisee est interdite. Tout message electronique est susceptible d'alteration.
La SOCIETE GENERALE et ses filiales declinent toute responsabilite au titre de ce message s'il a ete altere, deforme ou falsifie.
*************************************************************************
18 years
DSL - new line problem
by Nirmal.R
Hi,
I've create the following rule using dsl
rule
when
load map and result
Variable "prov" as Integer less than or equal to Variable "os" as Integer
* 20/100 AND (Variable "eliCol" as Integer + Variable "inEliCol" as Integer
less than or equal to Variable "os" as Integer
then
assign 150 to result
display risk weight
end
Here
I'm not able to specify the domain specific sentence in multiple lines. I
get the following error whenever i write in multiple lines. Tell me some way
to solve it
org.drools.rule.InvalidRulePackage: unknown:20:90 mismatched token:
[@99,464:465='\r\n',<4>,20:90]; expecting type ')'
unknown:22:43 mismatched token: [@151,596:596=')',<25>,22:43]; expecting
type EOL
unknown:20:9 Unexpected token ')'
unknown:21:9 Unexpected token ')'
--
View this message in context: http://www.nabble.com/DSL---new-line-problem-tf3080075.html#a8557582
Sent from the drools - user mailing list archive at Nabble.com.
18 years