JSTAT(1)

πŸ“¦ version 27.0.1.0.3.u1, in arch rolling

πŸ’… jstat(1) β€” monitor JVM statistics

bestie welcome to jstat πŸ’– this one lives in the JDK Commands section of the manual, and she is that girl β€” she watches your JVM's whole life and reports back. let's get into it πŸŽ€


🌸 NAME 🌸

jstat β€” monitor JVM statistics. yeah that's it, that's the whole job, and she does it flawlessly. πŸ‘‘


✨ SYNOPSIS ✨

⚠️ Note: this command is experimental and unsupported. not me telling you she's a little unhinged πŸ’€ she's iconic but she is NOT on the support contract. proceed knowing that, iykyk.
jstat generalOptions

jstat outputOptions [-t] [-h lines] vmid [interval [count]]
  • generalOptions β€” literally a single general command-line option. just one. see [General Options](#-general-options-) 🫢
  • outputOptions β€” an option that the -options option reported to you. it's one or more output options made of a single statOption, plus any of the -t, -h, and -J options. see [Output Options for the jstat Command](#-output-options-for-the-jstat-command-) πŸ¦‹
  • -t β€” shows a time-stamp column as the first column of output. that time stamp is the time since the start time of the target JVM ⏱️
  • -h n β€” shows a column header every n samples (output rows), where n is a positive integer. the default value is 0, which displays the column header of the first row of data. so like, default = one header, at the top, and then she's done ✨
  • vmid β€” a virtual machine identifier, which is a string that indicates the target JVM. see [Virtual Machine Identifier](#-virtual-machine-identifier-). you gotta know which JVM you're talking to, obviously πŸ’…
  • interval β€” the sampling interval in the units you specify, seconds (s) or milliseconds (ms). default units are milliseconds. this must be a positive integer. when you specify it, jstat produces its output at each interval. she's on a schedule, she's punctual πŸ•°οΈ
  • count β€” the number of samples to display. the default value is infinity, which makes jstat display statistics until the target JVM terminates or the jstat command is terminated. this value must be a positive integer. infinity samples. she will literally never stop. main character energy fr fr 😭

πŸ’œ DESCRIPTION πŸ’œ

jstat displays performance statistics for an instrumented Java HotSpot VM. the target JVM is identified by its virtual machine identifier, aka the vmid option 🎯

she supports two types of options, bestie: general options and output options.

  • general options make jstat display simple usage and version information β€” the vibe check options 🌈
  • output options determine the content and format of the statistical output β€” the actual data options πŸ”₯
⚠️ all options and their functionality are subject to change or removal in future releases. so like… don't get too attached? πŸ™ˆ

πŸŽ€ GENERAL OPTIONS πŸŽ€

if you specify one of the general options, then you can't specify any other option or parameter. one at a time, diva, she's not multitasking πŸ’…

  • -help β€” displays a help message. the classic. the icon. 🫢
  • -options β€” displays a list of static options. see [Output Options for the jstat Command](#-output-options-for-the-jstat-command-). this is your menu of what she can do for you πŸ“‹

πŸ¦‹ OUTPUT OPTIONS FOR THE JSTAT COMMAND πŸ¦‹

if you don't specify a general option, then you can specify output options. these determine the content and format of jstat's output, and they consist of a single statOption, plus any of the other output options (-h, -t, and -J). and listen β€” the statOption must come first. she's not flexible about that one, sorry bestie 😌

output is formatted as a table, with columns separated by spaces. a header row with titles describes the columns. use the -h option to set the frequency at which the header is displayed. column header names are consistent among the different options β€” in general, if two options provide a column with the same name, then the data source for the two columns is the same. so if a column looks familiar, it is familiar, no cap ✨

use the -t option to display a time-stamp column, labeled Timestamp, as the first column of output. the Timestamp column contains the elapsed time, in seconds, since the target JVM started. the resolution of the time stamp is dependent on various factors and is subject to variation due to delayed thread scheduling on heavily loaded systems. so on a stressed machine, your timestamps might be a little πŸ€ͺ β€” that's a her-problem, not a you-problem.

use the interval and count parameters to determine how frequently and how many times, respectively, jstat displays its output πŸ—“οΈ

⚠️ Note: don't write scripts to parse the jstat command's output because the format might change in future releases. if you write scripts that parse jstat output, then expect to modify them for future releases of this tool. ngl this is the "don't build your house on sand" of manpage warnings 😭 the format is giving fluid, and by fluid i mean it will betray you later 🫠

⭐ the statOption ⭐

  • -statOption β€” determines the statistics information that jstat displays. below is the list of available options. use the -options general option to display the list of options for a particular platform installation. see [Stat Options and Output](#-stat-options-and-output-) πŸ“Š

and here's the whole lineup, bestie, all of them, no skipping πŸ‘‘

  • class β€” displays statistics about the behavior of the class loader 🧚
  • compiler β€” displays statistics about the behavior of the Java HotSpot VM Just-in-Time compiler ⚑
  • gc β€” displays statistics about the behavior of the garbage collected heap πŸ—‘οΈ
  • gccapacity β€” displays statistics about the capacities of the generations and their corresponding spaces πŸ“¦
  • gccause β€” displays a summary about garbage collection statistics (same as -gcutil), with the cause of the last and current (when applicable) garbage collection events. so it's the gc tea, plus why 🍡
  • gcnew β€” displays statistics about the behavior of the new generation 🌱
  • gcnewcapacity β€” displays statistics about the sizes of the new generations and their corresponding spaces 🌿
  • gcold β€” displays statistics about the behavior of the old generation and metaspace statistics πŸ§“
  • gcoldcapacity β€” displays statistics about the sizes of the old generation πŸ“
  • gcmetacapacity β€” displays statistics about the sizes of the metaspace πŸͺ
  • gcutil β€” displays a summary about garbage collection statistics πŸ“ˆ
  • printcompilation β€” displays Java HotSpot VM compilation method statistics πŸ–¨οΈ

πŸ’€ the -JjavaOption πŸ’€

  • -JjavaOption β€” passes javaOption to the Java application launcher. for example, -J-Xms48m sets the startup memory to 48 MB. for a complete list of options, see java. she's just forwarding your message, like a very reliable group chat admin πŸ’Œ

okay that's the whole first chunk bestie β€” stay tuned, there's more coming and she is NOT done slaying πŸ’–

✨ STAT OPTIONS AND OUTPUT ✨

okay bestie, this is the part where we get into what each statOption actually prints. every one of these options gives you a different little column lineup, so here's the full rundown β€” no skipping, fr fr πŸ’…

  • -class β€” class loader statistics, aka "how many classes is this JVM hoarding" πŸŽ’
    • Loaded: number of classes loaded.
    • Bytes: number of KB loaded.
    • Unloaded: number of classes unloaded.
    • Bytes: number of KB unloaded. (yes, Bytes shows up twice β€” once for loaded, once for unloaded, and they are not the same column, so don't @ me 😭)
    • Time: time spent performing class loading and unloading operations.
  • -compiler β€” Java HotSpot VM Just-in-Time compiler statistics. the JIT's whole personality ✨
    • Compiled: number of compilation tasks performed.
    • Failed: number of compilations tasks failed.
    • Invalid: number of compilation tasks that were invalidated.
    • Time: time spent performing compilation tasks.
    • FailedType: compile type of the last failed compilation.
    • FailedMethod: class name and method of the last failed compilation.
  • -gc β€” garbage collected heap statistics. the classic, the icon, the moment πŸ‘‘
    • S0C: current survivor space 0 capacity (KB).
    • S1C: current survivor space 1 capacity (KB).
    • S0U: survivor space 0 utilization (KB).
    • S1U: survivor space 1 utilization (KB).
    • EC: current eden space capacity (KB).
    • EU: eden space utilization (KB).
    • OC: current old space capacity (KB).
    • OU: old space utilization (KB).
    • MC: Metaspace Committed Size (KB).
    • MU: Metaspace utilization (KB).
    • CCSC: Compressed class committed size (KB).
    • CCSU: Compressed class space used (KB).
    • YGC: number of young generation garbage collection (GC) events.
    • YGCT: young generation garbage collection time.
    • FGC: number of full GC events.
    • FGCT: full garbage collection time.
    • GCT: total garbage collection time.
  • -gccapacity β€” memory pool generation and space capacities. all the ceilings and floors πŸ—οΈ
    • NGCMN: minimum new generation capacity (KB).
    • NGCMX: maximum new generation capacity (KB).
    • NGC: current new generation capacity (KB).
    • S0C: current survivor space 0 capacity (KB).
    • S1C: current survivor space 1 capacity (KB).
    • EC: current eden space capacity (KB).
    • OGCMN: minimum old generation capacity (KB).
    • OGCMX: maximum old generation capacity (KB).
    • OGC: current old generation capacity (KB).
    • OC: current old space capacity (KB).
    • MCMN: minimum metaspace capacity (KB).
    • MCMX: maximum metaspace capacity (KB).
    • MC: Metaspace Committed Size (KB).
    • CCSMN: Compressed class space minimum capacity (KB).
    • CCSMX: Compressed class space maximum capacity (KB).
    • CCSC: Compressed class committed size (KB).
    • YGC: number of young generation GC events.
    • FGC: number of full GC events.
  • -gccause β€” this one's the drama queen πŸ’… it shows the same summary of garbage collection statistics as the -gcutil option, but it also includes the causes of the last garbage collection event and (when applicable), the current garbage collection event. so on top of every column listed for -gcutil, it adds these extra ones:
    • LGCC: cause of last garbage collection
    • GCC: cause of current garbage collection
  • -gcnew β€” new generation statistics, the nursery era of a JVM's life 🍼
    • S0C: current survivor space 0 capacity (KB).
    • S1C: current survivor space 1 capacity (KB).
    • S0U: survivor space 0 utilization (KB).
    • S1U: survivor space 1 utilization (KB).
    • TT: tenuring threshold.
    • MTT: maximum tenuring threshold.
    • DSS: desired survivor size (KB).
    • EC: current eden space capacity (KB).
    • EU: eden space utilization (KB).
    • YGC: number of young generation GC events.
    • YGCT: young generation garbage collection time.
  • -gcnewcapacity β€” new generation space size statistics πŸ“
    • NGCMN: minimum new generation capacity (KB).
    • NGCMX: maximum new generation capacity (KB).
    • NGC: current new generation capacity (KB).
    • S0CMX: maximum survivor space 0 capacity (KB).
    • S0C: current survivor space 0 capacity (KB).
    • S1CMX: maximum survivor space 1 capacity (KB).
    • S1C: current survivor space 1 capacity (KB).
    • ECMX: maximum eden space capacity (KB).
    • EC: current eden space capacity (KB).
    • YGC: number of young generation GC events.
    • FGC: number of full GC events.
  • -gcold β€” old generation size statistics, the elder statesman energy πŸ§“
    • MC: Metaspace Committed Size (KB).
    • MU: Metaspace utilization (KB).
    • CCSC: Compressed class committed size (KB).
    • CCSU: Compressed class space used (KB).
    • OC: current old space capacity (KB).
    • OU: old space utilization (KB).
    • YGC: number of young generation GC events.
    • FGC: number of full GC events.
    • FGCT: full garbage collection time.
    • GCT: total garbage collection time.
  • -gcoldcapacity β€” old generation statistics πŸ›οΈ
    • OGCMN: minimum old generation capacity (KB).
    • OGCMX: maximum old generation capacity (KB).
    • OGC: current old generation capacity (KB).
    • OC: current old space capacity (KB).
    • YGC: number of young generation GC events.
    • FGC: number of full GC events.
    • FGCT: full garbage collection time.
    • GCT: total garbage collection time.
  • -gcmetacapacity β€” metaspace size statistics ☁️
    • MCMN: minimum metaspace capacity (KB).
    • MCMX: maximum metaspace capacity (KB).
    • MC: Metaspace Committed Size (KB).
    • CCSMN: Compressed class space minimum capacity (KB).
    • CCSMX: Compressed class space maximum capacity (KB).
    • YGC: number of young generation GC events.
    • FGC: number of full GC events.
    • FGCT: full garbage collection time.
    • GCT: total garbage collection time.
  • -gcutil β€” summary of garbage collection statistics. the percentages one, the vibe check of GC 🌈
    • S0: survivor space 0 utilization as a percentage of the space's current capacity.
    • S1: survivor space 1 utilization as a percentage of the space's current capacity.
    • E: eden space utilization as a percentage of the space's current capacity.
    • O: old space utilization as a percentage of the space's current capacity.
    • M: metaspace utilization as a percentage of the space's current capacity.
    • CCS: compressed class space utilization as a percentage.
    • YGC: number of young generation GC events.
    • YGCT: young generation garbage collection time.
    • FGC: number of full GC events.
    • FGCT: full garbage collection time.
    • GCT: total garbage collection time.
  • -printcompilation β€” Java HotSpot VM compiler method statistics. hot-method tea β˜•πŸ”₯
    • Compiled: number of compilation tasks performed by the most recently compiled method.
    • Size: number of bytes of byte code of the most recently compiled method.
    • Type: compilation type of the most recently compiled method.
    • Method: class name and method name identifying the most recently compiled method. Class name uses a slash (/) instead of a dot (.) as a name space separator. The method name is the method within the specified class. The format for these two fields is consistent with the HotSpot -XX:+PrintCompilation option.

πŸ¦‹ VIRTUAL MACHINE IDENTIFIER πŸ¦‹

so the syntax of the vmid string corresponds to the syntax of a URI, and it looks like this:

[protocol:][//]lvmid[@hostname[:port][/servername]

okay so like β€” the syntax of the vmid string corresponds to the syntax of a URI, yes, saying it twice because it's important πŸ’– The vmid string can vary from a simple integer that represents a local JVM to a more complex construction that specifies a communications protocol, port number, and other implementation-specific values. glow-up from "just a number" to "whole URI situation", we love range ✨

protocol

The communications protocol. If the protocol value is omitted and a host name isn't specified, then the default protocol is a platform-specific optimized local protocol. If the protocol value is omitted and a host name is specified, then the default protocol is rmi.

lvmid

The local virtual machine identifier for the target JVM. The lvmid is a platform-specific value that uniquely identifies a JVM on a system. The lvmid is the only required component of a virtual machine identifier. The lvmid is typically, but not necessarily, the operating system's process identifier for the target JVM process. You can use the jps command to determine the lvmid provided the JVM processes is not running in a separate docker instance. You can also determine the lvmid on Linux and macOS platforms with the ps command, and on Windows with the Windows Task Manager.

🫢 real talk: lvmid is the one thing you literally cannot skip. it's the main character of this string, everything else is supporting cast.

hostname

A host name or IP address that indicates the target host. If the hostname value is omitted, then the target host is the local host.

port

The default port for communicating with the remote server. If the hostname value is omitted or the protocol value specifies an optimized, local protocol, then the port value is ignored. Otherwise, treatment of the port parameter is implementation-specific. For the default rmi protocol, the port value indicates the port number for the rmiregistry on the remote host. If the port value is omitted and the protocol value indicates rmi, then the default rmiregistry port (1099) is used.

servername

The treatment of the servername parameter depends on implementation. For the optimized local protocol, this field is ignored. For the rmi protocol, it represents the name of the RMI remote object on the remote host.


🌸 EXAMPLES 🌸

This section presents some examples of monitoring a local JVM with an lvmid of 21891.

πŸ’… THE GCUTIL OPTION

okay so this example is literally the -gcutil main character moment: it attaches to lvmid 21891 and takes 7 samples at 250 millisecond intervals, then displays the output as specified by the -gcutil option. slay.

the output shows that a young generation collection occurred between the third and fourth sample. that collection took 0.078 seconds and promoted objects from the eden space (E) to the old space (O), so old space utilization went up from 66.80% to 68.19%. before the collection, the survivor space was 97.02% utilized, but after this collection it's 91.03% utilized. periodt.

jstat -gcutil 21891 250 7
  S0     S1     E      O      M     CCS    YGC     YGCT    FGC    FGCT     GCT
  0.00  97.02  70.31  66.80  95.52  89.14      7    0.300     0    0.000    0.300
  0.00  97.02  86.23  66.80  95.52  89.14      7    0.300     0    0.000    0.300
  0.00  97.02  96.53  66.80  95.52  89.14      7    0.300     0    0.000    0.300
 91.03   0.00   1.98  68.19  95.89  91.24      8    0.378     0    0.000    0.378
 91.03   0.00  15.82  68.19  95.89  91.24      8    0.378     0    0.000    0.378
 91.03   0.00  17.80  68.19  95.89  91.24      8    0.378     0    0.000    0.378
 91.03   0.00  17.80  68.19  95.89  91.24      8    0.378     0    0.000    0.378

πŸ” REPEAT THE COLUMN HEADER STRING

this example attaches to lvmid 21891 and takes samples at 250 millisecond intervals and displays the output as specified by the -gcnew option. also, it uses the -h3 option to output the column header after every 3 lines of data. not me being obsessed with headers, but iykyk.

besides showing the repeating header string, this example shows that between the second and third samples, a young GC occurred. its duration was 0.001 seconds. the collection found enough active data that the survivor space 0 utilization (S0U) would have exceeded the desired survivor size (DSS). as a result, objects were promoted to the old generation (not visible in this output), and the tenuring threshold (TT) was lowered from 31 to 2.

another collection occurs between the fifth and sixth samples. this collection found very few survivors and returned the tenuring threshold to 31. iconic behavior.

jstat -gcnew -h3 21891 250
 S0C    S1C    S0U    S1U   TT MTT  DSS      EC       EU     YGC     YGCT
  64.0   64.0    0.0   31.7 31  31   32.0    512.0    178.6    249    0.203
  64.0   64.0    0.0   31.7 31  31   32.0    512.0    355.5    249    0.203
  64.0   64.0   35.4    0.0  2  31   32.0    512.0     21.9    250    0.204
 S0C    S1C    S0U    S1U   TT MTT  DSS      EC       EU     YGC     YGCT
  64.0   64.0   35.4    0.0  2  31   32.0    512.0    245.9    250    0.204
  64.0   64.0   35.4    0.0  2  31   32.0    512.0    421.1    250    0.204
  64.0   64.0    0.0   19.0 31  31   32.0    512.0     84.4    251    0.204
 S0C    S1C    S0U    S1U   TT MTT  DSS      EC       EU     YGC     YGCT
  64.0   64.0    0.0   19.0 31  31   32.0    512.0    306.7    251    0.204

⏰ INCLUDE A TIME STAMP FOR EACH SAMPLE

this example attaches to lvmid 21891 and takes 3 samples at 250 millisecond intervals. the -t option is used to generate a time stamp for each sample in the first column. cute and useful, we love a timestamped queen.

the Timestamp column reports the elapsed time in seconds since the start of the target JVM. also, the -gcoldcapacity output shows the old generation capacity (OGC) and the old space capacity (OC) increasing as the heap expands to meet allocation or promotion demands. the old generation capacity (OGC) has grown from 11,696 KB to 13,820 KB after the eighty-first full garbage collection (FGC). the maximum capacity of the generation (and space) is 60,544 KB (OGCMX), so it still has room to expand. she's growing, your honor.

Timestamp      OGCMN    OGCMX     OGC       OC       YGC   FGC    FGCT    GCT
          150.1   1408.0  60544.0  11696.0  11696.0   194    80    2.874   3.799
          150.4   1408.0  60544.0  13820.0  13820.0   194    81    2.938   3.863
          150.7   1408.0  60544.0  13820.0  13820.0   194    81    2.938   3.863

πŸ“‘ MONITOR INSTRUMENTATION FOR A REMOTE JVM

this example attaches to lvmid 40496 on the system named remote.domain using the -gcutil option, with samples taken every second indefinitely. remote monitoring? we love to see it.

the lvmid is combined with the name of the remote host to construct a vmid of 40496@remote.domain. this vmid results in the use of the rmi protocol to communicate to the default jstatd server on the remote host. the jstatd server is located using the rmiregistry command on remote.domain that's bound to the default port of the rmiregistry command (port 1099). iykyk.

jstat -gcutil 40496@remote.domain 1000
... output omitted

πŸ’– mwah! this page is from JDK 27.0.1.0.3, dated 2026, and it's JSTAT(1) β€” bye bestie! πŸ’‹

πŸ“¦ where this page comes from