JSTAT(1)
π 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-optionsoption reported to you. it's one or more output options made of a singlestatOption, plus any of the-t,-h, and-Joptions. 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 β±οΈ-hn β shows a column header every n samples (output rows), where n is a positive integer. the default value is0, 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,jstatproduces 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 makesjstatdisplay statistics until the target JVM terminates or thejstatcommand 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
jstatdisplay 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 thejstatcommand's output because the format might change in future releases. if you write scripts that parsejstatoutput, 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 thatjstatdisplays. below is the list of available options. use the-optionsgeneral 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-Xms48msets the startup memory to48 MB. for a complete list of options, seejava. 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,Bytesshows 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-gcutiloption, 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 collectionGCC: 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:+PrintCompilationoption.
π¦ 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
- arch rolling: jdk-openjdk 27.0.1.0.3.u1-1 Β· LicenseRef-Java
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms