Advice sought on choosing Stateful or Stateless sessions
by Ron Kneusel
Greetings!
I read through the manual, but it is a little too terse regarding when one might choose Stateless versus Stateful sessions. My initial testing has been with Stateful sessions and these work nicely but memory use explodes as the number of facts added increases much beyond 100.
So, my questions:
1. Do stateless sessions execute faster than stateful? I'm assuming that even if they don't, they use memory more effciently?
2. I read that stateless sessions do not allow for facts to be modified yet I saw an example online which was using "insert()" in the DRL file. Will this work if there is a rule that has not already fired but might after the insert? In a stateless session will a rule only fire once and ignore new facts? (I believe so).
3. It also seems that a stateless session has no agenda and therefore will simply fire the first rule that matches so that salience must be used to prioritize rules. Is this correct?
3. The difference between a stateless session and a sequential stateless session is also unclear (to me) from the manual. Can someone explain it?
What I am looking to build is essentially a filter, something that gets a bunch of input facts and applies the rules to see if any alarms should be raised based on the inputs. My test programs have been using a global which tracks the alarms raised. I just look at it after the engine has run and use it as my output. Each run of the rules engine is separate from the previous run, ie, there is no accumulation of "knowledge", which is why I think a stateless session is the way to go but I'm not sure.
Any help appreciated!
Ron
_________________________________________________________________
The i’m Talkathon starts 6/24/08. For now, give amongst yourselves.
http://www.imtalkathon.com?source=TXT_EML_WLH_LearnMore_GiveAmongst
18 years
Drools 4.0.4 and Jboss 4.2.2 GA
by Ojwang Wilson O
All,
I am having the following error when deploying drools 4.0.4 within JBOSS
4.2.2 GA. Please help.
====================
01:06,259 INFO [STDOUT] ERROR 17-03 17:01:06,248
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:01:06,318 INFO [STDOUT] ERROR 17-03 17:01:06,316
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:01:06,348 INFO [STDOUT] ERROR 17-03 17:01:06,347
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:01:06,477 INFO [STDOUT] ERROR 17-03 17:01:06,476
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:01:06,506 INFO [STDOUT] ERROR 17-03 17:01:06,506
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:01:06,523 INFO [STDOUT] ERROR 17-03 17:01:06,522
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:01:06,649 INFO [STDOUT] ERROR 17-03 17:01:06,648
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:01:06,660 INFO [STDOUT] ERROR 17-03 17:01:06,659
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:01:06,935 INFO [STDOUT] ERROR 17-03 17:01:06,934
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:01:08,065 INFO [STDOUT] ERROR 17-03 17:01:08,064
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:01:08,243 INFO [STDOUT] ERROR 17-03 17:01:08,242
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:01:08,994 INFO [STDOUT] ERROR 17-03 17:01:08,993
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:19:33,956 INFO [STDOUT] ERROR 17-03 17:19:33,956
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:19:33,988 INFO [STDOUT] ERROR 17-03 17:19:33,987
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:19:34,039 INFO [STDOUT] INFO 17-03 17:19:34,038
(SecurityServiceImpl.java:login:45) Logging in user [wojwang]
17:19:34,048 INFO [STDOUT] INFO 17-03 17:19:34,047
(DefaultAuthenticator.java:authenticate:38) User logged in via
default authentication module (no security check).
17:19:34,068 INFO [STDOUT] ERROR 17-03 17:19:34,067
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:24:34,104 INFO [STDOUT] ERROR 17-03 17:24:34,102
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
===================
Regards
Wilson
18 years
error while creating a pkg using brms
by Prem Kumar L
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-558
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2008.06.23 at 11:49:08 AM IST
//
package org.domain;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for CreditCard complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="CreditCard">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="age" type="{http://www.w3.org/2001/XMLSchema}int"/>
* <element name="annualIncome" type="{http://www.w3.org/2001/XMLSchema}double"/>
* <element name="asset" type="{http://www.w3.org/2001/XMLSchema}double"/>
* <element name="eligibilityStatus" type="{http://www.w3.org/2001/XMLSchema}string"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CreditCard", propOrder = {
"name",
"age",
"annualIncome",
"asset",
"eligibilityStatus"
})
public class CreditCard {
@XmlElement(required = true)
protected String name;
protected int age;
protected double annualIncome;
protected double asset;
@XmlElement(required = true)
protected String eligibilityStatus;
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
/**
* Gets the value of the age property.
*
*/
public int getAge() {
return age;
}
/**
* Sets the value of the age property.
*
*/
public void setAge(int value) {
this.age = value;
}
/**
* Gets the value of the annualIncome property.
*
*/
public double getAnnualIncome() {
return annualIncome;
}
/**
* Sets the value of the annualIncome property.
*
*/
public void setAnnualIncome(double value) {
this.annualIncome = value;
}
/**
* Gets the value of the asset property.
*
*/
public double getAsset() {
return asset;
}
/**
* Sets the value of the asset property.
*
*/
public void setAsset(double value) {
this.asset = value;
}
/**
* Gets the value of the eligibilityStatus property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEligibilityStatus() {
return eligibilityStatus;
}
/**
* Sets the value of the eligibilityStatus property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEligibilityStatus(String value) {
this.eligibilityStatus = value;
}
}
18 years
query on "modify"
by Prem Kumar L
Hi,
I tried creating/compiling/executing the following rule using the drools
eclipse workbench:
package com.sample
import org.domain.CreditCard;
rule "Credit Eligibility"
no-loop true
when
cc : CreditCard( age > 18, annualIncome > 50000, asset> 500000 )
then
cc.setEligibilityStatus( "Eligible for credit card" );
System.out.println("Valid Credit Score ");
modify( cc );
end
I was successfully able to run the rule against my CreditCard object.
However, when I tried running it from withing my applicaiton by
embedding drools(latest, the following error occurs:
org.drools.rule.InvalidRulePackage: Rule Compilation error : [Rule
name=Credit Eligibility, agendaGroup=MAIN, salience=0, no-loop=true]
com/sample/Rule_Credit_Eligibility_0.java (13:652) : The method
modify(CreditCard) is undefined for the type Rule_Credit_Eligibility_0
at org.drools.rule.Package.checkValidity(Package.java:424)
at
org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:384)
at
org.drools.jsr94.rules.admin.RuleExecutionSetImpl.<init>(RuleExecutionSetImpl.java:130)
at
org.drools.jsr94.rules.admin.LocalRuleExecutionSetProviderImpl.createRuleExecutionSet(LocalRuleExecutionSetProviderImpl.java:233)
at
org.drools.jsr94.rules.admin.LocalRuleExecutionSetProviderImpl.createRuleExecutionSet(LocalRuleExecutionSetProviderImpl.java:176)
at
org.drools.jsr94.rules.admin.LocalRuleExecutionSetProviderImpl.createRuleExecutionSet(LocalRuleExecutionSetProviderImpl.java:96)
Any pointers would be much appreciated!
Prem
18 years
Unable to load dialect 'org.drools.rule.builder.dialect.mvel.MVELDialectConfiguration:mvel'
by Ojwang Wilson O
Hi,
I am currently having an error "RuleBaseTask failed: Unable to load
dialect
'org.drools.rule.builder.dialect.mvel.MVELDialectConfiguration:mvel'"
while trying to build drl to pkg using Ant from a DroolsTest that was
created by default in eclipse when one select new->other->Drools->Rules
Project.
Here is my build.xml
===================
<project name="Ant Drools DRL build" default="rules" basedir=".">
<property file="build.properties"/>
<property name="src.java.dir"
value="${basedir}/src/main/java"/>
<property name="rules.dir"
value="${basedir}/src/main/rules"/>
<property name="lib.dir" value="${drools.eclipse.jar}"/>
<property name="drools.main.jar" value="${drools.main.dir}"/>
<property name="drools.lib.jar" value="${drools.lib.dir}"/>
<property name="build.dir" value="${basedir}/build"/>
<!-- Classpath declaration -->
<path id="drools.classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
<include name="**/*.zip"/>
</fileset>
<fileset dir="${drools.main.jar}">
<include name="**/*.jar"/>
<include name="**/*.zip"/>
</fileset>
<fileset dir="${drools.lib.jar}">
<include name="**/*.jar"/>
<include name="**/*.zip"/>
</fileset>
</path>
<!-- Useful shortcuts -->
<patternset id="meta.files">
<include name="**/*.xml"/>
<include name="**/*.properties"/>
<include name="**/*.drl"/>
</patternset>
<!-- Clean up -->
<target name="clean" description="Clean the build directory">
<delete dir="${build.dir}"/>
<mkdir dir="${build.dir}"/>
</target>
<!-- Copy metadata to build classpath -->
<target name="copymetafiles">
<mkdir dir="${build.dir}"/>
<copy todir="${build.dir}">
<fileset dir="${src.java.dir}">
<patternset refid="meta.files"/>
</fileset>
</copy>
<copy todir="${build.dir}">
<fileset dir="${rules.dir}">
<patternset refid="meta.files"/>
</fileset>
</copy>
</target>
<!-- Compile Java source -->
<target name="compile">
<mkdir dir="${build.dir}"/>
<javac srcdir="${src.java.dir}"
destdir="${build.dir}"
classpathref="drools.classpath">
</javac>
</target>
<target name="drools.run" depends="compile, copymetafiles">
<java classname="com.sample.DroolsTest"
fork="true">
<classpath>
<pathelement path="${build.dir}" />
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
</classpath>
</java>
</target>
<taskdef name="compiler"
classname="org.drools.contrib.DroolsCompilerAntTask"
classpathref="drools.classpath" />
<!-- Compile Java source -->
<target name="rules">
<compiler
srcdir="${rules.dir}/"
tofile="${build.dir}/Samplerules.pkg"
classpathref="drools.classpath">
<include name="*.drl" />
</compiler>
</target>
</project>
===================
Thanks in advance for your professional help.
Regards
Wilson
18 years
Eclipse plugin error: DRL-files in multiple folders?
by Tobias Abstreiter
Hi!
I have a problem using the drools Eclipse plugin.
In our project rules are located in different folders. One of it is called "global" (containing many functions, imports, ...) whereon most of the rules in the other folders depend. The package name is identical.
Running the application works fine but the Eclipse plugin reports many "... cannot be resolved"-errors when I convert the Eclipse Java project into a Drools project. I believe that the plugin has problems to find all rule files. Is that possible?
Is there a way to tell the plugin to look in multiple rule-folders?
Thanks in advance,
Tobias
__________________________________________________________________
MicroNova electronic GmbH
Tobias Abstreiter
Telekommunikation & Netzmanagment
Unterfeldring 17
D-85256 Vierkirchen
Tel.: +49 (08139) 93 00-42
Fax.: +49 (08139) 93 00-80
eMail: Tobias.Abstreiter(a)micronova.de
Web: http://www.micronova.de
Geschäftsführer: Josef W. Karl - Sitz der Gesellschaft: Jetzendorf
Registergericht: Ingolstadt - HRB-Nr.: 181 373
__________________________________________________________________
18 years
Drools memory use issues
by Ron Kneusel
Greetings!
I'm using Drools 4 and have a simple test setup with 4 rules. If I run with a few facts (simple objects that hold a type and a floating point value only) everything works as advertised. If I bump the number of facts up to 100 it runs most of the time without changing the defaults on the virtual machine. However, if I change the number of facts to 500 and change the virtual machine memory limits to 1024 MB the engine grinds to a halt and eventually dies with an out of memory error.
What are the reasonable limits for Drools in terms of facts in the working memory and number of rules?
I will try a test with hundreds of rules today but I was very surprised, and disappointed, to see that so few facts eat so much memory. The project my company needs Drools for will likely have to run the engine on a working memory with about 100..150 facts and do so every 1 to 2 seconds. Can Drools keep up? How can performance be improved?
Thanks!
Ron
_________________________________________________________________
Introducing Live Search cashback . It's search that pays you back!
http://search.live.com/cashback/?&pkw=form=MIJAAF/publ=HMTGL/crea=introsr...
18 years
Rule Agent Performance : BRMS or pkg file ?
by Cabou, Carl
Hi all,
I'm using Drools 4.0.7.
I use the Drools api in my application with the rule Agent as describe
in the section 9.4.4.1 of the documentation and it works fine.
Since our application is running under weblogic 8.1, we must use JBoss
for BRMS because weblogic 8.1 is not java5 compliant, but I don't want
to use multiple app servers.
So the question is : what is best for performance ? use the BRMS at
runtime (< url > property) on JBoss or use only packages files on disk
(< file > property).
Anyway I will do perf benchmarks, I'm assuming it is better with package
files but I'd like to have some feedback before...
Regards,
Carl.
18 years
RE: Rules with Lookup Tables...
by Rahul Phadnis
Have you looked at
http://labs.jboss.com/portal/jbossrules/subversion.html
I think that page is not uptodate since at the bottom
it says "Trunk is unstable and may often not build. If
you wish to build form Subversion source the latest
tag is:
http://anonsvn.labs.jboss.com/labs/jbossrules/tags/3.0.3-GA/
"
Are n't we at 3.0.5 already?
-Rahul
--- jjdepaul(a)us.ibm.com wrote:
> Rahul -
>
> Where can I find Maven2 repository that has the
> nightly builds for Drools project?! I've looked
> around on a couple of well-known ones abut no luck
> finding anything above D3.0.5
>
> thanks,
> james
> >
> > The "from" CE (conditional expression) is not
> > available in the current released jboss rules
> version
> > (3.0.5) and you probably have to use the nightly
> build
> > to use it.
> >
> > -Rahul
> >
> >
>
>
18 years