Short lifespan threads and tasks

Collection Services captures performance data for every job, task, and secondary thread that used processor time during a sample interval. This data is reported via records in the QAPMJOBMI file.

There are times when secondary threads and tasks are created that do very little work and terminate quickly; lifespans are generally less than one second. This can be a problem when it happens frequently and is on-going. It can significantly increase the size of collection objects and QAPMJOBMI file members. It also results in increased CPU utilization to capture data and generate the files as well as more resource being used by tools that consume this data.

Although resources consumed within a specific short lifespan thread or task is not significant, they as a group, can be a significant factor in total system utilization. Consequently, they cannot simply be ignored.

Beginning in IBM® i 7.1, Collection Services will accumulate data for tasks and secondary threads whose lifespan is less than a specific threshold. Short lifespan secondary threads will be accumulated by job for any job that has such threads. Short lifespan tasks are accumulated by processor node. This accumulated data will be reported at sample time similar to how other tasks or secondary threads are reported.

The QAPMJOBMI file has a new field "Short lifespan entry count". This field will have a value that is greater than zero for records that contain data for short lifespan threads or tasks. Its value is the number of such entities that were accumulated within the interval for the indicated job or node. The QAPMCONF file reports the short lifespan thresholds used during collection. See the description for GKEY = "F1" in the QAPMCONF article.

By default the threshold that will be used for both tasks and threads is 1000 milliseconds (terminating threads and tasks whose lifespans are less than 1000 milliseconds will not be individually reported). Should there be a need to disable this processing or you want different thresholds, environment variables can be used to accomplish that:
  • Variable QPM_TASK_SL_THRESHOLD can be created to control short lifespan task processing
  • Variable QPM_THREAD_SL_THRESHOLD can be created to control short lifespan secondary thread processing

The value associated with the environment variable is the threshold in milliseconds that should be applied. A value of 0 or null will cause all threads or tasks to be reported. You must create these environment variables as system level variables so that Collection Services collector job, QYPSPFRCOL, will see them. The values are obtained only once at the start of a collection; you must cycle an active collection after making changes for the new values to be used.

The following is an example of creating the environment variables and setting the default value of 1000 milliseconds:
  • ADDENVVAR ENVVAR(QPM_TASK_SL_THRESHOLD) VALUE(1000) LEVEL(*SYS)
  • ADDENVVAR ENVVAR(QPM_THREAD_SL_THRESHOLD) VALUE(1000) LEVEL(*SYS)