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