1JSTAT(1) JDK Commands JSTAT(1)
2
3
4
6 jstat - monitor JVM statistics
7
9 Note: This command is experimental and unsupported.
10
11 jstat generalOptions
12
13 jstat outputOptions [-t] [-h lines] vmid [interval [count]]
14
15 generalOptions
16 A single general command-line option. See General Options.
17
18 outputOptions
19 An option reported by the -options option. One or more output
20 options that consist of a single statOption, plus any of the -t,
21 -h, and -J options. See Output Options for the jstat Command.
22
23 -t Displays a time-stamp column as the first column of output. The
24 time stamp is the time since the start time of the target JVM.
25
26 -h n Displays a column header every n samples (output rows), where n
27 is a positive integer. The default value is 0, which displays
28 the column header of the first row of data.
29
30 vmid A virtual machine identifier, which is a string that indicates
31 the target JVM. See Virtual Machine Identifier.
32
33 interval
34 The sampling interval in the specified units, seconds (s) or
35 milliseconds (ms). Default units are milliseconds. This must
36 be a positive integer. When specified, the jstat command pro‐
37 duces its output at each interval.
38
39 count The number of samples to display. The default value is infini‐
40 ty, which causes the jstat command to display statistics until
41 the target JVM terminates or the jstat command is terminated.
42 This value must be a positive integer.
43
45 The jstat command displays performance statistics for an instrumented
46 Java HotSpot VM. The target JVM is identified by its virtual machine
47 identifier, or vmid option.
48
49 The jstat command supports two types of options, general options and
50 output options. General options cause the jstat command to display
51 simple usage and version information. Output options determine the
52 content and format of the statistical output.
53
54 All options and their functionality are subject to change or removal in
55 future releases.
56
58 If you specify one of the general options, then you can't specify any
59 other option or parameter.
60
61 -help Displays a help message.
62
63 -options
64 Displays a list of static options. See Output Options for the
65 jstat Command.
66
68 If you don't specify a general option, then you can specify output op‐
69 tions. Output options determine the content and format of the jstat
70 command's output, and consist of a single statOption, plus any of the
71 other output options (-h, -t, and -J). The statOption must come first.
72
73 Output is formatted as a table, with columns that are separated by spa‐
74 ces. A header row with titles describes the columns. Use the -h op‐
75 tion to set the frequency at which the header is displayed. Column
76 header names are consistent among the different options. In general,
77 if two options provide a column with the same name, then the data
78 source for the two columns is the same.
79
80 Use the -t option to display a time-stamp column, labeled Timestamp as
81 the first column of output. The Timestamp column contains the elapsed
82 time, in seconds, since the target JVM started. The resolution of the
83 time stamp is dependent on various factors and is subject to variation
84 due to delayed thread scheduling on heavily loaded systems.
85
86 Use the interval and count parameters to determine how frequently and
87 how many times, respectively, the jstat command displays its output.
88
89 Note:
90
91 Don't write scripts to parse the jstat command's output because the
92 format might change in future releases. If you write scripts that
93 parse the jstat command output, then expect to modify them for future
94 releases of this tool.
95
96 -statOption
97 Determines the statistics information that the jstat command
98 displays. The following lists the available options. Use the
99 -options general option to display the list of options for a
100 particular platform installation. See Stat Options and Output.
101
102 class: Displays statistics about the behavior of the class load‐
103 er.
104
105 compiler: Displays statistics about the behavior of the Java
106 HotSpot VM Just-in-Time compiler.
107
108 gc: Displays statistics about the behavior of the garbage col‐
109 lected heap.
110
111 gccapacity: Displays statistics about the capacities of the gen‐
112 erations and their corresponding spaces.
113
114 gccause: Displays a summary about garbage collection statistics
115 (same as -gcutil), with the cause of the last and current (when
116 applicable) garbage collection events.
117
118 gcnew: Displays statistics about the behavior of the new genera‐
119 tion.
120
121 gcnewcapacity: Displays statistics about the sizes of the new
122 generations and their corresponding spaces.
123
124 gcold: Displays statistics about the behavior of the old genera‐
125 tion and metaspace statistics.
126
127 gcoldcapacity: Displays statistics about the sizes of the old
128 generation.
129
130 gcmetacapacity: Displays statistics about the sizes of the
131 metaspace.
132
133 gcutil: Displays a summary about garbage collection statistics.
134
135 printcompilation: Displays Java HotSpot VM compilation method
136 statistics.
137
138 -JjavaOption
139 Passes javaOption to the Java application launcher. For exam‐
140 ple, -J-Xms48m sets the startup memory to 48 MB. For a complete
141 list of options, see java.
142
144 The following information summarizes the columns that the jstat command
145 outputs for each statOption.
146
147 -class option
148 Class loader statistics.
149
150 Loaded: Number of classes loaded.
151
152 Bytes: Number of KB loaded.
153
154 Unloaded: Number of classes unloaded.
155
156 Bytes: Number of KB unloaded.
157
158 Time: Time spent performing class loading and unloading opera‐
159 tions.
160
161 -compiler option
162 Java HotSpot VM Just-in-Time compiler statistics.
163
164 Compiled: Number of compilation tasks performed.
165
166 Failed: Number of compilations tasks failed.
167
168 Invalid: Number of compilation tasks that were invalidated.
169
170 Time: Time spent performing compilation tasks.
171
172 FailedType: Compile type of the last failed compilation.
173
174 FailedMethod: Class name and method of the last failed compila‐
175 tion.
176
177 -gc option
178 Garbage collected heap statistics.
179
180 S0C: Current survivor space 0 capacity (KB).
181
182 S1C: Current survivor space 1 capacity (KB).
183
184 S0U: Survivor space 0 utilization (KB).
185
186 S1U: Survivor space 1 utilization (KB).
187
188 EC: Current eden space capacity (KB).
189
190 EU: Eden space utilization (KB).
191
192 OC: Current old space capacity (KB).
193
194 OU: Old space utilization (KB).
195
196 MC: Metaspace Committed Size (KB).
197
198 MU: Metaspace utilization (KB).
199
200 CCSC: Compressed class committed size (KB).
201
202 CCSU: Compressed class space used (KB).
203
204 YGC: Number of young generation garbage collection (GC) events.
205
206 YGCT: Young generation garbage collection time.
207
208 FGC: Number of full GC events.
209
210 FGCT: Full garbage collection time.
211
212 GCT: Total garbage collection time.
213
214 -gccapacity option
215 Memory pool generation and space capacities.
216
217 NGCMN: Minimum new generation capacity (KB).
218
219 NGCMX: Maximum new generation capacity (KB).
220
221 NGC: Current new generation capacity (KB).
222
223 S0C: Current survivor space 0 capacity (KB).
224
225 S1C: Current survivor space 1 capacity (KB).
226
227 EC: Current eden space capacity (KB).
228
229 OGCMN: Minimum old generation capacity (KB).
230
231 OGCMX: Maximum old generation capacity (KB).
232
233 OGC: Current old generation capacity (KB).
234
235 OC: Current old space capacity (KB).
236
237 MCMN: Minimum metaspace capacity (KB).
238
239 MCMX: Maximum metaspace capacity (KB).
240
241 MC: Metaspace Committed Size (KB).
242
243 CCSMN: Compressed class space minimum capacity (KB).
244
245 CCSMX: Compressed class space maximum capacity (KB).
246
247 CCSC: Compressed class committed size (KB).
248
249 YGC: Number of young generation GC events.
250
251 FGC: Number of full GC events.
252
253 -gccause option
254 This option displays the same summary of garbage collection sta‐
255 tistics as the -gcutil option, but includes the causes of the
256 last garbage collection event and (when applicable), the current
257 garbage collection event. In addition to the columns listed for
258 -gcutil, this option adds the following columns:
259
260 LGCC: Cause of last garbage collection
261
262 GCC: Cause of current garbage collection
263
264 -gcnew option
265 New generation statistics.
266
267 S0C: Current survivor space 0 capacity (KB).
268
269 S1C: Current survivor space 1 capacity (KB).
270
271 S0U: Survivor space 0 utilization (KB).
272
273 S1U: Survivor space 1 utilization (KB).
274
275 TT: Tenuring threshold.
276
277 MTT: Maximum tenuring threshold.
278
279 DSS: Desired survivor size (KB).
280
281 EC: Current eden space capacity (KB).
282
283 EU: Eden space utilization (KB).
284
285 YGC: Number of young generation GC events.
286
287 YGCT: Young generation garbage collection time.
288
289 -gcnewcapacity option
290 New generation space size statistics.
291
292 NGCMN: Minimum new generation capacity (KB).
293
294 NGCMX: Maximum new generation capacity (KB).
295
296 NGC: Current new generation capacity (KB).
297
298 S0CMX: Maximum survivor space 0 capacity (KB).
299
300 S0C: Current survivor space 0 capacity (KB).
301
302 S1CMX: Maximum survivor space 1 capacity (KB).
303
304 S1C: Current survivor space 1 capacity (KB).
305
306 ECMX: Maximum eden space capacity (KB).
307
308 EC: Current eden space capacity (KB).
309
310 YGC: Number of young generation GC events.
311
312 FGC: Number of full GC events.
313
314 -gcold option
315 Old generation size statistics.
316
317 MC: Metaspace Committed Size (KB).
318
319 MU: Metaspace utilization (KB).
320
321 CCSC: Compressed class committed size (KB).
322
323 CCSU: Compressed class space used (KB).
324
325 OC: Current old space capacity (KB).
326
327 OU: Old space utilization (KB).
328
329 YGC: Number of young generation GC events.
330
331 FGC: Number of full GC events.
332
333 FGCT: Full garbage collection time.
334
335 GCT: Total garbage collection time.
336
337 -gcoldcapacity option
338 Old generation statistics.
339
340 OGCMN: Minimum old generation capacity (KB).
341
342 OGCMX: Maximum old generation capacity (KB).
343
344 OGC: Current old generation capacity (KB).
345
346 OC: Current old space capacity (KB).
347
348 YGC: Number of young generation GC events.
349
350 FGC: Number of full GC events.
351
352 FGCT: Full garbage collection time.
353
354 GCT: Total garbage collection time.
355
356 -gcmetacapacity option
357 Metaspace size statistics.
358
359 MCMN: Minimum metaspace capacity (KB).
360
361 MCMX: Maximum metaspace capacity (KB).
362
363 MC: Metaspace Committed Size (KB).
364
365 CCSMN: Compressed class space minimum capacity (KB).
366
367 CCSMX: Compressed class space maximum capacity (KB).
368
369 YGC: Number of young generation GC events.
370
371 FGC: Number of full GC events.
372
373 FGCT: Full garbage collection time.
374
375 GCT: Total garbage collection time.
376
377 -gcutil option
378 Summary of garbage collection statistics.
379
380 S0: Survivor space 0 utilization as a percentage of the space's
381 current capacity.
382
383 S1: Survivor space 1 utilization as a percentage of the space's
384 current capacity.
385
386 E: Eden space utilization as a percentage of the space's current
387 capacity.
388
389 O: Old space utilization as a percentage of the space's current
390 capacity.
391
392 M: Metaspace utilization as a percentage of the space's current
393 capacity.
394
395 CCS: Compressed class space utilization as a percentage.
396
397 YGC: Number of young generation GC events.
398
399 YGCT: Young generation garbage collection time.
400
401 FGC: Number of full GC events.
402
403 FGCT: Full garbage collection time.
404
405 GCT: Total garbage collection time.
406
407 -printcompilation option
408 Java HotSpot VM compiler method statistics.
409
410 Compiled: Number of compilation tasks performed by the most re‐
411 cently compiled method.
412
413 Size: Number of bytes of byte code of the most recently compiled
414 method.
415
416 Type: Compilation type of the most recently compiled method.
417
418 Method: Class name and method name identifying the most recently
419 compiled method. Class name uses a slash (/) instead of a dot
420 (.) as a name space separator. The method name is the method
421 within the specified class. The format for these two fields is
422 consistent with the HotSpot -XX:+PrintCompilation option.
423
425 The syntax of the vmid string corresponds to the syntax of a URI:
426
427 [protocol:][//]lvmid[@hostname[:port][/servername]
428
429 The syntax of the vmid string corresponds to the syntax of a URI. The
430 vmid string can vary from a simple integer that represents a local JVM
431 to a more complex construction that specifies a communications proto‐
432 col, port number, and other implementation-specific values.
433
434 protocol
435 The communications protocol. If the protocol value is omitted
436 and a host name isn't specified, then the default protocol is a
437 platform-specific optimized local protocol. If the protocol
438 value is omitted and a host name is specified, then the default
439 protocol is rmi.
440
441 lvmid The local virtual machine identifier for the target JVM. The
442 lvmid is a platform-specific value that uniquely identifies a
443 JVM on a system. The lvmid is the only required component of a
444 virtual machine identifier. The lvmid is typically, but not
445 necessarily, the operating system's process identifier for the
446 target JVM process. You can use the jps command to determine
447 the lvmid provided the JVM processes is not running in a sepa‐
448 rate docker instance. You can also determine the lvmid on Linux
449 and macOS platforms with the ps command, and on Windows with the
450 Windows Task Manager.
451
452 hostname
453 A host name or IP address that indicates the target host. If
454 the hostname value is omitted, then the target host is the local
455 host.
456
457 port The default port for communicating with the remote server. If
458 the hostname value is omitted or the protocol value specifies an
459 optimized, local protocol, then the port value is ignored. Oth‐
460 erwise, treatment of the port parameter is implementation-spe‐
461 cific. For the default rmi protocol, the port value indicates
462 the port number for the rmiregistry on the remote host. If the
463 port value is omitted and the protocol value indicates rmi, then
464 the default rmiregistry port (1099) is used.
465
466 servername
467 The treatment of the servername parameter depends on implementa‐
468 tion. For the optimized local protocol, this field is ignored.
469 For the rmi protocol, it represents the name of the RMI remote
470 object on the remote host.
471
473 This section presents some examples of monitoring a local JVM with an
474 lvmid of 21891.
475
477 This example attaches to lvmid 21891 and takes 7 samples at 250 mil‐
478 lisecond intervals and displays the output as specified by the -gcutil
479 option.
480
481 The output of this example shows that a young generation collection oc‐
482 curred between the third and fourth sample. The collection took 0.078
483 seconds and promoted objects from the eden space (E) to the old space
484 (O), resulting in an increase of old space utilization from 66.80% to
485 68.19%. Before the collection, the survivor space was 97.02% utilized,
486 but after this collection it's 91.03% utilized.
487
488 jstat -gcutil 21891 250 7
489 S0 S1 E O M CCS YGC YGCT FGC FGCT GCT
490 0.00 97.02 70.31 66.80 95.52 89.14 7 0.300 0 0.000 0.300
491 0.00 97.02 86.23 66.80 95.52 89.14 7 0.300 0 0.000 0.300
492 0.00 97.02 96.53 66.80 95.52 89.14 7 0.300 0 0.000 0.300
493 91.03 0.00 1.98 68.19 95.89 91.24 8 0.378 0 0.000 0.378
494 91.03 0.00 15.82 68.19 95.89 91.24 8 0.378 0 0.000 0.378
495 91.03 0.00 17.80 68.19 95.89 91.24 8 0.378 0 0.000 0.378
496 91.03 0.00 17.80 68.19 95.89 91.24 8 0.378 0 0.000 0.378
497
499 This example attaches to lvmid 21891 and takes samples at 250 millisec‐
500 ond intervals and displays the output as specified by -gcnew option.
501 In addition, it uses the -h3 option to output the column header after
502 every 3 lines of data.
503
504 In addition to showing the repeating header string, this example shows
505 that between the second and third samples, a young GC occurred. Its
506 duration was 0.001 seconds. The collection found enough active data
507 that the survivor space 0 utilization (S0U) would have exceeded the de‐
508 sired survivor size (DSS). As a result, objects were promoted to the
509 old generation (not visible in this output), and the tenuring threshold
510 (TT) was lowered from 31 to 2.
511
512 Another collection occurs between the fifth and sixth samples. This
513 collection found very few survivors and returned the tenuring threshold
514 to 31.
515
516 jstat -gcnew -h3 21891 250
517 S0C S1C S0U S1U TT MTT DSS EC EU YGC YGCT
518 64.0 64.0 0.0 31.7 31 31 32.0 512.0 178.6 249 0.203
519 64.0 64.0 0.0 31.7 31 31 32.0 512.0 355.5 249 0.203
520 64.0 64.0 35.4 0.0 2 31 32.0 512.0 21.9 250 0.204
521 S0C S1C S0U S1U TT MTT DSS EC EU YGC YGCT
522 64.0 64.0 35.4 0.0 2 31 32.0 512.0 245.9 250 0.204
523 64.0 64.0 35.4 0.0 2 31 32.0 512.0 421.1 250 0.204
524 64.0 64.0 0.0 19.0 31 31 32.0 512.0 84.4 251 0.204
525 S0C S1C S0U S1U TT MTT DSS EC EU YGC YGCT
526 64.0 64.0 0.0 19.0 31 31 32.0 512.0 306.7 251 0.204
527
529 This example attaches to lvmid 21891 and takes 3 samples at 250 mil‐
530 lisecond intervals. The -t option is used to generate a time stamp for
531 each sample in the first column.
532
533 The Timestamp column reports the elapsed time in seconds since the
534 start of the target JVM. In addition, the -gcoldcapacity output shows
535 the old generation capacity (OGC) and the old space capacity (OC) in‐
536 creasing as the heap expands to meet allocation or promotion demands.
537 The old generation capacity (OGC) has grown from 11,696 KB to 13,820 KB
538 after the eighty-first full garbage collection (FGC). The maximum ca‐
539 pacity of the generation (and space) is 60,544 KB (OGCMX), so it still
540 has room to expand.
541
542 Timestamp OGCMN OGCMX OGC OC YGC FGC FGCT GCT
543 150.1 1408.0 60544.0 11696.0 11696.0 194 80 2.874 3.799
544 150.4 1408.0 60544.0 13820.0 13820.0 194 81 2.938 3.863
545 150.7 1408.0 60544.0 13820.0 13820.0 194 81 2.938 3.863
546
548 This example attaches to lvmid 40496 on the system named remote.domain
549 using the -gcutil option, with samples taken every second indefinitely.
550
551 The lvmid is combined with the name of the remote host to construct a
552 vmid of 40496@remote.domain. This vmid results in the use of the rmi
553 protocol to communicate to the default jstatd server on the remote
554 host. The jstatd server is located using the rmiregistry command on
555 remote.domain that's bound to the default port of the rmiregistry com‐
556 mand (port 1099).
557
558 jstat -gcutil 40496@remote.domain 1000
559 ... output omitted
560
561
562
563JDK 21 2023 JSTAT(1)