RetePlus Mode:
The default execution mode is RetePlus. Use its optimization techniques to improve performance: reduction of the number of rules and conditions, computation of the rules to execute, and prioritization of the rule order. The RetePlus algorithm operates as follows:- The rule engine matches the conditions of the rules in the ruleset against the objects in working memory. During the pattern matching process, RetePlus creates a network based on semantic relationships between rule condition tests.
- For each match, a rule instance is created and put into the agenda. Then the agenda, based on some ordering principles, selects the rule instance to be executed.
- When the rule instance is executed, the rule action is executed.
This action modifies the working memory in the following ways:
- By adding a new object to the working memory
- By removing an object from the working memory
- By modifying the attributes of an existing object. - The process carries on cyclically until no more rule instances are left in the agenda
Sequential Mode:
The sequential mode executes all the eligible rules for a given rule task in sequence, which provides specific performance advantages. The sequential algorithm operates as follows:- The rule engine performs pattern matching on input ruleset parameters and on the conditions defined on the collections of objects in working memory.
- For each match, a rule instance is created and immediately executed. When a rule instance is executed, it sets the value of an attribute or an output ruleset parameter.
Input/output objects can be passed in to the rule engine as ruleset parameters or rules can create and manipulate in-memory objects.
Simple three rules were implemented to compare ruleset execution times for permutations of two execution algorithms and two ways of passing in input objects to the rule engine. Each of the three rules is in a separate ruletask in the ruleflow. Execution times are machine-dependent and therefore, execution time comparison of different algorithms is meaningful only relative to each other. Note that in-memory objects can only run RetePlus. Below is the execution times chart for the following cases:
- Using input parameters and RetePlus algorithm
- Using input parameters and Sequential algorithm
- Using in memory objects and RetePlus algorithm
Input Size
|
Using Parameters and
RetePlus Algorithm
|
Using Parameters and
Sequential Algorithm
(time in seconds)
|
Using in Memory Objects and
RetePlus Algorithm
(time in seconds)
|
Fired |
1000
|
3
|
3
|
3
|
400
|
2000
|
6
|
6
|
6
|
800
|
3000
|
11
|
11
|
11
|
1200
|
4000
|
16
|
16
|
17
|
1600
|
5000
|
24
|
23
|
24
|
2000
|
6000
|
32
|
31
|
32
|
2400
|
7000
|
43
|
43
|
44
|
2800
|
8000
|
53
|
53
|
58
|
3200
|
9000
|
65
|
66
|
72
|
3600
|
To improve the performance of RetePlus algorithm you can do one of the following: (Click here for details)
- Optimize the object model
- Optimize with optimize method
- Optimize with static agenda
- Activate dynamic rule compilation
- Improve the performance of equality and/or comparison evaluation
To improve the performance of Sequential algorithm you can try:
- Memory consumption reduction