Skip to content

2.6. Turning On Metric Collection

Turning On Session Metrics

You can see how many sessions exist right now, and how many are created and destroyed, through the WAS MBeans. Part 3 explains how to view them.

This feature is on by default. Metrics are produced without any configuration. We recommend leaving it on in production — when a problem occurs, it lets you first determine whether sessions are the cause.

To turn it off, set false.

<init-param>
<param-name>enableStatistics</param-name>
<param-value>false</param-value>
</init-param>

Viewing Session Memory Usage

Add this setting to see how much memory a single session uses. It is not needed for everyday operation — it is for finding the cause when sessions are larger than expected or memory is short.

Measuring the size requires attaching an object-sizing library (jamm) as a Java agent, so the WAS startup options have to be changed as well.

JBoss EAP requires the setting below (other WAS products do not). Its module system blocks external packages, and this setting opens an exception for them.

export JAVA_OPTS=" $JAVA_OPTS -Djboss.modules.system.pkgs=org.jboss.byteman,org.github.jamm"

Setting the javaagent Option

Attach the measurement library (jamm) as a Java agent. This file is provided together with the product libraries. Replace /PATH_TO_JAMM_JAR with the actual path where you placed it.

export JAVA_OPTS=" $JAVA_OPTS -javaagent:/PATH_TO_JAMM_JAR/jamm-0.2.5.jar"

Enabling Memory Monitoring

Once the startup option is in place, turn the feature on in the filter settings. When it is on, a memory usage entry appears in the MBeans described in Part 3.

<init-param>
<param-name>enableMemoryStatistics</param-name>
<param-value>true</param-value>
</init-param>