很多时候,我们需要dump出java内存,对程序的运行情况进行分析,这样,我们才能知道问题出在哪里。
我只用过jstat.
Using the gcutil option
This example attaches to lvmid 21891 and takes 7 samples at 250 millisecond intervals and displays the output as specified
by the -gcutil option.
jstat -gcutil 21891 250 7
S0 S1 E O P YGC YGCT FGC FGCT GCT
12.44 0.00 27.20 9.49 96.70 78 0.176 5 0.495 0.672
12.44 0.00 62.16 9.49 96.70 78 0.176 5 0.495 0.672
12.44 0.00 83.97 9.49 96.70 78 0.176 5 0.495 0.672
0.00 7.74 0.00 9.51 96.70 79 0.177 5 0.495 0.673
0.00 7.74 23.37 9.51 96.70 79 0.177 5 0.495 0.673
0.00 7.74 43.82 9.51 96.70 79 0.177 5 0.495 0.673
0.00 7.74 58.11 9.51 96.71 79 0.177 5 0.495 0.673
The output of this example shows that a young generation collection occurred between the 3rd and 4th sample. The collec-
tion took 0.001 seconds and promoted objects from the eden space (E) to the old space (O), resulting in an increase of old
space utilization from 9.49% to 9.51%. Before the collection, the survivor space was 12.44% utilized, but after this col-
lection it is only 7.74% utilized.
这是一个例子,对GC进行监控的,讲解的不错。
我只用过jstat.
Using the gcutil option
This example attaches to lvmid 21891 and takes 7 samples at 250 millisecond intervals and displays the output as specified
by the -gcutil option.
jstat -gcutil 21891 250 7
S0 S1 E O P YGC YGCT FGC FGCT GCT
12.44 0.00 27.20 9.49 96.70 78 0.176 5 0.495 0.672
12.44 0.00 62.16 9.49 96.70 78 0.176 5 0.495 0.672
12.44 0.00 83.97 9.49 96.70 78 0.176 5 0.495 0.672
0.00 7.74 0.00 9.51 96.70 79 0.177 5 0.495 0.673
0.00 7.74 23.37 9.51 96.70 79 0.177 5 0.495 0.673
0.00 7.74 43.82 9.51 96.70 79 0.177 5 0.495 0.673
0.00 7.74 58.11 9.51 96.71 79 0.177 5 0.495 0.673
The output of this example shows that a young generation collection occurred between the 3rd and 4th sample. The collec-
tion took 0.001 seconds and promoted objects from the eden space (E) to the old space (O), resulting in an increase of old
space utilization from 9.49% to 9.51%. Before the collection, the survivor space was 12.44% utilized, but after this col-
lection it is only 7.74% utilized.
这是一个例子,对GC进行监控的,讲解的不错。