Drools 6 performance
by Mark Proctor
If anyone has tried 6.0 and seeing performance gains, please contact us. We want to find the real world use cases that benefit from the lazy evaluation.
Mark
12 years, 1 month
Pooling KnowledgeBase instances
by travistcummings
Hi,
I am running into an issue in a highly concurrent environment where my
threads are waiting on locking of the rule base when I try to insert into
the session. I am wondering if an appropriate solution would be to create a
pool of KnowledgeBase objects, each having its own rule base. A thread dump
of my server had the message below for about 40 threads.
For my use case, I create the knowledge base once, then don't modify it in
any way.
Thank you!
Travis
"ajp-bio-8010-exec-984" daemon prio=10 tid=0x081f3800 nid=0x2a7c waiting on
condition [0x9f368000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0xf0489a50> (a
java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
at
java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:834)
at
java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:867)
at
java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1197)
at
java.util.concurrent.locks.ReentrantReadWriteLock$WriteLock.lock(ReentrantReadWriteLock.java:945)
at
org.drools.common.UpgradableReentrantReadWriteLock.lowPriorityWriteLock(UpgradableReentrantReadWriteLock.java:105)
at
org.drools.common.UpgradableReentrantReadWriteLock.writeLock(UpgradableReentrantReadWriteLock.java:88)
at org.drools.common.AbstractRuleBase.lock(AbstractRuleBase.java:475)
at
org.drools.reteoo.builder.PatternBuilder.attachObjectTypeNode(PatternBuilder.java:276)
at
org.drools.reteoo.ClassObjectTypeConf.<init>(ClassObjectTypeConf.java:103)
at
org.drools.common.ObjectTypeConfigurationRegistry.getObjectTypeConf(ObjectTypeConfigurationRegistry.java:71)
at org.drools.reteoo.Rete.assertObject(Rete.java:107)
at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:286)
at
org.drools.reteoo.ReteooWorkingMemory$WorkingMemoryReteAssertAction.execute(ReteooWorkingMemory.java:434)
at
org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:993)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:335)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:311)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:903)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:847)
at
org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:269)
--
View this message in context: http://drools.46999.n3.nabble.com/Pooling-KnowledgeBase-instances-tp40279...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 1 month
Drools - Processing large volume of (Same Type) Facts with muliple complex Rules groups
by mattmadhavan
Hello,
I have a few questions on Drools.
* My client has millions of rows of Facts of same type , to which the rules
are applied. The facts are never updated.
* There is multiple set of Rule groups (Cancer type can be
Breast/Colon/Thyroid etc), with each group containing multiple rules in a
separate .drl file (BeastCancer.drl, ColonCancer.drl etc).
I have the following requirements/questions
1) Each group has a first rule that checks for Cancer type - If the caner
type is not the one for this group (Say the CaseFact is for Colon but the
current rule group is for Breast) the rule flow should stop for this group
and continue for other groups. I guess I can achieve this by having my first
rule with a high Salience and skip the rest of the rules if the condition is
met. (drools.clearAgenda () may be ?)
2) within a group of rules - I need to skip the execution for rest of rules
in this group only depending on the condition.
3) Some conditional flow (I believe I can achieve this with Rule Flow
Group).
4) Should I have have one KnowledgeBase/Stateless session per .drl file (one
per beast.drl one for colon.drl)? That seems to be the logical thing to!
5) Main question is how do I skip execution of a set of rules
I appreciate in advance!
Thanks
Matt'M
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Processing-large-volume-of-Same-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 1 month
Null pointer exception when using global in rdrl 6.0.1.F
by SrjTx
I have a class that I declared final, has a private constructor, has only
static members and methods.
Some of its members are static instance of classes.
In KIE-WBI added a global of that type with name X
When I try to make a call on X.foo(), I get a null pointer exception. (note
that x.foo() calls y.foo(), where y is a static member of X.
I've read some posts that a global has to be static, am I stretching, what
it means for a global to be static?
I am guessing I need to write some java code that will create an instance of
X and inject into working memory? I was hoping to be able to create this
object within either the drools or SY framework.
I have googled and be reading on this for quite a bit now, but I think I
have succeeded only in confusing myself.
Any help greatly appreciated.
--
View this message in context: http://drools.46999.n3.nabble.com/Null-pointer-exception-when-using-globa...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 1 month
Re: [rules-users] Drools, slf4j and Eclipse Error on DroolsTest.Java
by Inastrol
Figured out the problem. Didn't have Maven installed as a plug-in
correctly. The book I'm using to learn Drools, didn't include that step.
Terry Moriarty wrote:
> This isn't my code. It's created when a Drools project is created in
> Eclipse. I guess that's why this is so frustrating. It's supposed to
> demonstrate a very simple Drools program and I can't get it to work.
> It's hard to debug someone else's code when you don't know the
> language yet.
>
> Code is kSession.insert(message);
>
> Thanks
>
> sdjoe [via Drools] wrote:
>
>> Hard to say without seeing your code. Can you post it here and point
>> out where the NPE is happening on line 23?
>>
>> ------------------------------------------------------------------------
>> If you reply to this email, your message will be added to the
>> discussion below:
>> http://drools.46999.n3.nabble.com/Drools-slf4j-and-Eclipse-Error-on-Drool...
>>
>> To unsubscribe from Drools, slf4j and Eclipse Error on
>> DroolsTest.Java, click here
>> <http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscr...>.
>> NAML
>> <http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=macro_vi...>
>>
>
>------------------------------------------------------------------------
>
>package com.sample;
>
>import org.kie.api.KieServices;
>import org.kie.api.runtime.KieContainer;
>import org.kie.api.runtime.KieSession;
>
>/**
> * This is a sample class to launch a rule.
> */
>public class DroolsTest {
>
> public static final void main(String[] args) {
> try {
> // load up the knowledge base
> KieServices ks = KieServices.Factory.get();
> KieContainer kContainer = ks.getKieClasspathContainer();
> KieSession kSession = kContainer.newKieSession("ksession-rules");
>
> // go !
> Message message = new Message();
> message.setMessage("Hello World");
> message.setStatus(Message.HELLO);
> kSession.insert(message);
> kSession.fireAllRules();
> } catch (Throwable t) {
> t.printStackTrace();
> }
> }
>
> public static class Message {
>
> public static final int HELLO = 0;
> public static final int GOODBYE = 1;
>
> private String message;
>
> private int status;
>
> public String getMessage() {
> return this.message;
> }
>
> public void setMessage(String message) {
> this.message = message;
> }
>
> public int getStatus() {
> return this.status;
> }
>
> public void setStatus(int status) {
> this.status = status;
> }
>
> }
>
>}
>
>
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-slf4j-and-Eclipse-Error-on-Drool...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 1 month
Drools 6 and Gradle?
by Andrew Berman
Hello,
I keep running into an issue where Drools is looking for a pom.properties
file and I get an error since I'm using Gradle. Does Drools depend on
Maven? I noticed there is a lot of code looking for Maven and pom.xml and
pom.properties, why is that?
Thanks!
12 years, 1 month
ReteOO, KnowledgeBase and KnowledgeSession relation
by Harpreet Singh
Hi,
I understand that the ReteOO network is built when a KnowledgeBase is created. Can you please tell me:
- if any modifications are made to this network after a session (say StatefulKnowledgeSession) has been created from this KnowledgeBase?
- any optimizations made at the session level? (such that time taken to fire rules decreases when certain set of facts are re-inserted and rules re-executed)
I could not find any explanation in Drools Expert documentation regarding the above two points. Any pointers explaining the relation between ReteOO, KnowledgeBase and KnowledgeSession will be helpful.
Thanks.
12 years, 1 month
java dialect and declared types
by pmander
If I declare a type in a drl and reference the attributes in a rule then all
is fine for either dialect. But, if one of the attributes is a java class
that has been compiled and inserted then under the java dialect only I get a
compilation error: rule compilation error the field ... is not visible
for example
declare DroolsTransaction
ORG : String
PRODUCT : String
raw : Transaction
end
rule "create classes"
salience 100
when
$t : Transaction()
then
insert(new DroolsTransaction((String)$t.fieldFor("ORG"),
(String)$t.fieldFor("PRODUCT"), $t));
end
I insert Transaction objects in the session and this works fine for the
following rule if I have the dialect set to mvel.
rule "1"
when
$t : DroolsTransaction(ORG == "A" , PRODUCT == "001", raw.complicated())
then
do something
end
but when I switch dialects to java, the compilation complains that raw is
not visible.
I guess drools is dynamically creating the DroolsTransaction object with
private fields... and I need public accessors - how to define them?
--
View this message in context: http://drools.46999.n3.nabble.com/java-dialect-and-declared-types-tp40278...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 1 month
Re: [rules-users] Drools, slf4j and Eclipse Error on DroolsTest.Java
by Inastrol
This isn't my code. It's created when a Drools project is created in
Eclipse. I guess that's why this is so frustrating. It's supposed to
demonstrate a very simple Drools program and I can't get it to work.
It's hard to debug someone else's code when you don't know the language yet.
Code is kSession.insert(message);
Thanks
sdjoe [via Drools] wrote:
> Hard to say without seeing your code. Can you post it here and point
> out where the NPE is happening on line 23?
>
> ------------------------------------------------------------------------
> If you reply to this email, your message will be added to the
> discussion below:
> http://drools.46999.n3.nabble.com/Drools-slf4j-and-Eclipse-Error-on-Drool...
>
> To unsubscribe from Drools, slf4j and Eclipse Error on
> DroolsTest.Java, click here
> <http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscr...>.
> NAML
> <http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=macro_vi...>
>
package com.sample;
import org.kie.api.KieServices;
import org.kie.api.runtime.KieContainer;
import org.kie.api.runtime.KieSession;
/**
* This is a sample class to launch a rule.
*/
public class DroolsTest {
public static final void main(String[] args) {
try {
// load up the knowledge base
KieServices ks = KieServices.Factory.get();
KieContainer kContainer = ks.getKieClasspathContainer();
KieSession kSession = kContainer.newKieSession("ksession-rules");
// go !
Message message = new Message();
message.setMessage("Hello World");
message.setStatus(Message.HELLO);
kSession.insert(message);
kSession.fireAllRules();
} catch (Throwable t) {
t.printStackTrace();
}
}
public static class Message {
public static final int HELLO = 0;
public static final int GOODBYE = 1;
private String message;
private int status;
public String getMessage() {
return this.message;
}
public void setMessage(String message) {
this.message = message;
}
public int getStatus() {
return this.status;
}
public void setStatus(int status) {
this.status = status;
}
}
}
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-slf4j-and-Eclipse-Error-on-Drool...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 1 month