Re: [rules-users] Drools flow and BPEL (Drools 5.1)

2010-09-18 Thread tim

Mark & Jeff,
Thanks for your replies!
Tim

-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Drools-flow-and-BPEL-Drools-5-1-tp1477882p1522799.html
Sent from the Drools - User mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] LHS compare two lists

2010-09-18 Thread lnguyen

Hi,

I'm trying to determine if a user has the required certifications for a
position. So I'm comparing the list of required certifications to the list
of User Certifications but I'm throwing a nullPointerException even though I
check to make sure the list are not null on their respective objects. How do
I iterate between both list?

rule "Determine if the user has the required certifications"
dialect 'mvel'
no-loop true
salience 80
when
$user : User()
$profile : UserProfile($userCertifications : userCertifications,
eval(userCertifications != null)) from $user.userProfile
$position : Position($certifications : requiredCertifications,
eval(requiredCertifications != null))
exists ($certification: Certification() from $certifications and
UserCertification(certification == $certification) from $userCertifications)
then
System.out.println("The user has the required certifications");

end

public UserProfile
{

List userCertifications;
//more fields
}

public Position
{
List requiredCertifications;
   //more fields
}

public Certification
{
Long id;

String name;
//more fields
}

public UserCertification
{

Long id;

Date certificationDate;

Certification certification;
//more fields
}
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/LHS-compare-two-lists-tp1521979p1521979.html
Sent from the Drools - User mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Flow Timer causes exception: Caused by: java.util.concurrent.RejectedExecutionException

2010-09-18 Thread Aman
Hello All,

Why don't we have an community forum website like JBoss Drools forum where
we can post questions/answers unlike this mailing list and if someone has to
go back to old posts, how tough it gets to go thru email archives.

No offence here.

Thanks

-Original Message-
From: rules-users-boun...@lists.jboss.org
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Gustavo Tenrreiro
Sent: Saturday, September 18, 2010 5:37 PM
To: Rules Users List
Subject: [rules-users] Flow Timer causes exception: Caused by:
java.util.concurrent.RejectedExecutionException

Hi,

I have a flow and a set of rules.
In the flow I have a wait state. If the wait state has a timer, when
the flow reaches the node it blows up with the following exception (
See Below ), if I remove the timer everything works.

INFO  2010-09-18 16:26:28 [ERROR]
com.kgcontrols.services.raytheon.standardsRequests.workflow.managers.DroolsE
ventsManager
Could not commit session
java.lang.RuntimeException: Could not commit session
at
org.drools.persistence.session.SingleSessionCommandService.execute(SingleSes
sionCommandService.java:292)
at
org.drools.command.impl.CommandBasedStatefulKnowledgeSession.execute(Command
BasedStatefulKnowledgeSession.java:434)
at
com.kgcontrols.services.raytheon.standardsRequests.workflow.managers.DroolsE
ventsManager.sendEvent(DroolsEventsManager.java:43)
at
com.kgcontrols.services.raytheon.standardsRequests.workflow.Rule_domainLeadR
eject_0.defaultConsequence(Rule_domainLeadReject_0.java:10)
at
com.kgcontrols.services.raytheon.standardsRequests.workflow.Rule_domainLeadR
eject_0DefaultConsequenceInvoker.evaluate(Rule_domainLeadReject_0DefaultCons
equenceInvoker.java:34)
at
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:917)
at
org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:856)
at
org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1071)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.j
ava:785)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.j
ava:751)
at
org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeS
essionImpl.java:218)
at
org.drools.command.runtime.rule.FireAllRulesCommand.execute(FireAllRulesComm
and.java:99)
at
org.drools.command.runtime.rule.FireAllRulesCommand.execute(FireAllRulesComm
and.java:33)
at
org.drools.persistence.session.SingleSessionCommandService.execute(SingleSes
sionCommandService.java:279)
at
org.drools.command.impl.CommandBasedStatefulKnowledgeSession.fireAllRules(Co
mmandBasedStatefulKnowledgeSession.java:201)
at
com.kgcontrols.services.raytheon.standardsRequests.workflow.listeners.VoteCr
eatedEventListener.onMessage(VoteCreatedEventListener.java:78)
at
org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer
.java:854)
at
org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor
.java:99)
at
org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.
java:166)
at
org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:11
7)
at
org.apache.activemq.thread.PooledTaskRunner.access$100(PooledTaskRunner.java
:26)
at
org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:44)
at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
Task(ThreadPoolExecutor.java:650)
at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.util.concurrent.RejectedExecutionException
at
java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(Thread
PoolExecutor.java:1768)
at
java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:767)
at
java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(ScheduledThr
eadPoolExecutor.java:216)
at
java.util.concurrent.ScheduledThreadPoolExecutor.schedule(ScheduledThreadPoo
lExecutor.java:379)
at
org.drools.time.impl.JDKTimerService.schedule(JDKTimerService.java:102)
at
org.drools.time.impl.JDKTimerService.scheduleJob(JDKTimerService.java:80)
at
org.drools.process.instance.timer.TimerManager.registerTimer(TimerManager.ja
va:60)
at
org.drools.workflow.instance.node.StateBasedNodeInstance.internalTrigger(Sta
teBasedNodeInstance.java:56)
at
org.drools.workflow.instance.node.CompositeNodeInstance.internalTrigger(Comp
ositeNodeInstance.java:86)
at
org.drools.workflow.instance.node.StateNodeInstance.internalTrigger(StateNod
eInstance.java:48)
at
org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.
java:117)
at
org.drools.workflow.instance.impl.NodeInstanceImpl.triggerConnection(N

[rules-users] Flow Timer causes exception: Caused by: java.util.concurrent.RejectedExecutionException

2010-09-18 Thread Gustavo Tenrreiro
Hi,

I have a flow and a set of rules.
In the flow I have a wait state. If the wait state has a timer, when
the flow reaches the node it blows up with the following exception (
See Below ), if I remove the timer everything works.

INFO  2010-09-18 16:26:28 [ERROR]
com.kgcontrols.services.raytheon.standardsRequests.workflow.managers.DroolsEventsManager
Could not commit session
java.lang.RuntimeException: Could not commit session
at 
org.drools.persistence.session.SingleSessionCommandService.execute(SingleSessionCommandService.java:292)
at 
org.drools.command.impl.CommandBasedStatefulKnowledgeSession.execute(CommandBasedStatefulKnowledgeSession.java:434)
at 
com.kgcontrols.services.raytheon.standardsRequests.workflow.managers.DroolsEventsManager.sendEvent(DroolsEventsManager.java:43)
at 
com.kgcontrols.services.raytheon.standardsRequests.workflow.Rule_domainLeadReject_0.defaultConsequence(Rule_domainLeadReject_0.java:10)
at 
com.kgcontrols.services.raytheon.standardsRequests.workflow.Rule_domainLeadReject_0DefaultConsequenceInvoker.evaluate(Rule_domainLeadReject_0DefaultConsequenceInvoker.java:34)
at 
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:917)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:856)
at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1071)
at 
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:785)
at 
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:751)
at 
org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)
at 
org.drools.command.runtime.rule.FireAllRulesCommand.execute(FireAllRulesCommand.java:99)
at 
org.drools.command.runtime.rule.FireAllRulesCommand.execute(FireAllRulesCommand.java:33)
at 
org.drools.persistence.session.SingleSessionCommandService.execute(SingleSessionCommandService.java:279)
at 
org.drools.command.impl.CommandBasedStatefulKnowledgeSession.fireAllRules(CommandBasedStatefulKnowledgeSession.java:201)
at 
com.kgcontrols.services.raytheon.standardsRequests.workflow.listeners.VoteCreatedEventListener.onMessage(VoteCreatedEventListener.java:78)
at 
org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:854)
at 
org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:99)
at 
org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:166)
at 
org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:117)
at 
org.apache.activemq.thread.PooledTaskRunner.access$100(PooledTaskRunner.java:26)
at 
org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:44)
at 
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at 
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.util.concurrent.RejectedExecutionException
at 
java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:1768)
at 
java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:767)
at 
java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(ScheduledThreadPoolExecutor.java:216)
at 
java.util.concurrent.ScheduledThreadPoolExecutor.schedule(ScheduledThreadPoolExecutor.java:379)
at 
org.drools.time.impl.JDKTimerService.schedule(JDKTimerService.java:102)
at 
org.drools.time.impl.JDKTimerService.scheduleJob(JDKTimerService.java:80)
at 
org.drools.process.instance.timer.TimerManager.registerTimer(TimerManager.java:60)
at 
org.drools.workflow.instance.node.StateBasedNodeInstance.internalTrigger(StateBasedNodeInstance.java:56)
at 
org.drools.workflow.instance.node.CompositeNodeInstance.internalTrigger(CompositeNodeInstance.java:86)
at 
org.drools.workflow.instance.node.StateNodeInstance.internalTrigger(StateNodeInstance.java:48)
at 
org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:117)
at 
org.drools.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:178)
at 
org.drools.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:144)
at 
org.drools.workflow.instance.impl.ExtendedNodeInstanceImpl.triggerCompleted(ExtendedNodeInstanceImpl.java:53)
at 
org.drools.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:117)
at 
org.drools.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:98)
at 
org.drools.workflow.instance.node.WorkItemNodeInstance.triggerCompleted

[rules-users] drools syntax highlighting editor

2010-09-18 Thread Matt Young
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

is there a drools syntax highlighting widget along the lines of
tinymce for regular html pages.  I'm certain there is a seam or JSF
component but my application is a JSP based springmvc application and
I would like to not have to migrate to something else, just to
provided a good rules editor in my application.

- -- 
Cheers,
Matt Young
so...@youngdev.net
http://youngdev.net

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJMlSqqAAoJEO5jycTTPEzcm4gQAJzG22gY+KRj+D6EdJzH4PfH
/WARpfHy+wtyy2N6WGmvpOnmUXsa4f4OTyIdU/DPf+4Sg+qSrDzZ3FzcTB3clQwD
vRVxfcF3ggGzEgZxUYVsaJdAtuhOn/rTwlybZZJYhHVnSorglMWn/eGbzrTtFpMs
CWTl4oewkamKHfGcBOymhEs5CwCuCG18HEwggYAirnO278T3zm4N1b+eTyp2vpyQ
EP+KwIUbjCHyve3u2J2qOLw5ajlUe8rM2z8bRSXgRZUUwtcWl9I66l08oS21/4ZF
Yfnqz1SoEgcKW2Cd8KjQ7ELihP9PGFfwCAvLZv+A1fIGIgqNRY/bKVIo+cB0s8Pb
OWKgYIbGTKD34xon858J/yxkeh4NQS24RJXj/1WoKsqvbmB3OmBDdK4MkAaF1rtg
iTGGp56AaXSI+FMRUF6tTESQCai+g6noKQqyjooWcmO8fETFBsKs/k2voATziJ9z
OgVjwfQ3akO0SpFNggnG3YEFqWqaHlkeBw8cFt7LtVQf+S2YBEvkAqA7digb+czK
d/MdnhmGvshBXquJDUwwPcS6/+Q3c5PbBIoKxUTPmcKOL5JS29NfQOjsuJtMX1uS
xZ4HPlCkIncJLyYNuuwSja5qMgtxX0FYRCk7VZERevr0gUETtUWmigENJEAVHL1a
CbVl9QDLfAChJ5crxwDd
=VjEx
-END PGP SIGNATURE-

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Finding Multiple Solutions using Drools Planner

2010-09-18 Thread Steve Ronderos
Hello Drools Users,I've been investigating Drools Planner for a few weeks and can't figure out how to accomplish a crucial requirement.In my application I need to have Planner return multiple solutions for one planning problem.  More specifically I need is to find all of the ideal solutions to my planning problem.  My problem is similar to the n-queens problem in that there exist ideal solutions.  It is however somewhat simpler because the number of ideal solutions is fairly small (maybe a max of 10 or so).I've looked through the mailing list archives for similar requests and the best I could find was: http://drools-java-rules-engine.46999.n3.nabble.com/the-n-best-solutions-on-a-very-simple-test-case-td60618.htmlI took the advice of the poster in that thread and extended BestSolutionRecaller.  I'm running into some problems getting Planner to continue after an optimal solution is found.My question is this.  Is extending the BestSolutionRecaller the best way to achieve my goal? Or do you think it would be simpler to do this another way?  Perhaps running Planner multiple times with already discovered solutions provided as input.Any advice would be appreciated.Thanks,Steve___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] drools quirks

2010-09-18 Thread Wolfgang Laun
On 18 September 2010 21:15, Matt Young  wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Thanks Wolfgang,
>  The no-loop attribute fixed my crazy looping problem and your answer
> on knowing EVERYTHING the rule might ever have to do is a good
> answer.  I guess there will be a certain amount of trust I have to
> place in the users.  In the meantime, are there any books on drools
> you reccomend (other than the manual)?
>
>
The standard (or only?) answer to this is: Michal Bali's book, see
https://www.packtpub.com/drools-jboss-rules-5-0-developers-guide/book

If you are new to Rules and Rule Based Systems, you might also profit from
more general literature on RBS, even when a text is not direclty related to
Drools.

-W
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] drools quirks

2010-09-18 Thread Matt Young
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Thanks Wolfgang,
  The no-loop attribute fixed my crazy looping problem and your answer
on knowing EVERYTHING the rule might ever have to do is a good
answer.  I guess there will be a certain amount of trust I have to
place in the users.  In the meantime, are there any books on drools
you reccomend (other than the manual)?

On 09/18/2010 01:24 PM, Wolfgang Laun wrote:
>
> On 18 September 2010 17:19, Matt Young  > wrote:
>
> ksession.execute(document);
>
>
> I suppose this inserts a single EventRulesDocument object.
>
>
> Here is the rule:
>
> package sample1
>
> import sample1.bean.EventRulesDocument; import
> sample1.bean.Transaction; import java.util.Date;
>
> rule "Standard processing rule"
>
> when $doc : EventRulesDocument( ruleRun == false &&  # <<<
> Wolfgang event != null && event.eventType.eventCode == "testevent"
> ) then
>
> Transaction t = new Transaction(); t.setEvent($doc.getEvent());
> t.setCategory($doc.getEvent().getEventType().getEventCode());
> t.setTransactionAmount($doc.getEvent().getEventAmount());
> t.setCreateTs(new Date());
> t.setUsername($doc.getEvent().getCreateUsername());
>
> modify( $doc ) {setRuleRun(true)};   # Wolfgang << modify( $doc
> ) {addSaveTransaction(t)} ;
>
>
> Here it is: You modify the EventRulesDocument, which causes
> another activation of the same rule. One way of avoiding this is to
> add the rule attribute no-loop true; another one is what you've
> done.
>
> This isn't going to be your only rule?? This one alone is scant
> reason to use an RBS.
>
> fireAllRules( 1 ) isn't a good remedy, because (normally) a
> Production System relies on repeated firings, depending on rules
> and facts.
>
>
> end
>
>
> Additionally If any code in the world can be executed in the RHS,
> then why shouldn't I just use groovy as my rule language?  At
> least then, I can write math like such: def num1=95; def num2=90;
> def num3=num2/num1;
>
> and all of the math is done with big decimal objects.  IF there is
> no restriction on what can be done in the RHS what is the advantage
> to using a rules engine over a general purpose scripting language?
>
>
> There is a good section in the Drools Expert manual: "Why use a
> rule engine?". Don't do it just to be trendy ;-)
>
>
> The whole purpose for me choosing drools over Groovy eval() was
> that I didn't want to give my users the ability to spawn threads,
> allocate massive amounts of memory etc.
>
>
> Seriously now, a Domain Specifiy Language is the maximum corset you
> can force upon your users. But you'll have to know /all/ they /may
> /do, and all the conditions.
>
> -W
>
>
>
> On 09/18/2010 10:59 AM, Wolfgang Laun wrote:
>> On 18 September 2010 16:15, Matt Young  
>> >> wrote:
>>
>> I just started using drools and this is my first time
>> implementing a rules engine.  Everything has been pretty smooth
>> but I have some quirks that I am not sure I can live with. 1) for
>> some
> reason,
>> if I execute the Knowlege session against an object, the
>> knowlege session never returns.
>>
>>
>>> I don't understand the term "execute...against an object". Do
>>> you mean that you have just one fact inserted befor you call
>>> fireAllRules()?
>>
>>> But anyway, this call not returning is almost certainly due to
>>> a loop in your rules, or have you made sure that they don't?
>>
>>
>> The only way I can get the ksession to return is to make IF
> (obj ==
>> null) part of the LHS and make
>> modify($input){setObj("complete")} part of the RHS This seems
>> like a deficiency since I have users writing their own rules, I
>> can see them forgetting this requirement.
>>
>>
>>> Writing rules is programming, no holds barred :-)
>>
>>> Look into Domain Specific Languages (DSL) as a cushion for the
>>> unwary.
>>
>>
>>
>> IS their a way to get the ksession to firerules only once?  If
>> so what does that look like?
>>
>>
>>> kSession.fireUntilHalt( 1 );
>>
>>
>> 2) It seems that any code I want can be executed in the RHS.  I
>> could literally execute something like the following in the RHS.
>>
>> byte[] b= new byte[10]; // Really big memory waste
>>
>> I also could just start a bunch of threads.
>>
>> The point is that I am intending to let the users write their
>> own rules but I can't do that if there are no restrictions on
>> how/what can be done inside the rules.  Any suggestions?  Are
>> there sandboxes or filters I can activate to restrict the RHS?
>>
>>
>>> Again: DSL.
>>
>>> Also, Rule Templates might be the starting point; it'd depend
>>> on what the may be allowed to do.
>>
>>> And what about good old-fashioned training?!
>>
>>> -W
>>
>>
>
> ___ rules-users mailing
> list rules-users@lists.jboss.org
> 
>  >
> https://lists

Re: [rules-users] Welcome to the "rules-users" mailing list

2010-09-18 Thread Aman
Hello,

I can see Drools 5.1 is going to add support for Spring integration.
How about Seams, I think it is already integrated, because in all
presentations, I haven't seen anyone referring to Seam.

Thanks

-Original Message-
From: rules-users-boun...@lists.jboss.org
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of
rules-users-requ...@lists.jboss.org
Sent: Saturday, September 18, 2010 2:25 PM
To: boy1...@gmail.com
Subject: Welcome to the "rules-users" mailing list

Welcome to the rules-users@lists.jboss.org mailing list!

To post to this list, send your email to:

  rules-users@lists.jboss.org

General information about the mailing list is at:

  https://lists.jboss.org/mailman/listinfo/rules-users

If you ever want to unsubscribe or change your options (eg, switch to
or from digest mode, change your password, etc.), visit your
subscription page at:

  https://lists.jboss.org/mailman/options/rules-users/boy18nj%40gmail.com


You can also make such adjustments via email by sending a message to:

  rules-users-requ...@lists.jboss.org

with the word `help' in the subject or body (don't include the
quotes), and you will get back a message with instructions.

You must know your password to change your options (including changing
the password, itself) or to unsubscribe.  It is:

  newpassword1

Normally, Mailman will remind you of your lists.jboss.org mailing list
passwords once every month, although you can disable this if you
prefer.  This reminder will also include instructions on how to
unsubscribe or change your account options.  There is also a button on
your options page that will email your current password to you.

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] forall not delivering as expected

2010-09-18 Thread Wolfgang Laun
On 15 September 2010 17:11, Edson Tirelli  wrote:

>   Hey Wolfgang,
>
>   I owe you a few answers on this and other e-mails... I will try to
> reply to all of them by EOD today... just been busy trying to finish
> the parser changes...
>
>
All right! Occasionally, I'd like to get them, though ;-)

-W
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] drools quirks

2010-09-18 Thread Wolfgang Laun
On 18 September 2010 17:19, Matt Young  wrote:

>ksession.execute(document);
>

I suppose this inserts a single EventRulesDocument object.


> Here is the rule:
>
> package sample1
>
> import sample1.bean.EventRulesDocument;
> import sample1.bean.Transaction;
> import java.util.Date;
>
> rule "Standard processing rule"
>
>when
>  $doc : EventRulesDocument(
>ruleRun == false &&  # <<< Wolfgang
>event != null && event.eventType.eventCode == "testevent" )
>then
>
>   Transaction t = new Transaction();
>t.setEvent($doc.getEvent());
>t.setCategory($doc.getEvent().getEventType().getEventCode());
>t.setTransactionAmount($doc.getEvent().getEventAmount());
> t.setCreateTs(new Date());
> t.setUsername($doc.getEvent().getCreateUsername());
>
>modify( $doc ) {setRuleRun(true)};   # Wolfgang <<
>modify( $doc ) {addSaveTransaction(t)} ;
>

Here it is: You modify the EventRulesDocument, which causes another
activation of the same rule. One way of avoiding this is to add the rule
attribute no-loop true; another one is what you've done.

This isn't going to be your only rule?? This one alone is scant reason to
use an RBS.

fireAllRules( 1 ) isn't a good remedy, because (normally) a Production
System
relies on repeated firings, depending on rules and facts.


> end
>

> Additionally If any code in the world can be executed in the RHS, then
> why shouldn't I just use groovy as my rule language?  At least then, I
> can write math like such:
> def num1=95;
> def num2=90;
> def num3=num2/num1;
>
> and all of the math is done with big decimal objects.  IF there is no
> restriction on what can be done in the RHS what is the advantage to
> using a rules engine over a general purpose scripting language?


There is a good section in the Drools Expert manual: "Why use a rule
engine?".
Don't do it just to be trendy ;-)


>  The
> whole purpose for me choosing drools over Groovy eval() was that I
> didn't want to give my users the ability to spawn threads, allocate
> massive amounts of memory etc.
>

Seriously now, a Domain Specifiy Language is the maximum corset you can
force upon your users. But you'll have to know *all* they *may *do, and all
the
conditions.

-W


>
> On 09/18/2010 10:59 AM, Wolfgang Laun wrote:
> > On 18 September 2010 16:15, Matt Young  > > wrote:
> >
> > I just started using drools and this is my first time implementing
> > a rules engine.  Everything has been pretty smooth but I have
> > some quirks that I am not sure I can live with. 1) for some reason,
> > if I execute the Knowlege session against an object, the knowlege
> > session never returns.
> >
> >
> >> I don't understand the term "execute...against an object". Do you
> >> mean that you have just one fact inserted befor you call
> >> fireAllRules()?
> >
> >> But anyway, this call not returning is almost certainly due to a
> >> loop in your rules, or have you made sure that they don't?
> >
> >
> > The only way I can get the ksession to return is to make IF (obj ==
> > null) part of the LHS and make modify($input){setObj("complete")}
> > part of the RHS This seems like a deficiency since I have users
> > writing their own rules, I can see them forgetting this
> > requirement.
> >
> >
> >> Writing rules is programming, no holds barred :-)
> >
> >> Look into Domain Specific Languages (DSL) as a cushion for the
> >> unwary.
> >
> >
> >
> > IS their a way to get the ksession to firerules only once?  If so
> > what does that look like?
> >
> >
> >> kSession.fireUntilHalt( 1 );
> >
> >
> > 2) It seems that any code I want can be executed in the RHS.  I
> > could literally execute something like the following in the RHS.
> >
> > byte[] b= new byte[10]; // Really big memory waste
> >
> > I also could just start a bunch of threads.
> >
> > The point is that I am intending to let the users write their own
> > rules but I can't do that if there are no restrictions on how/what
> > can be done inside the rules.  Any suggestions?  Are there
> > sandboxes or filters I can activate to restrict the RHS?
> >
> >
> >> Again: DSL.
> >
> >> Also, Rule Templates might be the starting point; it'd depend on
> >> what the may be allowed to do.
> >
> >> And what about good old-fashioned training?!
> >
> >> -W
> >
> >
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org 
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
> > ___ rules-users mailing
> > list rules-users@lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
>
> - --
> Cheers,
> Matt Young
> so...@youngdev.net
> http://youngdev.net
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.10 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iQIcBAEBAgAGBQJMlNibAAoJEO5jycTTPEzc

Re: [rules-users] Perfromance issues and memory leaks in Drools (Edson Tirelli)

2010-09-18 Thread Edson Tirelli
   That improvement was developed for Drools 5.1.x. The current
version on the downloads page is 5.1.1.

   As mentioned by Leonardo, make sure you are not rebuilding the
kbase every time. Just create it once and reuse it for your sessions.

   Edson

2010/9/18 Nikhil S. Kulkarni :
> Hi Edson,
>
> Thanks for the information.
> But now I want to ask you one thing. I have seen your post. The problem in 
> application is mainly usage of memory
> You posted that Match 30,2010. I downloaded Drools 5.0 on August 2009 and I 
> am using that.
>
> SO this "True modify" algorithm is implemented in Drools 5.1 only or it is 
> even available in latest Drools 5.0
>
> If I use Drools 5.1 then Whether I will get any advantage.
>
>        In application we are using Rules Template ,Rule Flows and drls. When 
> I am calling Rules from Java then it is taking more time compared to calling 
> Java method from rules.
>
>
>        In addition to this can u suggest me how to write better rules Query.
>
> I am using very simple way of writing Rules Query like :-
>
> When
> Abc : ABC(condition==A)
> Then
>  Call method
> End;
>
>
>
> Thanks & Regards,
> Nikhil S. Kulkarni
>
>
>
>
>
> -Original Message-
> From: rules-users-boun...@lists.jboss.org 
> [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of 
> rules-users-requ...@lists.jboss.org
> Sent: Friday, September 17, 2010 9:30 PM
> To: rules-users@lists.jboss.org
> Subject: rules-users Digest, Vol 46, Issue 58
>
> Send rules-users mailing list submissions to
>        rules-us...@lists.jboss.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        https://lists.jboss.org/mailman/listinfo/rules-users
> or, via email, send a message with subject or body 'help' to
>        rules-users-requ...@lists.jboss.org
>
> You can reach the person managing the list at
>        rules-users-ow...@lists.jboss.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of rules-users digest..."
>
>
> Today's Topics:
>
>   1. Re: Perfromance issues and memory leaks in Drools (Edson Tirelli)
>
>
> --
>
> Message: 1
> Date: Fri, 17 Sep 2010 11:04:55 -0400
> From: Edson Tirelli 
> Subject: Re: [rules-users] Perfromance issues and memory leaks in
>        Drools
> To: Rules Users List 
> Message-ID:
>        
> Content-Type: text/plain; charset="windows-1252"
>
>    Nikhil,
>
>    Maybe you are using the term "memory leak" loosely here, but otherwise,
> Drools 4.0.7 and Drools 5.0.1 were both tested to exhaustion for memory
> leaks and I can tell you that no memory leak was found, and I personally
> doubt there is one there on regular use. Also, FYI, Drools 5.x eliminates
> the need for shadow facts, what is a considerable memory save over 4.x, but
> adds some other overheads for performance improvement that kind of offset
> those gains. On the other hand, Drools 5.1.1 takes the algorithm to a new
> level, saving a lot of memory on systems that use modify actions on their
> rules.
>
> http://blog.athico.com/2010/03/drools-halves-memory-use-with-new-true.html
>
>    Regarding your performance, all I can tell you is that a rules engine is
> a relational engine that works pretty much like a database, and rules as
> databases queries. The same way you can write SQL queries that run fast or
> slow on a database, you can write rules that run fast or slow on a rules
> engine. It all depends on how the rules/queries are written, how your data
> model/domain model looks like, etc.
>
>    So, regarding your question, we can't tell you how to improve those
> metrics without knowing your domain model, rules and etc.
>
>    []s
>    Edson
>
> 2010/9/17 Nikhil S. Kulkarni 
>
>>  Hi,
>>
>>
>>
>>                 I have written 2 different Drools programs. One is with
>> Using rule Base of Drools 4.0 and other is using Knowledge Base of Drools
>> 5.0.
>>
>> I was trying to check that is there any improvement in Drools 5.0. But I
>> haven?t got any performance improvement in Drools 5.0 code compared to
>> Drools 4.0.
>>
>>
>>
>>                 One more important thing is I am calling this drools code
>> from  My application which itself is heavy application, when I am doing
>> Performance tuning
>>
>> I got one point i.e. session.execute() method is taking around 6-7 seconds
>> to initialize rules and even the memory utilized by Rules is huge.
>>
>>
>>
>> So is there any way that we can reduce the Memory leakage and improve
>> performance.
>>
>>
>>
>> Waiting for Reply.
>>
>>
>>
>> Thanks & Regards,
>>
>> Nikhil S. Kulkarni
>>
>> Emp No: - 9254
>>
>>
>>
>>
>>
>> MASTEK LTD.
>> 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 

Re: [rules-users] drools quirks

2010-09-18 Thread Matt Young
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

OK I looked closer at what Wolfgang said.  By calling fireAllRules(int
limit) instead of execute(object), my rules now fire and return
immidiately without having to set a false condition for the lhs in the RHS

That still does not give me the ability to properly restrict what
objects the rules can create etc.

On 09/18/2010 10:59 AM, Wolfgang Laun wrote:
> On 18 September 2010 16:15, Matt Young  > wrote:
>
> I just started using drools and this is my first time implementing
> a rules engine.  Everything has been pretty smooth but I have
> some quirks that I am not sure I can live with. 1) for some reason,
> if I execute the Knowlege session against an object, the knowlege
> session never returns.
>
>
>> I don't understand the term "execute...against an object". Do you
>> mean that you have just one fact inserted befor you call
>> fireAllRules()?
>
>> But anyway, this call not returning is almost certainly due to a
>> loop in your rules, or have you made sure that they don't?
>
>
> The only way I can get the ksession to return is to make IF (obj ==
> null) part of the LHS and make modify($input){setObj("complete")}
> part of the RHS This seems like a deficiency since I have users
> writing their own rules, I can see them forgetting this
> requirement.
>
>
>> Writing rules is programming, no holds barred :-)
>
>> Look into Domain Specific Languages (DSL) as a cushion for the
>> unwary.
>
>
>
> IS their a way to get the ksession to firerules only once?  If so
> what does that look like?
>
>
>> kSession.fireUntilHalt( 1 );
>
>
> 2) It seems that any code I want can be executed in the RHS.  I
> could literally execute something like the following in the RHS.
>
> byte[] b= new byte[10]; // Really big memory waste
>
> I also could just start a bunch of threads.
>
> The point is that I am intending to let the users write their own
> rules but I can't do that if there are no restrictions on how/what
> can be done inside the rules.  Any suggestions?  Are there
> sandboxes or filters I can activate to restrict the RHS?
>
>
>> Again: DSL.
>
>> Also, Rule Templates might be the starting point; it'd depend on
>> what the may be allowed to do.
>
>> And what about good old-fashioned training?!
>
>> -W
>
>

___
rules-users mailing list
rules-users@lists.jboss.org 
https://lists.jboss.org/mailman/listinfo/rules-users




> ___ rules-users mailing
> list rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users

- -- 
Cheers,
Matt Young
so...@youngdev.net
http://youngdev.net

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJMlNuqAAoJEO5jycTTPEzcQ/wQAICJezwHIqTEm4P01vAzvnD+
Mjfgnaea3q8p7d/Vkapej4lOxOJ1tDHl/msa/JgHraTKttgcn8oHzWkavgx9L2+4
VKZBPyU4YUYdfHkE2TVRs0D0Lr/hJwzqP+uA4ryFB+pwGAbf8hpKLZ+8kmWXQfEe
9Towivs+d01BOXK0ob3+2D7ywWeW9nadx1SqBqu3z0tY8pOiN+4R4ucu9VrYpfzF
/uv72pBa5S96suQZTkLO2W7/R79PjSZCzjl+OHIEMyQR4nR0jUpwr6yjp/7o64u4
O6Byo9gcZo1Nqh+q2WAH2LPHAJ48/Btmpl2sp6JRmkUD7ccbvIcj11KGt/VelFMs
Dn7VtzbkcCLGDiU+pRQKytkMyXS0kiWSBsf1u9nD8gMaXXYEChDNO3Su/c6HydmG
lhrKVRk+Jo7UWvjBGB/Mnn3QWpZPHiq8CtcQOcMI8xbeV+vnXrm3fXayaN7qjJ4C
MB1plfW6EIFkbRz6KnCoYalz0/Brb+tLM0Gxn17mL949okVS5K2qC36LOJDWq1qG
DBZTmFiaWgP8fuuN12MI5ZmdTmIDAaRAMKmFAUAI5GB6ajzD7wjKr9Up3OGRWfS3
MIL7fWca61S1Kp4tmQe/SAJJQgSD6vd/nDnpG/LE9B/bUm/mOYpAart4QtAWxnlq
2ow3pOr5GmRc7DOb4DTh
=Gq8a
-END PGP SIGNATURE-

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] drools quirks

2010-09-18 Thread Matt Young
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

maybe now would be a good time for some code.  Here is how I am
executing the rules against the object:
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();


KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
   
kbuilder.add(ResourceFactory.newByteArrayResource(ruledata),ResourceType.DRL
);
if ( kbuilder.hasErrors() ) {
System.err.println( kbuilder.getErrors().toString() );
}
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
StatelessKnowledgeSession ksession =
kbase.newStatelessKnowledgeSession();
ksession.execute(document);

Here is the rule:

package sample1

import sample1.bean.EventRulesDocument;
import sample1.bean.Transaction;
import java.util.Date;

rule "Standard processing rule"

when
  $doc : EventRulesDocument(
ruleRun == false &&  # <<< Wolfgang
event != null && event.eventType.eventCode == "testevent" )
then
   
   Transaction t = new Transaction();
t.setEvent($doc.getEvent());
t.setCategory($doc.getEvent().getEventType().getEventCode());
t.setTransactionAmount($doc.getEvent().getEventAmount());
 t.setCreateTs(new Date());
 t.setUsername($doc.getEvent().getCreateUsername());

modify( $doc ) {setRuleRun(true)};   # Wolfgang <<
modify( $doc ) {addSaveTransaction(t)} ;

   
end

If I take out the 2 lines marked "Wolfgang", the ksession never
returns from the execute() method.

Additionally If any code in the world can be executed in the RHS, then
why shouldn't I just use groovy as my rule language?  At least then, I
can write math like such:
def num1=95;
def num2=90;
def num3=num2/num1;

and all of the math is done with big decimal objects.  IF there is no
restriction on what can be done in the RHS what is the advantage to
using a rules engine over a general purpose scripting language?  The
whole purpose for me choosing drools over Groovy eval() was that I
didn't want to give my users the ability to spawn threads, allocate
massive amounts of memory etc.  

On 09/18/2010 10:59 AM, Wolfgang Laun wrote:
> On 18 September 2010 16:15, Matt Young  > wrote:
>
> I just started using drools and this is my first time implementing
> a rules engine.  Everything has been pretty smooth but I have
> some quirks that I am not sure I can live with. 1) for some reason,
> if I execute the Knowlege session against an object, the knowlege
> session never returns.
>
>
>> I don't understand the term "execute...against an object". Do you
>> mean that you have just one fact inserted befor you call
>> fireAllRules()?
>
>> But anyway, this call not returning is almost certainly due to a
>> loop in your rules, or have you made sure that they don't?
>
>
> The only way I can get the ksession to return is to make IF (obj ==
> null) part of the LHS and make modify($input){setObj("complete")}
> part of the RHS This seems like a deficiency since I have users
> writing their own rules, I can see them forgetting this
> requirement.
>
>
>> Writing rules is programming, no holds barred :-)
>
>> Look into Domain Specific Languages (DSL) as a cushion for the
>> unwary.
>
>
>
> IS their a way to get the ksession to firerules only once?  If so
> what does that look like?
>
>
>> kSession.fireUntilHalt( 1 );
>
>
> 2) It seems that any code I want can be executed in the RHS.  I
> could literally execute something like the following in the RHS.
>
> byte[] b= new byte[10]; // Really big memory waste
>
> I also could just start a bunch of threads.
>
> The point is that I am intending to let the users write their own
> rules but I can't do that if there are no restrictions on how/what
> can be done inside the rules.  Any suggestions?  Are there
> sandboxes or filters I can activate to restrict the RHS?
>
>
>> Again: DSL.
>
>> Also, Rule Templates might be the starting point; it'd depend on
>> what the may be allowed to do.
>
>> And what about good old-fashioned training?!
>
>> -W
>
>

___
rules-users mailing list
rules-users@lists.jboss.org 
https://lists.jboss.org/mailman/listinfo/rules-users




> ___ rules-users mailing
> list rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users

- -- 
Cheers,
Matt Young
so...@youngdev.net
http://youngdev.net

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJMlNibAAoJEO5jycTTPEzc5uUQAJ1ku8gHoMLKVf8Y64llpAIK
n0jKIkUbvs44AKEIq3bv6hM9x1sqskJ8zXqV1FmrJ6FLeILPpqc2El/QVQkY5YVh
xKbFU6FOEhjhR8lcOCLu9Pt7Bxh0eWcdpJsGN/4PAaUDmS4f4UEj1OH5TRdxKWvn
sw4nR3N+KxJKIOSsvW2IXcULdiy3rQm3YYs7GvQmiPbrgLzSYxGhPBsy/W18P75f
xefctOjsuFt89BP3BUjzut3Hu7Q/1bhCETwV0sGg2c7oynbgiRY96/tGC

Re: [rules-users] drools quirks

2010-09-18 Thread Wolfgang Laun
On 18 September 2010 16:15, Matt Young  wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> I just started using drools and this is my first time implementing a
> rules engine.  Everything has been pretty smooth but I have  some
> quirks that I am not sure I can live with.
> 1) for some reason, if I execute the Knowlege session against an
> object, the knowlege session never returns.


I don't understand the term "execute...against an object". Do you mean
that you have just one fact inserted befor you call fireAllRules()?

But anyway, this call not returning is almost certainly due to a loop
in your rules, or have you made sure that they don't?


>  The only way I can get
> the ksession to return is to make IF (obj == null) part of the LHS and
> make modify($input){setObj("complete")} part of the RHS
> This seems like a deficiency since I have users writing their own
> rules, I can see them forgetting this requirement.


Writing rules is programming, no holds barred :-)

Look into Domain Specific Languages (DSL) as a cushion for the unwary.



>  IS their a way to
> get the ksession to firerules only once?  If so what does that look like?
>

kSession.fireUntilHalt( 1 );


> 2) It seems that any code I want can be executed in the RHS.  I could
> literally execute something like the following in the RHS.
>
> byte[] b= new byte[10]; // Really big memory waste
>
> I also could just start a bunch of threads.
>
> The point is that I am intending to let the users write their own
> rules but I can't do that if there are no restrictions on how/what can
> be done inside the rules.  Any suggestions?  Are there sandboxes or
> filters I can activate to restrict the RHS?
>

Again: DSL.

Also, Rule Templates might be the starting point; it'd depend on what
the may be allowed to do.

And what about good old-fashioned training?!

-W


> - --
> Cheers,
> Matt Young
> so...@youngdev.net
> http://youngdev.net
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.10 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iQIcBAEBAgAGBQJMlMmHAAoJEO5jycTTPEzclUwQAJdLYF183A5fSo9cN0a1gkkR
> bRyIEgUBUZGQVZi+W7vezQMVqLtV1/+HkfDj5EdylD9fGS6/OsBzOKMCKb4IIuOe
> j8xgp4Z85G5JmowhWDh9AYfHMwcOJ/QSjrPm4ABs3ZQilBEeSKcYBNZ/YNX9WhVN
> ZMeLwx9+VJqK1Wj4Aue6zdG4XiSA+CTNL309xLgyGkoiWtnp3+wY4Q3q1WGArWti
> uIq0tN1xGk9mRkSGepdAjycv5mc+9BCjh6/5UqSIMsWSTqKzm6ce96YQIMgMV77m
> J6/ya91eTGiqXXpXsrSKJSHUFe7ExAJjjVZFzXT55FSNRBzrInCXDIyMfH6hX00E
> KFQyQWHi3lLRPSKnBpkBGQj1ZPB3WMBvq8Kfjjszzoa3MjmsfNy21YdrSdLUnJPC
> NNdBCwYmNbntRu+6fhk8D5OxlLXqAY+OcuVLjySKdBq6eA+Q20XN8+GLWwAjSD8K
> vc0/6HAICKzOXhpSiPEFsPSOxT/FSVBXPOmoO0fMoxjOLpEHU2G5CB6lIn8zZngQ
> GodDE6s9uOWLsEyxsBCp7Nb9uLNEFXVW91SsYcGQuzCrVgwPR4Dc/KUzOdYUPIaM
> RC1laZbdEfrhisZrHAkZDaMSzaYZO48Vb4ZpCJTqCVESdwjRbBLtTG7YNAFBKQQw
> BN9Qjq6IJUUJDzfawsrr
> =1xoA
> -END PGP SIGNATURE-
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] drools quirks

2010-09-18 Thread Matt Young
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I just started using drools and this is my first time implementing a
rules engine.  Everything has been pretty smooth but I have  some
quirks that I am not sure I can live with.
1) for some reason, if I execute the Knowlege session against an
object, the knowlege session never returns.  The only way I can get
the ksession to return is to make IF (obj == null) part of the LHS and
make modify($input){setObj("complete")} part of the RHS
This seems like a deficiency since I have users writing their own
rules, I can see them forgetting this requirement.  IS their a way to
get the ksession to firerules only once?  If so what does that look like?
2) It seems that any code I want can be executed in the RHS.  I could
literally execute something like the following in the RHS.

byte[] b= new byte[10]; // Really big memory waste

I also could just start a bunch of threads.

The point is that I am intending to let the users write their own
rules but I can't do that if there are no restrictions on how/what can
be done inside the rules.  Any suggestions?  Are there sandboxes or
filters I can activate to restrict the RHS?

- -- 
Cheers,
Matt Young
so...@youngdev.net
http://youngdev.net

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJMlMmHAAoJEO5jycTTPEzclUwQAJdLYF183A5fSo9cN0a1gkkR
bRyIEgUBUZGQVZi+W7vezQMVqLtV1/+HkfDj5EdylD9fGS6/OsBzOKMCKb4IIuOe
j8xgp4Z85G5JmowhWDh9AYfHMwcOJ/QSjrPm4ABs3ZQilBEeSKcYBNZ/YNX9WhVN
ZMeLwx9+VJqK1Wj4Aue6zdG4XiSA+CTNL309xLgyGkoiWtnp3+wY4Q3q1WGArWti
uIq0tN1xGk9mRkSGepdAjycv5mc+9BCjh6/5UqSIMsWSTqKzm6ce96YQIMgMV77m
J6/ya91eTGiqXXpXsrSKJSHUFe7ExAJjjVZFzXT55FSNRBzrInCXDIyMfH6hX00E
KFQyQWHi3lLRPSKnBpkBGQj1ZPB3WMBvq8Kfjjszzoa3MjmsfNy21YdrSdLUnJPC
NNdBCwYmNbntRu+6fhk8D5OxlLXqAY+OcuVLjySKdBq6eA+Q20XN8+GLWwAjSD8K
vc0/6HAICKzOXhpSiPEFsPSOxT/FSVBXPOmoO0fMoxjOLpEHU2G5CB6lIn8zZngQ
GodDE6s9uOWLsEyxsBCp7Nb9uLNEFXVW91SsYcGQuzCrVgwPR4Dc/KUzOdYUPIaM
RC1laZbdEfrhisZrHAkZDaMSzaYZO48Vb4ZpCJTqCVESdwjRbBLtTG7YNAFBKQQw
BN9Qjq6IJUUJDzfawsrr
=1xoA
-END PGP SIGNATURE-

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Perfromance issues and memory leaks in Drools (Edson Tirelli)

2010-09-18 Thread Leonardo Gomes
Hi Nikhil,

If it's taking 5-6 seconds as you said, it means that you are compiling your
rules at runtime. To improve that, you could find a way to cache your
KnowledgeBase*s* - that would make your rules be compiled only once and
subsequent creation of stateless or stateful sessions would be pretty quick.
To go further, you could create the knowledge bases using precompiled rules.
For that, I use a maven plugin that compiles my drls at build time. I don't
have a link now, but you should be able to find it.

Sharing your knowledge bases and precompiling your rules will certainly make
a difference.

Hope that helps.

Leo.

On Sat, Sep 18, 2010 at 10:00 AM, Nikhil S. Kulkarni <
nikhil.kulka...@mastek.com> wrote:

> Hi Edson,
>
> Thanks for the information.
> But now I want to ask you one thing. I have seen your post. The problem in
> application is mainly usage of memory
> You posted that Match 30,2010. I downloaded Drools 5.0 on August 2009 and I
> am using that.
>
> SO this "True modify" algorithm is implemented in Drools 5.1 only or it is
> even available in latest Drools 5.0
>
> If I use Drools 5.1 then Whether I will get any advantage.
>
>In application we are using Rules Template ,Rule Flows and drls.
> When I am calling Rules from Java then it is taking more time compared to
> calling Java method from rules.
>
>
>In addition to this can u suggest me how to write better rules
> Query.
>
> I am using very simple way of writing Rules Query like :-
>
> When
> Abc : ABC(condition==A)
> Then
>  Call method
> End;
>
>
>
> Thanks & Regards,
> Nikhil S. Kulkarni
>
>
>
>
>
> -Original Message-
> From: rules-users-boun...@lists.jboss.org [mailto:
> rules-users-boun...@lists.jboss.org] On Behalf Of
> rules-users-requ...@lists.jboss.org
> Sent: Friday, September 17, 2010 9:30 PM
> To: rules-users@lists.jboss.org
> Subject: rules-users Digest, Vol 46, Issue 58
>
> Send rules-users mailing list submissions to
>rules-users@lists.jboss.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>https://lists.jboss.org/mailman/listinfo/rules-users
> or, via email, send a message with subject or body 'help' to
>rules-users-requ...@lists.jboss.org
>
> You can reach the person managing the list at
>rules-users-ow...@lists.jboss.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of rules-users digest..."
>
>
> Today's Topics:
>
>   1. Re: Perfromance issues and memory leaks in Drools (Edson Tirelli)
>
>
> --
>
> Message: 1
> Date: Fri, 17 Sep 2010 11:04:55 -0400
> From: Edson Tirelli 
> Subject: Re: [rules-users] Perfromance issues and memory leaks in
>Drools
> To: Rules Users List 
> Message-ID:
>
> 
> >
> Content-Type: text/plain; charset="windows-1252"
>
>Nikhil,
>
>Maybe you are using the term "memory leak" loosely here, but otherwise,
> Drools 4.0.7 and Drools 5.0.1 were both tested to exhaustion for memory
> leaks and I can tell you that no memory leak was found, and I personally
> doubt there is one there on regular use. Also, FYI, Drools 5.x eliminates
> the need for shadow facts, what is a considerable memory save over 4.x, but
> adds some other overheads for performance improvement that kind of offset
> those gains. On the other hand, Drools 5.1.1 takes the algorithm to a new
> level, saving a lot of memory on systems that use modify actions on their
> rules.
>
> http://blog.athico.com/2010/03/drools-halves-memory-use-with-new-true.html
>
>Regarding your performance, all I can tell you is that a rules engine is
> a relational engine that works pretty much like a database, and rules as
> databases queries. The same way you can write SQL queries that run fast or
> slow on a database, you can write rules that run fast or slow on a rules
> engine. It all depends on how the rules/queries are written, how your data
> model/domain model looks like, etc.
>
>So, regarding your question, we can't tell you how to improve those
> metrics without knowing your domain model, rules and etc.
>
>[]s
>Edson
>
> 2010/9/17 Nikhil S. Kulkarni 
>
> >  Hi,
> >
> >
> >
> > I have written 2 different Drools programs. One is with
> > Using rule Base of Drools 4.0 and other is using Knowledge Base of Drools
> > 5.0.
> >
> > I was trying to check that is there any improvement in Drools 5.0. But I
> > haven?t got any performance improvement in Drools 5.0 code compared to
> > Drools 4.0.
> >
> >
> >
> > One more important thing is I am calling this drools code
> > from  My application which itself is heavy application, when I am doing
> > Performance tuning
> >
> > I got one point i.e. session.execute() method is taking around 6-7
> seconds
> > to initialize rules and even the memory utilized by Rules is huge.
> >
> >
> >
> > So is there any way that we can reduce the Memory leakage and improve
> > 

Re: [rules-users] Perfromance issues and memory leaks in Drools (Edson Tirelli)

2010-09-18 Thread Nikhil S. Kulkarni
Hi Edson,

Thanks for the information.
But now I want to ask you one thing. I have seen your post. The problem in 
application is mainly usage of memory
You posted that Match 30,2010. I downloaded Drools 5.0 on August 2009 and I am 
using that.

SO this "True modify" algorithm is implemented in Drools 5.1 only or it is even 
available in latest Drools 5.0

If I use Drools 5.1 then Whether I will get any advantage.

In application we are using Rules Template ,Rule Flows and drls. When I 
am calling Rules from Java then it is taking more time compared to calling Java 
method from rules.


In addition to this can u suggest me how to write better rules Query.

I am using very simple way of writing Rules Query like :-

When
Abc : ABC(condition==A)
Then
 Call method
End;



Thanks & Regards,
Nikhil S. Kulkarni





-Original Message-
From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of 
rules-users-requ...@lists.jboss.org
Sent: Friday, September 17, 2010 9:30 PM
To: rules-users@lists.jboss.org
Subject: rules-users Digest, Vol 46, Issue 58

Send rules-users mailing list submissions to
rules-users@lists.jboss.org

To subscribe or unsubscribe via the World Wide Web, visit
https://lists.jboss.org/mailman/listinfo/rules-users
or, via email, send a message with subject or body 'help' to
rules-users-requ...@lists.jboss.org

You can reach the person managing the list at
rules-users-ow...@lists.jboss.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of rules-users digest..."


Today's Topics:

   1. Re: Perfromance issues and memory leaks in Drools (Edson Tirelli)


--

Message: 1
Date: Fri, 17 Sep 2010 11:04:55 -0400
From: Edson Tirelli 
Subject: Re: [rules-users] Perfromance issues and memory leaks in
Drools
To: Rules Users List 
Message-ID:

Content-Type: text/plain; charset="windows-1252"

Nikhil,

Maybe you are using the term "memory leak" loosely here, but otherwise,
Drools 4.0.7 and Drools 5.0.1 were both tested to exhaustion for memory
leaks and I can tell you that no memory leak was found, and I personally
doubt there is one there on regular use. Also, FYI, Drools 5.x eliminates
the need for shadow facts, what is a considerable memory save over 4.x, but
adds some other overheads for performance improvement that kind of offset
those gains. On the other hand, Drools 5.1.1 takes the algorithm to a new
level, saving a lot of memory on systems that use modify actions on their
rules.

http://blog.athico.com/2010/03/drools-halves-memory-use-with-new-true.html

Regarding your performance, all I can tell you is that a rules engine is
a relational engine that works pretty much like a database, and rules as
databases queries. The same way you can write SQL queries that run fast or
slow on a database, you can write rules that run fast or slow on a rules
engine. It all depends on how the rules/queries are written, how your data
model/domain model looks like, etc.

So, regarding your question, we can't tell you how to improve those
metrics without knowing your domain model, rules and etc.

[]s
Edson

2010/9/17 Nikhil S. Kulkarni 

>  Hi,
>
>
>
> I have written 2 different Drools programs. One is with
> Using rule Base of Drools 4.0 and other is using Knowledge Base of Drools
> 5.0.
>
> I was trying to check that is there any improvement in Drools 5.0. But I
> haven?t got any performance improvement in Drools 5.0 code compared to
> Drools 4.0.
>
>
>
> One more important thing is I am calling this drools code
> from  My application which itself is heavy application, when I am doing
> Performance tuning
>
> I got one point i.e. session.execute() method is taking around 6-7 seconds
> to initialize rules and even the memory utilized by Rules is huge.
>
>
>
> So is there any way that we can reduce the Memory leakage and improve
> performance.
>
>
>
> Waiting for Reply.
>
>
>
> Thanks & Regards,
>
> Nikhil S. Kulkarni
>
> Emp No: - 9254
>
>
>
>
>
> MASTEK LTD.
> 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 scanne