[rules-users] Strange Performance Problem in Rules

Wolfgang Laun wolfgang.laun at gmail.com
Tue Oct 19 02:54:33 EDT 2010


One simple observation:
   $processResult2 : ProcessResult(...
                    inputSource != $processResult1.inputSource,
                    this != $processresult1,... )
The test using this is redundant, since different inputSource implies
that the containing object is not identical.

Another one:
   $processData2:ProcessData(this!=$processData1,parent==$processResult2,...
The test using this is redundant, because in a strictly hierarchical
tree-like data set different parent objects implies different
children.

But I suspect that the pair of eval() calls is the culprit. How does
getValue(String s) rerieve values? Sequential search is bound to be
bad.

Certainly, doing s1.toUpperCase().equals( s2.toUpperCase() ) millions
of times is bound to waste time. (Insert a static counter and see how
often it is called.) Consider converting the strings to upper case,
once, upon object insertion.

-W

On 18 October 2010 23:40, ravibhatt <ravi at qubitdigital.com> wrote:
>
> Hi all,
>
> I have a rule that looks like below:
>
> Rule "CheckSomeConditionRule"
>
> When
>
> $project:Project(status==STATUS_ENUM.DATA_FETCHED)
> $rule:Rule(name=="CheckSomeConditionRule")
>
> $processResult1:ProcessResult(projectId==$project.id, inputSource memberOf
> $rule.inputTableList
>                      , outputTable=="")
>
> $processResult2:ProcessResult(projectId==$project.id, inputSource memberOf
> $rule.inputTableList
>                      inputSource!=$processResult1.inputSource,
> this!=$processresult1, outputTable=="")
>
> $processData1:ProcessData(parent==$processResult1)
>
> $processData2:ProcessData(this!=$processData1,parent==$processResult2
>
> ,eval($processData2.getValue("a").equalsIgnoreCase($processData1.getValue("a")))
>
> ,eval($processData2.getValue("b").equalsIgnoreCase($processData1.getValue("b")))
>
>
> Then
>     /////do important stuff here
> end
>
> I am trying to run this rule with two data set (represented by ProcessResult
> class that holds several rows in terms of ProcessData objects), each data
> set has 10000 records only. (In real usages, we will have atleast a million
> records in both these data sets.)
>
> I am inserting all of the rows i.e all rows represented in terms of
> ProcessData objects. I am inserting some 20000+ objects to test this. While
> inserting, first 10000 records are getting inserted fairly quickly, the next
> 10000 records are taking a lot of time.. in tunes of 15 -30 mins.
>
> I understand that drools is trying to create activations as i insert facts
> but this seems to be too slow. is it eval in my conditions that is making it
> slower? or is it equalsIgnoreCase method? if i use == instead of
> equalsIgnoreCase my rule never gets fired.
>
> I am doing something wrong? please advice.
>
> My data structure is inherently hierarchical:
>
>  ProcessResult (represnts a table)
>     contains
>        ProcessData (represents rows)
>           contains
>              list of Dimensions & list of Metrics (accessed via getValue()
> method above)
>
>
> Thanks in Advance,
> Ravi
>
> --
> View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Strange-Performance-Problem-in-Rules-tp1728527p1728527.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
>




More information about the rules-users mailing list