Question on optimizing strategies whitelist functions in Customer Decision Hub
We are planning to optimize the Strategies we have built already in PEGA8 version. We are planning to optimize the non-optimized components in an existing strategies to improve the performance of the Decisioning application (few components which can't be refactored). We have gone through the article Optimizing Strategies with Whitelist function.
My question is, what does pega do internally when we add a function to the whitelist functions list to mark Strategy components optimized & how does it improve the Strategy performance? Has anyone tried with the similar changes ?
I tried to provide some details regarding Function whitelisting in strategy optimization.
Ever since the release of Pega 8.1, the decision strategy rule runs on a new execution engine that aims to perform better by executing the strategy logic in a more optimized way. The underly technology for performing these optimizations is a well-known technique called Static Single Assignments or SSA.
The 8.1 release has come with 200 white-listed function out of the box. This list is available in a data transform rule called pxWhitelistFunction under the Pega-DecisionEngine ruleset. This can be extended by adding more functions to a data transform called pyWhitelistFunction to any effective application ruleset. The pxWhitelistFunction can be consulted to see how this data transform should be populated.
The SSA engine treats function applications as “pure”, meaning they are assumed not to have any side effect. For instance, if there is a function called multiply(int x, int y)which multiplies two integers x and y and returns the result as the function’s value, then it’s considered pure if that’s all the function does and no matter how many times this function is called on a given set of arguments, say x=5 and y=6, the effect is always the same. If the implementation of multiply did something else that counted as side-effect, e.g. stored something in a database, then this function could not be whitelisted. Lack of side effect is a necessary condition for correct optimizations as the SSA engine avoids redoing computations that have already been performed.
To add a new white list function, it is the strategy designer's responsponsibility to ensure that:
The parameters and return type of the function should be either String, BigDecimal, java.util.Date, double, Double, int, Integer, Boolean or boolean.
There should be no PublicAPI involved in the body of the function
There should be no manipulations on the StepPage in the body of the function
I could also add this to Venkat's great response that if you have functions that take an entire clipboard page and then work with a few its properties, it is highly recommended that you change the function (or create a new one) that takes individual scalar values it actually needs and then pass properties to the function in your expressions. For instance if there is an RUF that (conceptually) looks like this: