[rules-users] Strange Performance Problem in Rules

Swindells, Thomas TSwindells at nds.com
Tue Oct 19 08:40:20 EDT 2010


These don't do the same thing do they?
In option 1:
You have a list of ProcessResults which have been filtered to match "table1" (so presumably a relatively small list).
You have a list of ProcessResults which have been filtered to match "table2" (so presumably a relatively small list). You then restrict this list to not have an inputSource which matches the inputSource of processResult1 (this may be completely optimized away as we know that "table1" != "table2" already.
You then have a list of Rules constrained by rulename.
You will basically get every combination of
(Rule(name="somerulename"), ProcessResult(inputSource="table1"), ProcessResult(inputSource="table2")).

In option 2:
You get the list of rules.
For every processResult1 and processResult2 (the complete set as they aren't limited at this stage) you compare it against the list of rules to see if there inputSource matches. This produces pairs of processResults. You then filter this list of pair to remove every combination that has the same inputSource as the processData1 this will be all of them as they both have an inputSource of rule.inputSource.

Thomas

> -----Original Message-----
> From: rules-users-bounces at lists.jboss.org [mailto:rules-users-
> bounces at lists.jboss.org] On Behalf Of ravibhatt
> Sent: 19 October 2010 13:24
> To: rules-users at lists.jboss.org
> Subject: Re: [rules-users] Strange Performance Problem in Rules
>
>
> Hi Wolfgang Laun-2,
>
> i continue to have problems with performance of this rule.
>
> I made few more observations:
>
> if i write the rule like this (notice hardcoded tbale name in input source
> comparision), it runs fast.
>
>           $project:Project(status==Status.DATA_FETCHED)
>           $rule:Rule(name=="somerulename")
>
>           $processResult1:ProcessResult(projectId == $project.projectId
>            ,inputSource == "table1",outputTable=="" )
>           $processResult2:ProcessResult(projectId == $project.projectId
>              ,inputSource == "table2"
>              ,inputSource != $processResult1.inputSource,outputTable=="")
>
>           $processData1:ProcessData(parent==$processResult1)
>         $processData2:ProcessData(parent==$processResult2
>             ,eval($processData2.getValue(SomeEnum.toString())
>                 .equals($processData1.getValue(
>                     SomeEnum.toString())))
>             ,eval($processData2.getValue(SomeEnum.toString())
>                 .equals($processData1.getValue(
>                    SomeEnum.toString())))
>             )
>
>
> Now if i write my rule like this, it becomes dead slow.
>
>  $project:Project(status==Status.DATA_FETCHED)
>           $rule:Rule(name=="somerulename")
>
>           $processResult1:ProcessResult(projectId == $project.projectId
>            ,inputSource == $rule.inputSource,outputTable=="" )
>           $processResult2:ProcessResult(projectId == $project.projectId
>              ,inputSource == $rule.inputSource
>              ,inputSource != $processResult1.inputSource,outputTable=="")
>
>           $processData1:ProcessData(parent==$processResult1)
>         $processData2:ProcessData(parent==$processResult2
>             ,eval($processData2.getValue(SomeEnum.toString())
>                 .equals($processData1.getValue(
>                     SomeEnum.toString())))
>             ,eval($processData2.getValue(SomeEnum.toString())
>                 .equals($processData1.getValue(
>                    SomeEnum.toString())))
>             )
>
>
> Can anyone please help me here?
>
> Thanks!
> Ravi
> --
> View this message in context: http://drools-java-rules-
> engine.46999.n3.nabble.com/Strange-Performance-Problem-in-Rules-
> tp1728527p1731893.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users


**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster at nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
**************************************************************************************




More information about the rules-users mailing list