Operations 7 min read

JVM Statistics Monitoring Tool (jstat) Command Usage Guide

This article explains the jstat command syntax, options, and detailed parameter descriptions for monitoring JVM class loading, memory usage, garbage collection, JIT compilation, and other runtime statistics, providing examples and visual tables to help developers analyze Java process performance.

Full-Stack Internet Architecture
Full-Stack Internet Architecture
Full-Stack Internet Architecture
JVM Statistics Monitoring Tool (jstat) Command Usage Guide

JVM Statistics Monitoring Tool (jstat) is a command used to monitor runtime information of a Java virtual machine, displaying data such as class loading, memory usage, garbage collection, and JIT compilation.

Command format

jstat [options] VMID [interval] [count]

Parameters

[options] : operation parameters, commonly -gcutil to view GC status. VMID : local JVM process ID (the Java process number). [interval] : time interval between consecutive outputs, in seconds or milliseconds. [count] : number of consecutive outputs; if omitted, it prints indefinitely.

Option Overview

Option Details

-class (monitor class loading/unloading counts, total space, and time spent)

Loaded: number of loaded classes Bytes: size of loaded class bytes Unloaded: number of unloaded classes Bytes: size of unloaded class bytes Time: loading time

-compiler (output JIT compilation statistics such as number of compiled methods and time spent)

Compiled: number of compiled methods Failed: number of compilation failures Invalid: number of invalid compilations Time: compilation time FailedType: type of failure FailedMethod: fully qualified name of the failed method

-gc (statistics of garbage‑collection heap behavior; commonly used)

C = Capacity (total), U = Used (currently used). The table lists metrics such as S0C, S0U, S1C, S1U, EC, EU, OC, OU, PC, PU, YGC, YGCT, FGC, FGCT, GCT, etc.

Example: jstat -gc 4513 2000 2 prints GC statistics of process 4513 every 2000 ms, two times.

-gccapacity (same as -gc but also shows the maximum and minimum space used by each heap region)

NGCMN/NGCMX: min/max space of young generation OGCMN/OGCMX: min/max space of old generation PGCMN/PGCMX: min/max space of perm generation

-gcutil (same as -gc but shows used space as a percentage of total)

-gccause (GC statistics overview like -gcutil plus reasons for the last two GC events)

LGCC: reason for the most recent GC GCC: reason for the current GC

-gcnew (statistics of young‑generation behavior)

TT: Tenuring threshold MTT: maximum tenuring threshold DSS: size of survivor space (KB)

-gcnewcapacity (statistics of young‑generation memory space)

NGC: current young‑generation capacity (KB) S0CMX: maximum S0 space (KB) S0C: current S0 space (KB) ECMX: maximum Eden space (KB) EC: current Eden space (KB)

-gcold (statistics of old‑generation behavior)

-gcoldcapacity (statistics of old‑generation memory space)

-gcpermcapacity (statistics of permanent generation memory space)

-printcompilation (statistics of HotSpot compiled methods)

Compiled: number of compiled tasks executed Size: byte size of method bytecode Type: compilation type Method: class name (using '/' instead of '.') and method name, consistent with HotSpot -XX:+PrintCompilation output.

© Content sourced from the web; original author retains copyright. If any infringement is found, please notify for removal.

JavaJVMGarbage CollectionPerformance Monitoringjstat
Full-Stack Internet Architecture
Written by

Full-Stack Internet Architecture

Introducing full-stack Internet architecture technologies centered on Java

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.