Thread Monitor Yaml Config File
Thread Monitor Yaml Config File
The Thead Monitor tool gathers thread dumps and Javacores at a configured interval, and during
events such as high WebContainer/Default_Executor pool thread usage. Yaml configuration file
must exist with name /SETUP/support/thread_monitor.yaml, or under the location specified with
the THREAD_MONITOR_CFG environment variable.
The Yaml file is loaded during startup, and scanned for changes every minute. If the Yaml file is
not readable during startup, no further attempts are made to load it during runtime.
archiving:
o delayedZipNum: when doing realtime debugging, it is useful to read dumps as
threaddumps:
include: used to filter the threads that are saved to the threaddump file. Only thread
names that start with the specified strings will be logged include:
o WebContainer
o Default Executor
o main
o pool
o redisson
triggers:
o interval: enables periodic collection of dumps. Value is in seconds. Interval:
30
pool usage. The pool usage is evaluated when the monitor API triggers. When
using prometheus, the default scrape interval is 15 seconds.
o inUseLargerThan: trigger a dump when the number of active (not idle) threads is
available in the thread pool is low, it can be preferred to collect Javacores instead
of Threaddumps as they have more information format: javacore.
Timing is a major factor when diagnosing issues using Javacores and thread dumps. Thread
dumps must be collected at the exact time when the server is experiencing performance issues.
Some events are sporadic and short in duration, which makes the collection difficult. Often, by
the time a problem is detected and a manual dump is collected, the problem has passed.
The Thread Monitor tool automates thread dump collection. It offers options for the format,
frequency and triggering of dumps. It integrates with the metrics framework to enable automatic
dump generation when certain thresholds, such as number of threads in use, are reached. With
this configuration, the Thread Monitor can automatically trigger the collection of dumps during
spikes or slowdowns.
The trigger, which is based on the number of threads in use, requires metrics to be enabled
in values.yaml.
The Thread Monitor tool is configured with the following YAML file which is available in the
Transaction Server, QueryApp, Solr Search and CRS containers. The configurations include
format (i.e. Thread dump or Javacore), archiving, and threshold triggers.
/SETUP/support/thread_monitor.yaml
It is configured to collect dumps in "thread dump" format (a HCL custom format), when the
number of threads in use in the Default Executor/ Web Container pool exceeds a threshold value
of 20. It will collect a maximum of 10 dumps per hour. These configurations can be updated to
better match the scenario you are debugging.
The Thread Monitor can also be enabled and disabled from vault by configuring the environment
variable as follows:
${TENANT}/${ENVIRONMENT}/${ENVTYPE}/threadMonitorEnable/${component_name}:
value=true
ThreadAnalyzer utility
The Thread Monitor tool generates Javacores or thread dumps in the directory specified by
the DUMP_DIR environment variable. The ThreadAnalyzer utility can be used to facilitate the
analysis. This is particularly helpful when dozens or hundreds of dumps are created. Manual
review can be time consuming.
The tool is available in the containers that enable the Thread Monitor. It can be found at the
following path: /SETUP/support/thread-analyzer.jar.
Available reports:
- Top Web Frames (tw): Reports the stacks most frequently found in threads
- Base Web Activity (ba): Summary of total base activities
- Web Activity (wa): Lists the discovered activity for each tread
Note: WARNING: When executed within the container, this utility takes CPU and memory
resources. The amount will vary depending on the number of dumps processed. For production
environments, it is recommended to use this utility outside the container. Using -Xmx to limit
memory usage is also highly recommended.
The ThreadAnalyzer tool generates reports such as "Base Web Activity" and "Web Activity " that
rely on logic to "discover" key activites from a stack. The configuration is generally based on
applying RegEx patterns to stack frames, and to look for certain known classes and methods.
The following example attaches DB2 activity to a stack with frames that include the
package com.ibm.db2.jcc:
- activity: DB2
startsWith: com.ibm.db2.jcc
consumePrevious: true
Use the -x argument to print the default configuration to the screen. The YAML output can
be redirected to a file for editing:
ThreadAnalyzer reports
The "Base Web Activity" report summarizes activity for each thread dump or Javacore. It
includes the time of the dump, the file name, the total number of non-idle threads, and the base
activities found. This report is useful to get a high level perspective of problem areas and to
identify timeframes, which typically show the most busy threads.
The "Top Web Frames" report lists the most frequent stack frames for all the dumps found.
Percentages in excess of 100% mean the stack was found multiple times on a single thread.
The report allows for configurations (using --extract-config and --config) as follows:
report:
...
topWebFrames:
minPercentage: 5
excluded:
- com.ibm.ws.
- org.springframework.
- javax.
- java.
- org.apache.wink.
- com.ibm.io.