Tuesday, April 22, 2014

Engine excution modes Reteplus Sequential Fastpath information ILOG WODM JRules IBM Interview Questions

Engine execution modes JRules supports the RetePlus, sequential, and Fastpath execution modes. The execution mode can impact which rules are fired and in which order. In this section RetePlus 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. Sequential The sequential mode executes all the eligible rules for a given rule task in sequence, which provides specific performance advantages. Fastpath Fastpath is a sequential execution mode that also detects semantic relations between rule tests in the same way as RetePlus. === RetePlus RetePlus, the JRules extension based on the Rete algorithm, is the default execution mode. The RetePlus execution mode provides the means for the rule engine to minimize the number of rules and conditions that need to be evaluated, compute which rules should be executed, and identify in which order these rules should be fired. In RetePlus, the rule engine uses a working memory and an agenda for containing and manipulating application objects. The working memory contains references to the application objects, and the agenda lists and orders the rule instances that are eligible to be fired. The following diagram shows the operation of the RetePlus algorithm. Diagram of the rule engine in RetePlus mode 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 that should be fired. Firing the rule instance executes the rule action. This action modifies the working memory by: Adding a new object to the working memory Removing an object from the working memory Modifying the attributes of an existing object. The process continues cyclically until there are no more rule instances left in the agenda. In RetePlus, whenever the working memory is modified, the rule engine repeats the pattern matching process. It reassesses matches after each rule instance is fired and modifies the data. As a possible consequence, the list of rule instances in the agenda can change. Thus, RetePlus is incremental and data-driven. These execution characteristics give RetePlus superior performance on computation and correlation types of applications. ===== Sequential The sequential execution mode, as its name suggests, causes the rule engine to execute all the eligible rules for a given rule task in a consecutive manner. The following diagram shows the operation of the sequential algorithm. Diagram of the rule engine in sequential mode 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 fired. When a rule instance is fired, it sets the value of an attribute or an output ruleset parameter. Rules that are executed with the sequential algorithm are stateless. The sequential algorithm operates rather like an execution stack where pattern–matching rule instances are executed once with no re-evaluation of the rules. In rules that are executed in sequential mode, you cannot use existence conditions, such as there is at least one, or the number of, in relation to objects in the working memory. However, you can make such conditions refer to a collection of an object in the working memory. Because of its systematic nature, the sequential execution mode performs particularly well on validation and compliance types of applications. Rules can be processed sequentially using rule tasks within a ruleflow (see What is a ruleflow). For the very few cases where the performance of the ruleflow is paramount and the implementation is subject to large memory usage, you can use the provided task-runner API to make a rule task bypass the ruleflow (see Executing a rule task directly). Sequential processing is specified in the algorithm property of the rule task. You can select it explicitly in Rule Studio. See Choosing an execution mode. ===== Fastpath The Fastpath execution mode improves the sequential compilation and execution of a rule project. Fastpath is a sequential mode of execution that also detects semantic relations between rule tests during the pattern matching process, like RetePlus. The following diagram shows the operation of the Fastpath algorithm: Diagram of the rule engine in Fastpath mode The Fastpath algorithm operates as follows: The rule engine uses a working memory that references application objects or ruleset parameters. Fastpath performs the pattern matching process, as in RetePlus, by creating a tree based on semantic relations between rule condition tests. For each match, a rule instance is created and immediately fired. When a rule instance is fired, it modifies objects in working memory, but these modifications are not taken into account and the rule engine does not repeat the pattern matching process. The action of the fired rule also sets an output ruleset parameter. Fastpath combines features of the RetePlus mode for pattern matching and features of the sequential mode for rule firing. In this sense, it compares well for correlation types of applications as well as for validation and compliance applications. Like the sequential mode, the Fastpath mode is a stateless mode. As such, it is dedicated to matching objects against a very large number of rules that individually perform simple discriminations or light join tests. It is best for very large number of rules to be fired in sequence directly without any agenda support. In addition to its advantages as a variant of the sequential mode, the Fastpath execution mode is designed to further optimize the execution of the compliance and validation rules, which constitute a substantial part of business rules. ======

No comments: