Skip to content

3.1. Session Monitoring

What You Watch in Production

With OPENMARU Cluster applied, sessions move out of the WAS into the data grid. What you need to watch day to day changes accordingly.

What you want to knowWhere the answer comes from
How many users are connected right nowActive session count metric
Whether traffic is rising or fallingSession creation and destruction rates per second
How much memory sessions useSession memory usage metric
What a particular user's session holdsSession attribute lookup
Whether duplicate logins are actually happeningDuplicate login count metric
Whether sessions are the cause of slow responsesTrend in session count and memory usage

All of these values are exposed as MBeans. No separate console or agent has to be installed.

What to Do When the Session Count Grows

When sessions grow and the data grid runs short, add data grid nodes. The WAS is left alone. For the sizing criteria, see "How Many Data Grid Nodes to Deploy" in Part 1.

Adding or removing WAS instances can be done independently of sessions. Because sessions live outside the WAS, restarting instances does not affect users.

Diagnostic Order When Something Goes Wrong

SymptomMetric to look at firstWhat it means
Users keep getting logged outActive session count, destruction countA sharp rise in the destruction count points to the timeout setting or the store connection
Responses are slowSession memory usageA large individual session means more data travels on every request
Low memory warningsSession memory usage, active session countCheck whether large objects are being placed in the session
One account is used from several placesDuplicate login countA rising value suggests account sharing
Only one instance is slowActive session count per instanceA value skewed to one side points to the load balancer configuration

What MBean Monitoring Is

An MBean (Managed Bean) is the standard way a Java application reports its own state to the outside. It is part of the Java standard called JMX (Java Management Extensions), and the WAS itself reports thread counts and memory usage the same way.

OPENMARU Cluster registers session metrics as MBeans. As a result, any tool that can read JMX can see the values, and there is no need to build a separate API.

Checking That It Is On

Metrics are turned on and off with the enableStatistics setting. The default is true, so they are on without any configuration. See "Turning On Metric Collection" in Part 2.

Memory usage is the one exception. Measuring it requires a Java agent, so it is off by default; you must turn on enableMemoryStatistics and add the WAS startup option for values to appear.

Where It Is Registered

One MBean is registered per application. The name is as follows.

com.opennaru.khan.session:type=SessionMonitor,appName=<application name>

appName is that application's context path. If it is deployed at the root context (/), ROOT is used. If a WAS hosts several applications, you see that many MBeans.