IBM Support

Making sure that the cached ruleset that is created by the loadUptodateRuleset method is used

Question & Answer


Question

Why does the rule invocation not reuse the ruleset cache? How to develop an application which warms up rulesets? I have a web application that uses the loadUptodateRuleset method to warm up rulesets. Another Java EE component calls the rules for execution. But this application does not use the ruleset in the cache. Instead, another ruleset of the same version is parsed and used at run time.

Cause

Each engine that is used to execute a ruleset is linked to a given XOM class loader. You cannot reuse an engine that is linked to a different XOM class loader.
This means that the ruleset must be loaded with the same XOM class loader as the one used for execution.

When a web application is used to warm up rulesets, the ruleset is created with the XOM class loader of that web application. Then, if another application executes the same ruleset, the ruleset in the cache cannot be reused because it has a different XOM class loader.

Answer

To reuse the ruleset in the cache, the Java EE component or application that executes the rulesets must be the same as the one that preloads the ruleset or at least must have the same class loader in the context of the current thread.

You must set the maxIdle ruleset property to the appropriate value because the loadUptodateRuleset method only requests the XU to load the ruleset and does nothing else. In particular, it does not force the XU to keep the ruleset indefinitely in the cache. The ruleset might get unloaded before the next request.

To be sure that the ruleset is kept and loaded before any execution, you must both call the loadUptodateRuleset method, set the maxIdle property, and enable the property for XU ruleset usage monitoring.

  1. You can set the maxIdleTime in two ways. See the documentation at
    >> IBM Operational Decision Manager 8.5.0>Operational Decision Manager V8.5>Decision Server Rules>Reference>Rule Execution Server reference > Predefined ruleset and RuleApp properties
    For example, maxIdleTime =0
  2. To turn on the property for ruleset usage monitoring, use the WebSphere Application Server (WAS) administration console. See the documentation at
    >> IBM Operational Decision Manager 8.5.0>Operational Decision Manager V8.5>Decision Server Rules>Managing business rule execution in Rule Execution Server>Configuring a Rule Execution Server instance>Changing the default behavior of the execution stack> Enabling ruleset monitoring

Demo

To illustrate how rulesets are warmed and called for parsing and execution, download the RulesetCacheSample-miniloan-server-webapp.zip web application and the miniloan rule project (RuleSample-miniloan.zip) that works with ODM V8.5 sample server.

  1. Import the miniloan-rule project, miniloan-xom project, and miniloan-ruleapp project into a clean Rule Designer workspace.
  2. Deploy the miniloan-ruleapp to Rule Execution Server if it does not contain the sample RuleApp. Make sure that the XOM is deployed, too.

The web application sample is a modified version of the application used in the Getting Started. The RulesetWarmup.java Java class and the two input.jsp and createruleset.jsp files have been added to demonstrate ruleset warming.
  1. Rename or back up the original application. You can find it in this directory:<ODM85>\gettingstarted\DecisionServer\start\miniloan-server-webapp
  2. Extract the modified miniloan-server-webapp from RulesetCacheSample-miniloan-server-webapp.zip to the <ODM85>\gettingstarted\DecisionServer\start\ directory. Replace the original one.
  3. Uninstall the existing miniloan-server application from the ODM sample server. Use the WAS administration console.
  4. Configure JAVA_HOME and ANT_HOME in check-env.cmd to suit your environment. It is recommended that you use the JDK and Ant tool that are provided with the ODM installation.
  5. Start the ODM sample server if it is not already running.
  6. Run install.cmd to package the miniloan-server-webapp as an EAR file and to install the EAR file to the sample server. At the end of the process, the following status message should be logged in the DOS console:
    [exec]   [wsadmin] GBRPS0017I: miniloan-server-webapp was successfully installed.
    [exec]
    [exec] BUILD SUCCESSFUL
    [exec] Total time: 20 seconds
    [echo] Application ready.
  7. Access the sample at this URL: http://localhost:/miniloan-server/input.jsp
  8. Submit the ruleset (/miniloanruleapp/miniloanrules) for ruleset warming.
    The next page tells you that the ruleset cache is created.
    The page is redirected to the main page, which shows the prepopulated values for miniloan validation.
  9. Make sure that the checkbox Use Rules is selected.
  10. Validate the loan application, which will call the rules.

[{"Product":{"code":"SSQP76","label":"IBM Operational Decision Manager"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Modules:Execution Server","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"7.5;8.0;8.0.1;8.5","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
23 July 2021

UID

swg21668133