Performance monitoring and hotspot detection in rules?
by H.C.
I am trying to implement a performance monitor to find the most problematic
rules in order to optimize performance. The main performance metrics I want
to gather are:
1. How any times a rule's conditions have been evaluated
2. How long each rule's condition evaluation took
3. How many times a rule's then clause actually executed
4. How long execution of a rule's then clause took
Are there any existing or recommended approaches to do this? I have looked
some at the AgendaEventListener methods but can't clearly map events to the
above. Is there some other logging interface with more events?
Thanks in advance.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Performance-monitorin...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 4 months
Drools-flow: Event within foreach throws ClassCastException
by Liße, Jan
Hello,
i'm using the latest version 5.1.1 of drools-flow for a POC project.
I have a process definition where I have an intermediate event node within a foreach CompositeNode.
When I trigger the event using processInstance.signalEvent() I get a ClassCastException:
java.lang.ClassCastException: org.drools.workflow.core.node.CompositeContextNode cannot be cast to org.drools.workflow.core.node.EventNode
at org.drools.workflow.instance.node.EventNodeInstance.getEventNode(EventNodeInstance.java:62)
at org.drools.workflow.instance.node.EventNodeInstance.signalEvent(EventNodeInstance.java:36)
at org.drools.workflow.instance.node.CompositeNodeInstance.signalEvent(CompositeNodeInstance.java:231)
at org.drools.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:357)
at de.bdr.prototype.ProcessTest.main(ProcessTest.java:36)
Many thanks for any help!
-Jan
Below my process definition:
<?xml version="1.0" encoding="UTF-8"?>
<process xmlns="http://drools.org/drools-5.0/process"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://drools.org/drools-5.0/process drools-processes-5.0.xsd"
type="RuleFlow" name="flow" id="processOrders" package-name="order.flow" >
<header>
<variables>
<variable name="orderPreparationResult" >
<type name="org.drools.process.core.datatype.impl.type.UndefinedDataType" />
</variable>
<variable name="orders" >
<type name="org.drools.process.core.datatype.impl.type.ObjectDataType" className="java.util.List" />
</variable>
</variables>
</header>
<nodes>
<start id="1" name="Start" x="227" y="16" width="228" height="40" />
<forEach id="2" name="ForEach" x="16" y="88" width="650" height="196" variableName="order" collectionExpression="orders" >
<nodes>
<eventNode id="2" name="OrderPreparation Response" x="146" y="133" width="166" height="40">
<eventFilters>
<eventFilter type="eventType" eventType="OrderPreparationEvent" />
</eventFilters>
</eventNode>
<actionNode id="3" name="ORDER_PREP" x="9" y="53" width="151" height="50" >
<action type="expression" dialect="java" >System.out.println("Call Order prep");</action>
</actionNode>
<join id="4" name="Join" x="191" y="59" width="80" height="40" type="1" />
<actionNode id="5" name="ORDER_VALIDATION" x="300" y="56" width="141" height="40" >
<action type="expression" dialect="java" >System.out.println("Order validation");</action>
</actionNode>
<actionNode id="6" name="POPULATE_DB" x="470" y="55" width="152" height="40" >
<action type="expression" dialect="java" >System.out.println("Save to db");</action>
</actionNode>
</nodes>
<connections>
<connection from="3" to="4" />
<connection from="2" to="4" />
<connection from="4" to="5" />
<connection from="5" to="6" />
</connections>
<in-ports>
<in-port type="DROOLS_DEFAULT" nodeId="3" nodeInType="DROOLS_DEFAULT" />
</in-ports>
<out-ports>
<out-port type="DROOLS_DEFAULT" nodeId="6" nodeOutType="DROOLS_DEFAULT" />
</out-ports>
</forEach>
<end id="4" name="End" x="227" y="388" width="228" height="40" />
<actionNode id="5" name="NOTIFY " x="288" y="316" width="106" height="40" >
<action type="expression" dialect="java" >System.out.println("Notify");</action>
</actionNode>
</nodes>
<connections>
<connection from="1" to="2" />
<connection from="5" to="4" />
<connection from="2" to="5" />
</connections>
</process>
15 years, 4 months
Same rules applies twice
by J-C Walmetz
Hi
I use Drools 5.01
I have the following rules:
rule "Reload test" salience 10000
when
$result: Result( $resultId:resultId)
not (exists Test(resultId.technicalId==$resultId.technicalId))
then
Test test = createTest($resultId);
insert(test);
end
When I insert two results with the same identifier, rules is applyed 2 times.
One for each result. I do not understand why.
Do you have an idea of what's happen and how to guratantee that myl rules will
not be applied twice. Here order is not important ...
Thanks
15 years, 4 months
Some Problem with drools-persistence-jpa Library
by tangrui.cn@gmail.com
Hi list,
The attachment is a very simple test case to demonstrate an application
using Drools Persistence JPA (5.1.1).
Usage:
1. set up a mysql database called framework
2. set the user/password are root/root (or change the
bitronix-datasources.properties file)
3. run maven test
The core lines are as following:
StatefulKnowledgeSession ksession =
JPAKnowledgeService.newStatefulKnowledgeSession(kbase, conf, env);
ProcessInstance pi = ksession.startProcess("com.zyeeda.system.TestFlow");
pi.signalEvent("signal", "goon");
When executing the 3rd line, an exception occurred
java.lang.NullPointerException
at
org.drools.process.instance.impl.ProcessInstanceImpl.getProcess(ProcessInstanceImpl.java:67)
at
org.drools.workflow.instance.impl.WorkflowProcessInstanceImpl.getWorkflowProcess(WorkflowProcessInstanceImpl.java:185)
at
org.drools.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:346)
at com.zyeeda.test.AppTest.testProcessPersistence(AppTest.java:84)
I've headed into the code and find that some working memory related to the
ProcessInstanceImpl is null.
(drools-core/src/main/java/org/drools/process/instance/impl/ProcessInstanceImpl.java)
But I cannot get why this does happen. Please give me some tips.
I tried to google some solutions, but find only this one (
http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Flow-Events-No...),
but it seems that he solved this problem by using a custom command.
Thank you!
--
唐睿
15 years, 4 months
Custom UI for Drools rules
by Balasenthil D
Hi,
Is it possible to create a custom UI to create/edit drools rules( instead of Drools Guvnor). Are there APIs that let you do it?
For e.g., oracle provides a java API for create/edit rules. With this you can come up with your own UI, if you are not happy with jdeveloper.
Is something similar possible with Drools too?
Thank you
Bala
**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely
for the use of the addressee(s). If you are not the intended recipient, please
notify the sender by e-mail and delete the original message. Further, you are not
to copy, disclose, or distribute this e-mail or its contents to any other person and
any such actions are unlawful. This e-mail may contain viruses. Infosys has taken
every reasonable precaution to minimize this risk, but is not liable for any damage
you may sustain as a result of any virus in this e-mail. You should carry out your
own virus checks before opening the e-mail or attachment. Infosys reserves the
right to monitor and review the content of all messages sent to or from this e-mail
address. Messages sent to or from this e-mail address may be stored on the
Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***
15 years, 4 months
Error with update in Guvnor
by John Peterson
Hi all,
I'm getting a strange error when I run my rules deployed from Guvnor.
Here's the rule:
WHEN
Fact1 [f1]
Flag1 = false
Flag2 = false
Fact2 [f2]
KeyField = f1.KeyField
THEN
f1.Flag2 = true;
update(f1);
f2.count1 = f2.count1 - 1;
f2.count2 = f2.count2 - 1;
f2.count3 = f2.count3 - 1;
f2.count4 = f2.count4 - 1;
f2.count5 = f2.count5 - 1;
update(f2);
I get the following error in my console when I run:
Exception in readKnowledgeBase: [Error: illegal use of operator:
PROJECT]
[Near : {... Unknown ....}]
^
[Line: 1, Column: 0]
If I remove the second update, it runs without error (but my rules
dependent on the updated f2 don't work). I'm doing this in the Guided
Editor. I've tried both "Modify the values of f2" and doing the update
as free form DRL ("update(f2);"). As listed above, if I put a print
between the last assignment and the update, I get the print results
before the error. If I put the print last, I never see it, so I'm 99.9%
certain it is choking on my update.
Version Specifics:
- Guvnor 5.0.1
- Drools 5.0.1
- JBoss 4.2.3.GA
Any help/guidance would be appreciated!
15 years, 5 months
Guvnor : Globals and variables in test scenario
by Stela Dabija
Using : Guvnor 5.2 (in development)
Tomcat 6.0.28
Java 1.6.0_20
Looks like there is an issue when creating a TestScenario which:
1. Has some fact field set to a variable
2. And, Has some global variable
Steps:
1. In the package configuration define a global variable : "global
Object glVar"
2. Create new Declarative model (see attached image S1_model):
a. FactType : name ="FType1"
b. FactType : name = "FType2"
i.
Field : name="ch"/type="FType1"
c. FactyType : name = "FType3"
i.
Field : name="ch"/type="FType2"
3. Create new TestScenario (see attached images
S2_TestScenario_before and S3_TestScenario_after):
a. Insert a new fact : type="FType2", varName = "f2"
b. Insert a new fact : type = "FType3", varName="f3"
i.
Add a field : name="ch", value = "=f2" (bound to variable f2)
c. Add new Global (glVar).
Observed: after adding the global variable nothing in the TestScenario
screen is displayed.
It is not possible to make any changes to the TestScenario content (for
ex delete the global var).
After saving the TestScenario it is no longer possible to open it.
Do you know if there is any workaround? Is there an open issue for this?
Thank you,
Stela
15 years, 5 months
How to count distinct?
by Yaniv Itzhaki
Hi All,
I need to go over a not distinct list and count distinct each element in the
list.
for example:
Object XXX {
int id;
String type;
}
XXX:
id type
1 A
2 B
3 A
4 C
5 C
The rule should be activated per type and give as a result the count of each
type:
A 2
B 1
C 2
Thanks
15 years, 5 months
Temporal operator before[1ms, oo] exhibtis strange behaviour
by Wolfgang Laun
The .drl:
declare Leave
@role( event )
@timestamp( timestamp )
end
rule "XXX Leave not !="
when
$leave: Leave()
not Leave( this != $leave )
then
System.out.println( "XXX only one Leave - not !=" );
end
rule "YYY Leave not after"
when
$leave: Leave()
not Leave( this before $leave )
then
System.out.println( "YYY only one Leave - not before" );
end
A) The pseudo-clock is advanced according to the timestamp; then
exactly one event Leave is inserted; then fireAllRules() is called.
1) Running in CLOUD mode, both rules fire.
2) But running in STREAM mode, ONLY rule XXX fires.
B) Like A, but the session clock is advanced by (at least) 1ms
prior to calling fireAllRules().
3) Either mode, both rules fire.
I think that A2) is incorrect; why should passing another msec change the
logic?
JIRA?
Wolfgang
15 years, 5 months