hasMessages API call in recalculateAndSave increases CPU usage
The recursive nature of hasMessages API negatively impacts CPU usage, response time and scalability in the application. HFix-22496 is installed which adds logic to bypass some expensive processing into utility function hasMessages. The out-of-the-box final Activity, Work-RecalculateAndSave, step 5, triggers hasmessage processing directly through API.
In unit tests, it is observed that .75 CPU seconds is spent in this single Activity step.
After a private checkout and applying the logic from HFix-22496 into this Activity, time and CPU cost was reduced by 66% (to .25 seconds).
Steps to Reproduce
Traces taken during Wrap-Up display high CPU cost.
The root cause of this issue was the explicit call to hasMessages() API taking more time because of auto-populate chaining.
This issue is resolved by HFix-22869 which has changes in Work-RecalculateAndSave Activity disabling auto-populate while calling hasMessages() and restoring the previous value again.
0% found this useful