IBM Support

User Defined Function efficiency

Question & Answer


Question

Which is more efficient: using User Defined Functions or a fall through script Policy style?

Cause

Using a User Defined Function to perform simple tasks or a task only called once from within the Policy or a Function Library Policy for User Defined Functions that are only called from one Policy is inefficient and has the potential to incur unnecessary load upon the ImpactServer.

Answer

User Defined Functions (UDFs) are intended to provide a single point of maintenance for complex Policy routines that are called from multiple places within the Policy. And Function Library Policies are intended to also provide a single point of maintenance for complex Policy routines that are called from multiple Policies. They are a compromise between efficiency of maintenance and efficiency of processing. Calling a UDF is less efficient than employing a simple "fall through" style Policy script and multiple recursive function calls can significantly dig into the stack.


A bit of history:

When Impact moved from version 2 to 3 the Policy design moved from being a graphical flowchart "Action Node Tree" (.ant) to the current script style "Impact Policy Language" (.ipl) and Impact 3 offered an upgrade tool that converted .ant to .ipl. The trouble was that this performed a rather simplistic, best-effort conversion whereby each Action Node in the Impact 2 Policy was made into a UDF in Impact 3 and the branches between Action Nodes became function calls.

Shortly after Impact 3 was released there were a large number of cases where Impact 3 experienced stack overflow and memory issues. This was found to be due to the very large number of UDFs inherently created by the Impact 3 upgrade tool in the migrated Policies and recursive function calls from these dug into the stack so much as to cause ImpactServer crashes. Getting the message out that the upgrade tool was only a first step in converting the Impact 2 Policies took quite a while and this issue was still common up until Impact 5.

Recently there seems to be an increase in the number of Policies being written in a C language style: declaring variables, defining functions and then running the main portion of the Policy as a series of function calls. This TechNote is an attempt to get the message back out there that this is not the most efficient method. Designing a "fall through" style Policy script is much more efficient and one should only use UDFs where one can show significant maintenance efficiency for a complex Policy routine that is called multiple times.

Internal Use Only

This technote was generated by Technote Kickstart 1.1.0.97 based off of Tivoli Customer Support PMR 65708,821,821.
View the associated PMR's text via Wellspring at: http://eclient.lenexa.ibm.com:9082/DocFetcher/source/PMR/65708.821.821%20O16/04/27

[{"Product":{"code":"SSSHYH","label":"Tivoli Netcool\/Impact"},"Business Unit":{"code":"BU004","label":"Hybrid Cloud"},"Component":"Netcool\/Impact","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"6.1;6.1.1;7.1.0","Edition":""}]

Document Information

Modified date:
17 June 2018

UID

swg21982326