All Products
Search
Document Center

Application Real-Time Monitoring Service:JVM metrics

Last Updated:Sep 11, 2026

The ARMS agent collects JVM metrics in five categories: memory, garbage collection (GC), threads, classes, and file descriptors. All metrics are gathered through standard JDK management interfaces (java.lang.management) on a periodic schedule.

For each metric, the following sections cover its collection method, reported name, type, unit, dimensions, and underlying JDK API.

Memory metrics

The ARMS agent periodically calls ManagementFactory.getPlatformMXBeans(MemoryPoolMXBean.class) to retrieve memory usage for each JVM memory pool.

Each MemoryPoolMXBean reports the initial, maximum, committed, and used sizes for a specific memory space. To query these values directly:

public static void printCurrentJVMMemoryUsage() {
    List<MemoryPoolMXBean> beans = ManagementFactory.getPlatformMXBeans(MemoryPoolMXBean.class);
    for (MemoryPoolMXBean bean : beans) {
        System.out.printf("area=%s\tname=%s\tinitial=%d\tmax=%d\tcommited=%d\tuse=%d\n", bean.getType().name(),
                bean.getName(), bean.getUsage().getInit(), bean.getUsage().getMax(), bean.getUsage().getCommitted(), bean.getUsage().getUsed());
    }
}

Sample output (varies by JVM version):

area=NON_HEAP	name=Code Cache	initial=2555904	max=134217728	commited=3211264	use=3139712
area=NON_HEAP	name=Metaspace	initial=0	max=-1	commited=8388608	use=7950584
area=NON_HEAP	name=Compressed Class Space	initial=0	max=1073741824	commited=1048576	use=919408
area=HEAP	name=PS Eden Space	initial=67108864	max=1409286144	commited=67108864	use=39057856
area=HEAP	name=PS Survivor Space	initial=11010048	max=11010048	commited=11010048	use=0
area=HEAP	name=PS Old Gen	initial=179306496	max=2863661056	commited=179306496	use=0

The agent reports these values directly without additional processing.

Reported metrics

MetricTypeUnitDescription
arms_jvm_mem_init_bytesGaugeBytesInitial memory size requested by the JVM.
arms_jvm_mem_max_bytesGaugeBytesMaximum memory size available.
arms_jvm_mem_committed_bytesGaugeBytesMemory committed to the JVM by the OS.
arms_jvm_mem_used_bytesGaugeBytesMemory currently in use.

Dimensions

DimensionDescriptionExample values
areaMemory space type.heap, nonheap
idMemory space name.eden, survivor, total

For details on JVM memory spaces, see JVM memory details.

GC metrics

The collection method depends on your agent version:

  • Before V4.4.0: A scheduled task polls ManagementFactory.getPlatformMXBeans(GarbageCollectorMXBean.class).

  • V4.4.0 and later: The agent subscribes to GarbageCollectionNotificationInfo events for real-time collection.

Each GarbageCollectorMXBean reports cumulative GC counts and durations since JVM startup. To query these values directly:

public static void printGC() {
    List<GarbageCollectorMXBean> beans = ManagementFactory.getPlatformMXBeans(GarbageCollectorMXBean.class);
    for (GarbageCollectorMXBean  bean : beans) {
        System.out.printf("name=%s\tgcCount=%d\tgcTime=%d\n", bean.getName(),
                bean.getCollectionCount(), bean.getCollectionTime());
    }
}

Sample output (varies by JVM version):

name=PS Scavenge	gcCount=0	gcTime=0
name=PS MarkSweep	gcCount=0	gcTime=0

Because these values are cumulative since JVM startup, the agent computes the delta between consecutive collections (default interval: 15 seconds). It reports per-interval counts and durations.

Reported metrics

MetricTypeUnitDescription
arms_jvm_gc_deltaGauge (delta)CountNumber of GC occurrences in the current collection interval.
arms_jvm_gc_seconds_deltaGauge (delta)SecondsGC time consumed in the current collection interval.

Dimensions

DimensionDescriptionExample values
genGC generation type.young, old
causeGC trigger reason (V4.4.0+).System.gc(), Heap Dump Initiated GC, Allocation Failure

Garbage collector name mapping

The ARMS agent maps actual garbage collector names to standardized gen dimension values to simplify analysis.

Standard collectors

Garbage collector namegen value
Copyyoung
G1 Young Genyoung
G1 Old Genold
G1 Young Generationyoung
G1 Old Generationold
ParNewyoung
ConMarkSweepold
ConcurrentMarkSweepold
PS Scavengeyoung
PS MarkSweepold
PS Serialyoung
MarkSweepCompactold

ZGC collectors

ZGC uses a fundamentally different design that does not fit the traditional young/old classification. The ARMS agent maps ZGC collectors separately:

Garbage collector namegen value
ZGC Cyclescycles
ZGC Pausespauses
ZGC Minor Cyclesyoung_cycles
ZGC Minor Pausesyoung_pauses
ZGC Major Cyclesold_cycles
ZGC Major Pausesold_pauses

Thread stack usage chart

The ARMS console displays a Thread Stack Usage chart. The agent does not collect this metric. Instead, the value equals the current live thread count multiplied by 1 MB. This is the default per-thread stack size the JVM allocates for local variable tables, operand stacks, dynamic links, and method return addresses.

image.png

Thread metrics

The ARMS agent periodically calls ManagementFactory.getThreadMXBean() to retrieve thread counts.

The returned ThreadMXBean instance provides the cumulative started thread count, current live thread count, and daemon thread count. The agent also counts live threads by state: RUNNABLE, BLOCKED, WAITING, and TIMED_WAITING.

To query these values directly:

public static void printThreads() {
    ThreadMXBean threadMXBean = java.lang.management.ManagementFactory.getThreadMXBean();
    int threadCount = threadMXBean.getThreadCount();
    int daemonThreadCount = threadMXBean.getDaemonThreadCount();
    long totalStartedThreadCount = threadMXBean.getTotalStartedThreadCount();
    long terminatedThreadCount = totalStartedThreadCount - threadCount;
    System.out.printf("allStartedThreadCount=%d\tcurrentThreadCount=%d\tdaemonThreadCount=%d\tterminatedThreadCount=%d\n"
            , totalStartedThreadCount, threadCount, daemonThreadCount, terminatedThreadCount);
}

Sample output (varies by JVM version):

allStartedThreadCount=5	currentThreadCount=5	daemonThreadCount=4	terminatedThreadCount=0

The terminated thread count equals the cumulative started count minus the current live count. All other values come directly from ThreadMXBean. The agent reports these values without additional processing.

Reported metrics

MetricTypeUnitDescription
arms_jvm_threads_countGaugeCountThread count by state.

Dimensions

The state dimension distinguishes thread categories:

state valueDescription
liveTotal live threads.
daemonDaemon threads.
terminatedTerminated threads (ARMS agent 4.x only).
newThreads in NEW state.
runnableThreads in RUNNABLE state.
blockedThreads in BLOCKED state.
waitThreads in WAITING state.
timed-waitThreads in TIMED_WAITING state.

Class loading metrics

The ARMS agent periodically calls ManagementFactory.getClassLoadingMXBean() to retrieve class loading counts.

The returned ClassLoadingMXBean provides cumulative loaded and unloaded class counts since JVM startup. To query these values directly:

public static void printCurrentJVMMemoryUsage() {
    ClassLoadingMXBean classLoaderMXBean = ManagementFactory.getClassLoadingMXBean();
    long totalLoadedClassCount = classLoaderMXBean.getTotalLoadedClassCount();
    long unloadedClassCount = classLoaderMXBean.getUnloadedClassCount();
    System.out.printf("totalLoadedClassCount=%d\tunloadedClassCount=%d\n"
            , totalLoadedClassCount, unloadedClassCount);
}

Sample output (varies by JVM version):

totalLoadedClassCount=1355	unloadedClassCount=0

Because these values are cumulative since JVM startup, the agent computes the delta between consecutive collections (default interval: 15 seconds) to report per-interval counts.

Reported metrics

MetricTypeUnitDescription
arms_class_load_loadedGauge (delta)CountNumber of classes loaded in the current collection interval.
arms_class_load_un_loadedGauge (delta)CountNumber of classes unloaded in the current collection interval.

File descriptor metrics

The ARMS agent periodically calls ManagementFactory.getOperatingSystemMXBean() to retrieve file descriptor usage. This metric is available only on Unix-based systems, where the bean is an instance of UnixOperatingSystemMXBean.

To query these values directly:

public static void printFDUsage() {
    OperatingSystemMXBean operatingSystemMXBean = ManagementFactory.getOperatingSystemMXBean();
    if (!(operatingSystemMXBean instanceof UnixOperatingSystemMXBean)) {
        return;
    }
    long openFDCount = ((UnixOperatingSystemMXBean) operatingSystemMXBean).getOpenFileDescriptorCount();
    long maxFDCount = ((UnixOperatingSystemMXBean) operatingSystemMXBean).getMaxFileDescriptorCount();
    System.out.printf("openFDCount=%d\tfdOpenRatio=%f\n"
            , openFDCount, (double) openFDCount / maxFDCount);
}

Sample output (varies by JVM version):

openFDCount=184	fdOpenRatio=0.017969

The open ratio is calculated as openFileDescriptorCount / maxFileDescriptorCount. The agent reports these values without additional processing.

Reported metrics

MetricTypeUnitDescription
arms_file_desc_open_countGaugeCountNumber of file descriptors currently open.
arms_file_desc_open_ratioGaugeRatio (0-1)Ratio of open file descriptors to the maximum allowed.