|
An operational XVM continuously collects raw statistics during the course of its operation. The xvm can also be configured to spin up a background thread that periodically performs the following:
The raw metrics collected by the server are used by the background statistical thread for its computations and can also be retrieved programmatically by an application for its own use.
In this document, we describe:
Heartbeats for an XVM can be enabled via DDL XML using the <heartbeats> element:
<servers> <server name="my-xvm"> <heartbeats enabled="true" interval="5"> <collectNonZGStats>true</collectNonZGStats> <collectIndividualThreadStats>true</collectIndividualThreadStats> <collectPoolStats>true</collectPoolStats> <poolDepletionThreshold>1.0</poolDepletionThreshold> <collectSeriesStats>true</collectSeriesStats> <collectSeriesDatapoints>false</collectSeriesDatapoints> <maxTrackableSeriesValue>100000000</maxTrackableSeriesValue> <logging enabled="true"></logging> <tracing enabled="true"></tracing> </heartbeats> </server> </servers> |
Configuration Setting | Default | Description | |
---|---|---|---|
enabled | false | Enable or disable server stats collection and heartbeat emission.
| |
interval | 1000 | The interval in seconds at which server stats will be collected and emitted. | |
collectNonZGStats | true | Some statistics collected by the stats collection thread require creating a small amount of garbage. This can be set to false to supress collection of these stats. | |
collectIndividualThreadStats | true | Indicates whether heartbeats will contains stats for each active thread in the JVM. Individual thread stats are useful | |
collectSeriesStats | true | Indicates whether or not series stats should be included in heartbeats. | |
collectSeriesDatapoints | false | Indicates whether or not series stats should report the data points captured for a series statistic.
| |
maxTrackableSeriesValue | 10 minutes | The maximum value (in microseconds) that can be tracked for reported series histogram timings. Datapoints above this value will be downsampled to this value, but will be reflected in the max value reported in an interval. | |
collectPoolStats | true | Indicates whether or not pool stats are collected by the server when nv.server.stats.enable=true. | |
poolDepletionThreshold | 1.0 | Configuration property used to set the percentage decrement at which a preallocated pool must drop to be included in a server heartbeat. Setting this to a value greater than 100 or less than or equal to 0 disables depletion threshold reporting. This gives monitoring applications advanced warning if it looks like a preallocated pool may soon be exhausted. By default the depletion threshold is set to trigger inclusion in heartbeats at every 1% depletion of the preallocated count. This can be changed by specifying the configuration property nv.server.stats.pool.depletionThreshold to a float value between 0 and 100. For example: Setting this to a value greater than 100 or less than or equal to 0 disables depletion threshold reporting.
| |
logging | false | Configures binary logging of heartbeats. Binary heartbeat logging provides a means by which heartbeat data can be captured in a zero garbage fashion. Collection of such heartbeats can be useful in diagnosing performance issues in running apps. | |
tracing | false | Configures trace logging of heartbeats. Binary heartbeat logging provides a means by which heartbeat data can be captured in a zero garbage fashion. Collection of such heartbeats can be useful in diagnosing performance issues in running apps. |
An XVM collects stats that are enabled for the applications that it contains. The followings stats can be enabled and reported in heartbeats
<env> <!-- global stats properties --> <nv> <stats.latencymanager.samplesize>65536</stats.latencymanager.samplesize> <msg.latency.stats>true</msg.latency.stats> <ods.latency.stats>true</ods.latency.stats> <link.network.stampiots>true</link.network.stampiots> </nv> </env> |
Environment Prop | Description |
---|---|
nv.stats.latencymanager.samplesize | The global default size used for capturing latencies. Latency stats are collected in a ring buffer which is sampled by the stats thread at each collection interval.
|
nv.msg.latency.stats | This global property instructs the platform to collect latency statistics for messages passing through various points in the process pipeline.
|
nv.ods.latency.stats | Globally enables collection of application store latencies. |
nv.link.network.stampiots | Instructs low level socket I/O stamp input/output times on written data.
|
The xvm statistics thread will collect the following latency stats from the apps it contains when they are enabled
<apps> <app name="my-app" ...> <captureTransactionLatencyStats>true</captureTransactionLatencyStats> <captureEventLatencyStats>true</captureEventLatencyStats> <captureMessageTypeStats>false</captureMessageTypeStats> </app> </apps> |
Per message type latency stats are not currently emitted in heartbeats due to concerns over the size they would contribute to heartbeats. Instead, they can be traced using the aep engine stats thread.
See Also:
When heartbeats are enabled they can be consumed or emitted in several ways, discussed below.
By default all server statistics tracers are disabled as trace logging is not zero garbage and introduces cpu overhead in computing statistics. While tracing heartbeats isn't recommended in production, enabling server statistics trace output can be useful for debugging and performance tuning. To enable you will need to configure the appropriate tracers at the debug level. See the Output Trace Loggers section for more detail.
<servers> <server name="my-xvm"> <heartbeats enabled="true" interval="5"> <logging enabled="true"></logging> <tracing enabled="true"></tracing> </heartbeats> </server> </servers> |
Applications that are latency sensitive might prefer to leave all tracers disabled to avoid unnecessary allocations and the associated GC activity. As an alternative, it's possible to enable logging of zero-garbage heartbeat messages to a binary transaction log:
<servers> <server name="my-xvm"> <heartbeats enabled="true" interval="5"> <logging enabled="true"> <storeRoot>/path/to/heartbeat/log/directory</storeRoot> </logging> </heartbeats> </server> </servers> |
Heartbeat logs can be queried and traced out of process using the Stats Dump Tool.
Note that at this time binary heartbeat logs do not support rolling collection. Consequently this mechanism is not suitable for long running application instances.
See Also:
Your application can register an event handler for server heartbeats to handle them in process.
@EventHandler public void onHeartbeat(SrvMonHeartbeatMessage message) { // Your logic here: // - You could emit over an SMA message bus. // - log to a time series database. // etc, etc. } |
See the SrvMonHeartbeatMessage JavaDoc for API details.
A Lumino or Robin controller can also be used to connect to a server via a direct admin connection over TCP to listen for heartbeats for monitoring purposes. The XVMs stats thread will queue copies of each emitted heartbeats to each connected admin client.
When heartbeat tracing is enabled heartbeat trace is emitted to the nv.server.heartbeat
logger at a level of info
. This section discussed the output format of heartbeats.
See Also:
Appears in trace output when nv.server.stats.enable=true and nv.server.stats.sys.trace=debug
<servers> <server name="my-xvm"> <heartbeats enabled="true" interval="5"> <tracing enabled="true"> <traceSysStats>true</traceSysStats> </tracing> </heartbeats> </server> </server> |
|
Individual thread stats can be traced by setting the following in DDL:
<servers> <server name="my-xvm"> <heartbeats enabled="true" interval="5"> <collectIndividualThreadStats>true</collectIndividualThreadStats> <tracing enabled="true"> <traceThreadStats>true</traceThreadStats> </tracing> </heartbeats> </server> </server> |
When enabled the following stats are traced to the console.
|
Where columns can be interpreted as:
Column | Description |
---|---|
ID | The thread's id |
CPU | The total amount of time in nanoseconds that the thread has executed (as reported by the JMX thread bean) |
DCPU | The amount of time that the thread has executed in user mode or system mode (as reported by the JMX thread bean) |
DUSER | The amount of time that the thread has executed in user mode in the given interval in nanoseconds (as reported by the JMX thread bean) |
CPU% | The percentage of cpu time the thread used during the interval (e.g. DCPU * 100 / interval time) |
USER% | The percentage of execution in user mode e.g. (e.g. DUSER * 100 / DCPU. |
STATE | The thread's runnable state at the time of collection |
NAME | The thread name. Note that when affinitization is enabled and the thread has been affinitized, that affinitization information is append to the thread name.
|
affinity | ![]() |
CPU times are reported according to the most appropriate short form of:
Unit | Abbreviation |
---|---|
Days | d |
Hours | h |
Minutes | m |
Seconds | s |
Milliseconds | ms |
Microseconds | us |
Nanoseconds | ns |
Pools stats can be traced by setting the following in DDL:
<servers> <server name="my-xvm"> <heartbeats enabled="true" interval="5"> <collectPoolStats>true</collectIndividualThreadStats> <tracing enabled="true"> <tracePoolStats>true</tracePoolStats> </tracing> </heartbeats> </server> </server> |
To reduce the size of heartbeats, Pool Stats for a given pool are only included when:
|
Stat | Description |
---|---|
PUT | The overall number of times items were put (returned) to a pool. |
DPUT | The number of times items were put (returned) to a pool since the last time the pool was reported in a heartbeat (the delta). |
GET | The overall number of times an item was taken from a pool.
|
DGET | The number of times an item was taken from a pool since the last time the pool was reported in a heartbeat (the delta). |
HIT | The overall number of times that an item taken from a pool was satisfied by there being an available item in the pool. |
DHIT | The number of times that an item taken from a pool was satisfied by there being an available item in the pool since the last time the pool was reported in a heartbeat(the delta). |
MISS | The overall number of times that an item taken from a pool was not satisfied by there being an available item in the pool resulting in an allocation. |
DMISS | The number of times that an item taken from a pool was not satisfied by there being an available item in the pool resulting in an allocation since the last time the pool was reported in a heartbeat. |
GROW | The overall number of times the capacity of a pool had to be increased to accomodate returned items. |
DGROW | The number of times the capacity of a pool had to be increased to accomodate returned items since the last time the pool was reported in a heartbeat. |
EVIC | The overall number of items that were evicted from the pool because the pool did not have an adequate capactiy to store them. |
DEVIC | The overall number of items that were evicted from the pool because the pool did not have an adequate capactiy to store them since the last time the pool was reported in a heartbeat. |
DWSH | The overall number of times that an item return to the pool was washed (e.g. fields reset) in the detached pool washer thread. |
DDWSH | The number of times that an item return to the pool was washed (e.g. fields reset) in the detached pool washer thread since the last time the pool was reported in a heartbeat |
SIZE | The number of items that are currently in the pool available for pool gets. This number will be 0 if all objects that have been allocated by the pool have been taken.
|
PRE | The number of items initially preallocated for the pool. |
CAP | The capacity of the backing array that is allocated to hold available pool items that have been preallocated or returned to the pool.
|
NAME | The unique identifier for the pool. |
Stats that you defined in your application are emitted, they can be included in trace with the following configuration:
<servers> <server name="my-xvm"> <heartbeats enabled="true" interval="5"> <tracing enabled="true"> <tracePoolStats>true</tracePoolStats> </tracing> </heartbeats> </server> </server> |
|
See Also:
<servers> <server name="my-xvm"> <heartbeats enabled="true" interval="5"> <tracing enabled="true"> <traceAppStats>true</traceAppStats> </tracing> </heartbeats> </server> </server> |
The trace output
See Also: