- 浏览: 250380 次
- 性别:
文章分类
最新评论
测试代码
使用serial + serial Old
full gc通过(System.gc())触发
年轻代垃垃圾收集器名字 DefNew
老年代Tenured 持久带 Perm
年轻代收集过程
从jstat看,只触发了YGC
老年代和持久带的收集过程
只触发了FGC,但是却没有YGC
如果开启Syste.gc(),也是一样,只有FGC,没有YGC
Parallel Scavenge +Parallel Old 组合显示的结果,full gc通过(System.gc())触发,
年轻代收集器名称 PSYoungGen
老年代ParOldGen, 持久带PSPermGen
年轻代的收集过程,只触发YGC
通过程序触发的full gc,此时YGC,FGC都会触发
Parallel GC的线程名
使用ParNew + ConcMarkSweep ,full gc通过(System.gc())触发,
ParNew GC的线程名
CMS线程名
年轻代收集过程,此时只会触发YGC
老年代和持久带收集过程,只会触发FGC
通过System.gc()触发,此时只有FGC,没有YGC
CMS中有,初始化,并发标记,重新标记,并发清除几个阶段
以下是初始化,并发标记
重新标记,并发清除
此外还有扫描中断:
处理失败的情况,此时使用serial old:
最后是G1,其线程名如下:
清扫过程:由于G1不能很好的和jstat配合工作,因此看不到gcutil情况
jdk1.7.0_04 打开G1,jstat,jmap等工具可以正常使用。
参考
Tenured 区并发垃圾回收器CMS介绍
http://blog.csdn.net/lxb_champagne/article/details/18357947
千丝万缕的FGC与Buffer Pool
http://fx114.net/qa-132-149018.aspx
public void test()throws Exception { while(true) { byte[] buf = new byte[3 * 1024 * 1024]; Thread.sleep(500); //System.gc(); } }
使用serial + serial Old
full gc通过(System.gc())触发
年轻代垃垃圾收集器名字 DefNew
老年代Tenured 持久带 Perm
年轻代收集过程
C:\>java -Xms20M -Xmx20M -Xmn10M -XX:+PrintGCDetails -XX:+ScavengeBeforeFullGC - XX:+UseSerialGC Test2 [GC [DefNew: 6471K->146K(9216K), 0.0043318 secs] 6471K->146K(19456K), 0.0053627 secs] [Times: user=0.00 sys=0.02, real=0.01 secs] [GC [DefNew: 6540K->146K(9216K), 0.0022464 secs] 6540K->146K(19456K), 0.0032348 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] Heap def new generation total 9216K, used 3546K [0x315e0000, 0x31fe0000, 0x31fe000 0) eden space 8192K, 41% used [0x315e0000, 0x31931f28, 0x31de0000) from space 1024K, 14% used [0x31de0000, 0x31e04920, 0x31ee0000) to space 1024K, 0% used [0x31ee0000, 0x31ee0000, 0x31fe0000) tenured generation total 10240K, used 0K [0x31fe0000, 0x329e0000, 0x329e0000) the space 10240K, 0% used [0x31fe0000, 0x31fe0000, 0x31fe0200, 0x329e0000) compacting perm gen total 12288K, used 374K [0x329e0000, 0x335e0000, 0x369e000 0) the space 12288K, 3% used [0x329e0000, 0x32a3dba0, 0x32a3dc00, 0x335e0000) ro space 10240K, 54% used [0x369e0000, 0x36f5ee00, 0x36f5ee00, 0x373e0000) rw space 12288K, 55% used [0x373e0000, 0x37a82800, 0x37a82800, 0x37fe0000)
从jstat看,只触发了YGC
C:\>jstat -gcutil 2528 1000 20 S0 S1 E O P YGC YGCT FGC FGCT GCT 14.29 0.00 37.50 0.00 3.04 12 0.029 0 0.000 0.029 0.00 14.29 37.50 0.00 3.04 13 0.032 0 0.000 0.032 14.29 0.00 37.50 0.00 3.04 14 0.034 0 0.000 0.034 0.00 14.29 37.50 0.00 3.04 15 0.036 0 0.000 0.036 0.01 0.00 37.50 1.43 3.04 16 0.038 0 0.000 0.038 0.00 0.00 37.50 1.43 3.04 17 0.040 0 0.000 0.040 0.00 0.00 37.50 1.43 3.04 18 0.041 0 0.000 0.041 0.00 0.00 37.50 1.43 3.04 19 0.042 0 0.000 0.042 0.00 0.00 37.50 1.43 3.04 20 0.043 0 0.000 0.043 0.00 0.00 37.50 1.43 3.04 21 0.044 0 0.000 0.044 0.00 0.00 37.50 1.43 3.04 22 0.044 0 0.000 0.044
老年代和持久带的收集过程
C:\>java -Xms20M -Xmx20M -Xmn10M -XX:+PrintGCDetails -XX:+ScavengeBeforeFullGC - XX:PretenureSizeThreshold=2097152 -XX:+UseSerialGC Test2 [GC [Tenured: 9216K->146K(10240K), 0.0310260 secs] 9543K->146K(19456K), [Perm : 373K->373K(12288K)], 0.0322100 secs] [Times: user=0.03 sys=0.00, real=0.03 secs] [GC [Tenured: 9362K->146K(10240K), 0.0238268 secs] 12762K->146K(19456K), [Perm : 373K->373K(12288K)], 0.0256443 secs] [Times: user=0.02 sys=0.00, real=0.01 secs ] Heap def new generation total 9216K, used 3563K [0x315e0000, 0x31fe0000, 0x31fe000 0) eden space 8192K, 43% used [0x315e0000, 0x3195ae88, 0x31de0000) from space 1024K, 0% used [0x31de0000, 0x31de0000, 0x31ee0000) to space 1024K, 0% used [0x31ee0000, 0x31ee0000, 0x31fe0000) tenured generation total 10240K, used 3218K [0x31fe0000, 0x329e0000, 0x329e00 00) the space 10240K, 31% used [0x31fe0000, 0x32304a00, 0x32304a00, 0x329e0000) compacting perm gen total 12288K, used 374K [0x329e0000, 0x335e0000, 0x369e000 0) the space 12288K, 3% used [0x329e0000, 0x32a3dba0, 0x32a3dc00, 0x335e0000) ro space 10240K, 54% used [0x369e0000, 0x36f5ee00, 0x36f5ee00, 0x373e0000) rw space 12288K, 55% used [0x373e0000, 0x37a82800, 0x37a82800, 0x37fe0000)
只触发了FGC,但是却没有YGC
C:\>jstat -gcutil 2572 1000 20 S0 S1 E O P YGC YGCT FGC FGCT GCT 0.00 0.00 39.50 31.43 3.04 0 0.000 23 0.621 0.621 0.00 0.00 39.50 31.43 3.04 0 0.000 25 0.675 0.675 0.00 0.00 39.50 31.43 3.04 0 0.000 27 0.728 0.728 0.00 0.00 39.50 31.43 3.04 0 0.000 29 0.782 0.782 0.00 0.00 39.50 31.43 3.04 0 0.000 31 0.837 0.837 0.00 0.00 39.50 31.30 3.00 0 0.000 33 0.891 0.891
如果开启Syste.gc(),也是一样,只有FGC,没有YGC
C:\>java -Xms20M -Xmx20M -Xmn10M -XX:+PrintGCDetails -XX:+ScavengeBeforeFullGC - XX:PretenureSizeThreshold=2097152 -XX:+UseSerialGC Test2 [Full GC (System) [Tenured: 3072K->3218K(10240K), 0.0281815 secs] 3399K->3218K(1 9456K), [Perm : 373K->373K(12288K)], 0.0297979 secs] [Times: user=0.03 sys=0.00, real=0.03 secs] [Full GC (System) [Tenured: 3218K->3218K(10240K), 0.0269135 secs] 6618K->3218K(1 9456K), [Perm : 373K->373K(12288K)], 0.0280661 secs] [Times: user=0.02 sys=0.00, real=0.03 secs] Heap def new generation total 9216K, used 3563K [0x315e0000, 0x31fe0000, 0x31fe000 0) eden space 8192K, 43% used [0x315e0000, 0x3195ae88, 0x31de0000) from space 1024K, 0% used [0x31de0000, 0x31de0000, 0x31ee0000) to space 1024K, 0% used [0x31ee0000, 0x31ee0000, 0x31fe0000) tenured generation total 10240K, used 3218K [0x31fe0000, 0x329e0000, 0x329e00 00) the space 10240K, 31% used [0x31fe0000, 0x32304930, 0x32304a00, 0x329e0000) compacting perm gen total 12288K, used 374K [0x329e0000, 0x335e0000, 0x369e000 0) the space 12288K, 3% used [0x329e0000, 0x32a3dbd8, 0x32a3dc00, 0x335e0000) ro space 10240K, 54% used [0x369e0000, 0x36f5ee00, 0x36f5ee00, 0x373e0000) rw space 12288K, 55% used [0x373e0000, 0x37a82800, 0x37a82800, 0x37fe0000)
C:\>jstat -gcutil 3724 1000 20 S0 S1 E O P YGC YGCT FGC FGCT GCT 0.00 0.00 0.00 31.43 3.04 0 0.000 20 0.535 0.535 0.00 0.00 39.50 31.43 3.04 0 0.000 21 0.551 0.551 0.00 0.00 39.50 31.43 3.04 0 0.000 23 0.604 0.604 0.00 0.00 39.50 31.43 3.04 0 0.000 25 0.659 0.659 0.00 0.00 39.50 31.43 3.04 0 0.000 27 0.715 0.715 0.00 0.00 39.50 31.43 3.04 0 0.000 29 0.768 0.768 0.00 0.00 39.50 31.43 3.04 0 0.000 31 0.823 0.823
Parallel Scavenge +Parallel Old 组合显示的结果,full gc通过(System.gc())触发,
年轻代收集器名称 PSYoungGen
老年代ParOldGen, 持久带PSPermGen
年轻代的收集过程,只触发YGC
C:\>java -Xmx15M -Xms15M -Xmn10M -XX:+PrintGCDetails -XX:+ScavengeBeforeFullGC - XX:PretenureSizeThreshold=2097152 -XX:+UseParallelOldGC -XX:ParallelGCThreads=10 Test2 [GC [PSYoungGen: 4419K->176K(8960K)] 8515K->4272K(15104K), 0.0034451 secs] [Time s: user=0.03 sys=0.00, real=0.02 secs] [GC [PSYoungGen: 4425K->168K(8960K)] 8521K->4264K(15104K), 0.0032476 secs] [Time s: user=0.00 sys=0.00, real=0.00 secs] Heap PSYoungGen total 8960K, used 4571K [0x06ff0000, 0x079f0000, 0x079f0000) eden space 7680K, 57% used [0x06ff0000,0x0743cd38,0x07770000) from space 1280K, 13% used [0x078b0000,0x078da030,0x079f0000) to space 1280K, 0% used [0x07770000,0x07770000,0x078b0000) ParOldGen total 6144K, used 4096K [0x069f0000, 0x06ff0000, 0x06ff0000) object space 6144K, 66% used [0x069f0000,0x06df0010,0x06ff0000) PSPermGen total 12288K, used 2104K [0x029f0000, 0x035f0000, 0x069f0000) object space 12288K, 17% used [0x029f0000,0x02bfe3c8,0x035f0000)
通过程序触发的full gc,此时YGC,FGC都会触发
C:\>java -Xms20M -Xmx20M -Xmn10M -XX:+PrintGCDetails -XX:-ScavengeBeforeFullGC -XX:PretenureSizeThreshold=2097152 -XX:+UseParallelOldGC Test2 [Full GC (System) [PSYoungGen: 3395K->0K(8960K)] [ParOldGen: 0K->3218K(10240K)] 3395K->3218K(19200K) [PSPermGen: 2091K->2091K(12288K)], 0.0317060 secs] [Times: user=0.05 sys=0.00, real=0.03 secs] [Full GC (System) [PSYoungGen: 3379K->0K(8960K)] [ParOldGen: 3218K->3218K(10240K )] 6597K->3218K(19200K) [PSPermGen: 2097K->2097K(12288K)], 0.0238544 secs] [Time s: user=0.01 sys=0.00, real=0.02 secs] [Full GC (System) [PSYoungGen: 3225K->0K(8960K)] [ParOldGen: 3218K->3218K(10240K )] 6443K->3218K(19200K) [PSPermGen: 2097K->2097K(12288K)], 0.0254747 secs] [Time s: user=0.02 sys=0.00, real=0.02 secs] Heap PSYoungGen total 8960K, used 3532K [0x073f0000, 0x07df0000, 0x07df0000) eden space 7680K, 46% used [0x073f0000,0x077633a0,0x07b70000) from space 1280K, 0% used [0x07cb0000,0x07cb0000,0x07df0000) to space 1280K, 0% used [0x07b70000,0x07b70000,0x07cb0000) ParOldGen total 10240K, used 3218K [0x069f0000, 0x073f0000, 0x073f0000) object space 10240K, 31% used [0x069f0000,0x06d14928,0x073f0000) PSPermGen total 12288K, used 2104K [0x029f0000, 0x035f0000, 0x069f0000) object space 12288K, 17% used [0x029f0000,0x02bfe108,0x035f0000)
Parallel GC的线程名
"GC task thread#0 (ParallelGC)" prio=6 tid=0x0031e000 nid=0x988 runnable
使用ParNew + ConcMarkSweep ,full gc通过(System.gc())触发,
ParNew GC的线程名
"Gang worker#0 (Parallel GC Threads)" prio=10 tid=0x0031bc00 nid=0x604 runnable
CMS线程名
"Concurrent Mark-Sweep GC Thread" prio=10 tid=0x0836e400 nid=0xe18 runnable "Gang worker#0 (Parallel CMS Threads)" prio=10 tid=0x082cc000 nid=0xd18 runnable
年轻代收集过程,此时只会触发YGC
C:\>java -Xmx20M -Xms20M -Xmn10M -XX:+PrintGCDetails -XX:+UseConcMarkSweepGC -X X:ParallelGCThreads=10 Test2 [GC [ParNew: 4423K->168K(9216K), 0.0055490 secs] 4423K->168K(19456K), 0.0062150 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] [GC [ParNew: 4428K->176K(9216K), 0.0032652 secs] 4428K->176K(19456K), 0.0044014 secs] [Times: user=0.03 sys=0.00, real=0.02 secs] Heap par new generation total 9216K, used 4600K [0x02e10000, 0x03810000, 0x0381000 0) eden space 8192K, 54% used [0x02e10000, 0x03261f28, 0x03610000) from space 1024K, 17% used [0x03610000, 0x0363c3c0, 0x03710000) to space 1024K, 0% used [0x03710000, 0x03710000, 0x03810000) concurrent mark-sweep generation total 10240K, used 0K [0x03810000, 0x04210000, 0x04210000) concurrent-mark-sweep perm gen total 12288K, used 2104K [0x04210000, 0x04e10000 , 0x08210000)
老年代和持久带收集过程,只会触发FGC
C:\>java -Xmx20M -Xms20M -Xmn10M -XX:+PrintGCDetails -XX:+UseConcMarkSweepGC -X X:ParallelGCThreads=10 -XX:PretenureSizeThreshold=2097152 Test2 [GC [CMS: 8192K->146K(10240K), 0.0272448 secs] 8519K->146K(19456K), [CMS Perm : 2091K->2091K(12288K)], 0.0294118 secs] [Times: user=0.01 sys=0.02, real=0.03 sec s] [GC [CMS: 8338K->146K(10240K), 0.0229166 secs] 12762K->146K(19456K), [CMS Perm : 2097K->2097K(12288K)], 0.0248618 secs] [Times: user=0.01 sys=0.00, real=0.01 se cs] [GC [1 CMS-initial-mark: 8338K(10240K)] 12519K(19456K), 0.0010387 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] [CMS-concurrent-mark: 0.009/0.009 secs] [Times: user=0.03 sys=0.00, real=0.02 se cs] [CMS-concurrent-preclean: 0.000/0.000 secs] [Times: user=0.00 sys=0.00, real=0.0 0 secs] [GC [CMS[CMS-concurrent-abortable-preclean: 0.000/0.035 secs] [Times: user=0.00 sys=0.00, real=0.03 secs] (concurrent mode failure): 8338K->146K(10240K), 0.0236156 secs] 12519K->146K(19 456K), [CMS Perm : 2097K->2097K(12288K)], 0.0257522 secs] [Times: user=0.02 sys= 0.00, real=0.03 secs] [GC [CMS: 8338K->146K(10240K), 0.0213714 secs] 12491K->146K(19456K), [CMS Perm : 2097K->2097K(12288K)], 0.0231105 secs] [Times: user=0.03 sys=0.00, real=0.03 se cs] [GC [CMS: 8338K->146K(10240K), 0.0224847 secs] 12472K->146K(19456K), [CMS Perm : 2097K->2097K(12288K)], 0.0243117 secs] [Times: user=0.03 sys=0.00, real=0.03 se cs] [GC [CMS: 8338K->146K(10240K), 0.0219254 secs] 12459K->146K(19456K), [CMS Perm : 2097K->2097K(12288K)], 0.0242763 secs] [Times: user=0.02 sys=0.01, real=0.03 se cs] Heap par new generation total 9216K, used 4440K [0x02e10000, 0x03810000, 0x0381000 0) eden space 8192K, 54% used [0x02e10000, 0x03266128, 0x03610000) from space 1024K, 0% used [0x03610000, 0x03610000, 0x03710000) to space 1024K, 0% used [0x03710000, 0x03710000, 0x03810000) concurrent mark-sweep generation total 10240K, used 4242K [0x03810000, 0x042100 00, 0x04210000) concurrent-mark-sweep perm gen total 12288K, used 2104K [0x04210000, 0x04e10000 , 0x08210000)
通过System.gc()触发,此时只有FGC,没有YGC
C:\>java -Xmx20M -Xms20M -Xmn10M -XX:+PrintGCDetails -XX:+UseConcMarkSweepGC -X X:ParallelGCThreads=10 -XX:PretenureSizeThreshold=2097152 -XX:+ScavengeBeforeFul lGC Test2 [Full GC (System) [CMS: 4096K->4242K(10240K), 0.0274647 secs] 4423K->4242K(19456 K), [CMS Perm : 2091K->2091K(12288K)], 0.0289805 secs] [Times: user=0.03 sys=0.0 0, real=0.03 secs] [Full GC (System) [CMS: 4242K->4242K(10240K), 0.0256547 secs] 8666K->4242K(19456 K), [CMS Perm : 2097K->2097K(12288K)], 0.0265903 secs] [Times: user=0.02 sys=0.0 0, real=0.02 secs] [Full GC (System) [CMS: 4242K->4242K(10240K), 0.0258008 secs] 8423K->4242K(19456 K), [CMS Perm : 2097K->2097K(12288K)], 0.0271459 secs] [Times: user=0.02 sys=0.0 0, real=0.01 secs] Heap par new generation total 9216K, used 4480K [0x02e10000, 0x03810000, 0x0381000 0) eden space 8192K, 54% used [0x02e10000, 0x032700b0, 0x03610000) from space 1024K, 0% used [0x03610000, 0x03610000, 0x03710000) to space 1024K, 0% used [0x03710000, 0x03710000, 0x03810000) concurrent mark-sweep generation total 10240K, used 4242K [0x03810000, 0x042100 00, 0x04210000) concurrent-mark-sweep perm gen total 12288K, used 2104K [0x04210000, 0x04e10000 , 0x08210000)
CMS中有,初始化,并发标记,重新标记,并发清除几个阶段
以下是初始化,并发标记
C:\>java -Xmx15M -Xms15M -Xmn10M -XX:+PrintGCDetails -XX:+UseConcMarkSweepGC -X X:ParallelGCThreads=10 -XX:PretenureSizeThreshold=2097152 -XX:+ScavengeBeforeFul lGC Test2
[GC [1 CMS-initial-mark: 4242K(6144K)] 4242K(15360K), 0.0007012 secs] [Times: us er=0.00 sys=0.00, real=0.00 secs] [CMS-concurrent-mark: 0.009/0.009 secs] [Times: user=0.02 sys=0.01, real=0.02 se cs]
重新标记,并发清除
[GC[YG occupancy: 4106 K (9216 K)][Rescan (parallel) , 0.0013488 secs][weak refs processing, 0.0000218 secs] [1 CMS-remark: 4242K(6144K)] 8349K(15360K), 0.00288 98 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] [CMS-concurrent-sweep: 0.000/0.000 secs] [Times: user=0.01 sys=0.00, real=0.01 s ecs] [CMS-concurrent-reset: 0.001/0.001 secs] [Times: user=0.00 sys=0.00, real=0.00 s ecs]
此外还有扫描中断:
[Full GC (System) [CMS[CMS-concurrent-abortable-preclean: 0.001/0.499 secs] [Tim es: user=0.00 sys=0.00, real=0.50 secs] (concurrent mode interrupted): 4242K->4242K(6144K), 0.0266688 secs] 8363K->4242 K(15360K), [CMS Perm : 2097K->2097K(12288K)], 0.0283159 secs] [Times: user=0.03 sys=0.00, real=0.03 secs]
处理失败的情况,此时使用serial old:
(concurrent mode failure): 8338K->146K(10240K), 0.0260159 secs] 12519K->146K(19 456K), [CMS Perm : 2097K->2097K(12288K)], 0.0277560 secs] [Times: user=0.02 sys= 0.01, real=0.03 secs]
最后是G1,其线程名如下:
"Gang worker#0 (Parallel GC Threads)" prio=10 tid=0x08a4f800 nid=0x108d runnable "G1 Main Concurrent Mark GC Thread" prio=10 tid=0x08a6a400 nid=0x1090 runnable "Gang worker#0 (G1 Parallel Marking Threads)" prio=10 tid=0x08a7bc00 nid=0x1091 runnable "G1 Concurrent Refinement Thread#0" prio=10 tid=0x08a62800 nid=0x108f runnable "G1 Concurrent Refinement Thread#1" prio=10 tid=0x08a61000 nid=0x108e runnable
清扫过程:由于G1不能很好的和jstat配合工作,因此看不到gcutil情况
[GC pause (young), 0.00875300 secs] [Parallel Time: 8.6 ms] [GC Worker Start Time (ms): 19253.4] [Update RS (ms): 0.0 Avg: 0.0, Min: 0.0, Max: 0.0] [Processed Buffers : 0 Sum: 0, Avg: 0, Min: 0, Max: 0] [Ext Root Scanning (ms): 7.5 Avg: 7.5, Min: 7.5, Max: 7.5] [Mark Stack Scanning (ms): 0.0 Avg: 0.0, Min: 0.0, Max: 0.0] [Scan RS (ms): 0.0 Avg: 0.0, Min: 0.0, Max: 0.0] [Object Copy (ms): 0.1 Avg: 0.1, Min: 0.1, Max: 0.1] [Termination (ms): 0.0 Avg: 0.0, Min: 0.0, Max: 0.0] [Termination Attempts : 1 Sum: 1, Avg: 1, Min: 1, Max: 1] [GC Worker End Time (ms): 19261.2] [Other: 0.9 ms] [Clear CT: 0.0 ms] [Other: 0.1 ms] [Choose CSet: 0.0 ms] [ 12M->12M(20M)] [Times: user=0.00 sys=0.00, real=0.01 secs] [Full GC 12M->114K(20M), 0.0280980 secs] [Times: user=0.02 sys=0.00, real=0.02 secs] [GC pause (young), 0.00837900 secs] [Parallel Time: 8.1 ms] [GC Worker Start Time (ms): 21412.9] [Update RS (ms): 0.0 Avg: 0.0, Min: 0.0, Max: 0.0] [Processed Buffers : 0 Sum: 0, Avg: 0, Min: 0, Max: 0] [Ext Root Scanning (ms): 6.8 Avg: 6.8, Min: 6.8, Max: 6.8] [Mark Stack Scanning (ms): 0.0 Avg: 0.0, Min: 0.0, Max: 0.0] [Scan RS (ms): 0.0 Avg: 0.0, Min: 0.0, Max: 0.0] [Object Copy (ms): 0.1 Avg: 0.1, Min: 0.1, Max: 0.1] [Termination (ms): 0.0 Avg: 0.0, Min: 0.0, Max: 0.0] [Termination Attempts : 1 Sum: 1, Avg: 1, Min: 1, Max: 1] [GC Worker End Time (ms): 21419.9] [Other: 1.1 ms] [Clear CT: 0.1 ms] [Other: 0.1 ms] [Choose CSet: 0.0 ms] [ 12M->12M(20M)] [Times: user=0.00 sys=0.00, real=0.01 secs] [Full GC 12M->101K(20M), 0.0368190 secs] [Times: user=0.04 sys=0.00, real=0.02 secs] Heap garbage-first heap total 20480K, used 8293K [0xaff00000, 0xb1300000, 0xb1300000) region size 1024K, 1 young (1024K), 0 survivors (0K) compacting perm gen total 12288K, used 1724K [0xb1300000, 0xb1f00000, 0xb5300000) the space 12288K, 14% used [0xb1300000, 0xb14af300, 0xb14af400, 0xb1f00000) No shared spaces configured.
jdk1.7.0_04 打开G1,jstat,jmap等工具可以正常使用。
C:\jdk1.7.0_04\bin>java -Xmx20M -Xms20M -Xmn10M -XX:+UseG1GC -XX:+PrintGCDet ails Test2 [GC pause (young) (initial-mark), 0.00661676 secs] [Parallel Time: 5.7 ms] [GC Worker Start (ms): 747.9 747.9 Avg: 747.9, Min: 747.9, Max: 747.9, Diff: 0.0] [Ext Root Scanning (ms): 2.1 1.9 Avg: 2.0, Min: 1.9, Max: 2.1, Diff: 0.2] [Update RS (ms): 0.0 0.1 Avg: 0.1, Min: 0.0, Max: 0.1, Diff: 0.1] [Processed Buffers : 0 5 Sum: 5, Avg: 2, Min: 0, Max: 5, Diff: 5] [Scan RS (ms): 0.0 0.0 Avg: 0.0, Min: 0.0, Max: 0.0, Diff: 0.0] [Object Copy (ms): 3.3 3.3 Avg: 3.3, Min: 3.3, Max: 3.3, Diff: 0.1] [Termination (ms): 0.0 0.0 Avg: 0.0, Min: 0.0, Max: 0.0, Diff: 0.0] [Termination Attempts : 1 1 Sum: 2, Avg: 1, Min: 1, Max: 1, Diff: 0] [GC Worker End (ms): 753.4 753.4 Avg: 753.4, Min: 753.4, Max: 753.4, Diff: 0.0] [GC Worker (ms): 5.5 5.5 Avg: 5.5, Min: 5.5, Max: 5.5, Diff: 0.0] [GC Worker Other (ms): 0.3 0.3 Avg: 0.3, Min: 0.3, Max: 0.3, Diff: 0.0] [Clear CT: 0.0 ms] [Other: 0.9 ms] [Choose CSet: 0.0 ms] [Ref Proc: 0.1 ms] [Ref Enq: 0.0 ms] [Free CSet: 0.0 ms] [Eden: 1024K(10M)->0B(9216K) Survivors: 0B->1024K Heap: 4663K(20M)->4560K(20M )] [Times: user=0.03 sys=0.00, real=0.02 secs] [GC concurrent-root-region-scan-start] [GC concurrent-root-region-scan-end, 0.0019206] [GC concurrent-mark-start] [GC concurrent-mark-end, 0.0012521 sec] [GC remark [GC ref-proc, 0.0000235 secs], 0.0031993 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] [GC cleanup 8697K->4601K(20M), 0.0008915 secs] [Times: user=0.00 sys=0.02, real=0.02 secs] [GC concurrent-cleanup-start] [GC concurrent-cleanup-end, 0.0004232] [GC pause (young) (initial-mark), 0.00516323 secs] [Parallel Time: 4.3 ms] [GC Worker Start (ms): 1281.0 1281.0 Avg: 1281.0, Min: 1281.0, Max: 1281.0, Diff: 0.0] [Ext Root Scanning (ms): 1.5 1.4 Avg: 1.4, Min: 1.4, Max: 1.5, Diff: 0.1] [Update RS (ms): 0.0 0.0 Avg: 0.0, Min: 0.0, Max: 0.0, Diff: 0.0] [Processed Buffers : 0 2 Sum: 2, Avg: 1, Min: 0, Max: 2, Diff: 2] [Scan RS (ms): 0.0 0.0 Avg: 0.0, Min: 0.0, Max: 0.0, Diff: 0.0] [Object Copy (ms): 2.7 2.7 Avg: 2.7, Min: 2.7, Max: 2.7, Diff: 0.0] [Termination (ms): 0.0 0.0 Avg: 0.0, Min: 0.0, Max: 0.0, Diff: 0.0] [Termination Attempts : 1 1 Sum: 2, Avg: 1, Min: 1, Max: 1, Diff: 0] [GC Worker End (ms): 1285.2 1285.2 Avg: 1285.2, Min: 1285.2, Max: 1285.2, Diff: 0.0] [GC Worker (ms): 4.2 4.2 Avg: 4.2, Min: 4.2, Max: 4.2, Diff: 0.0] [GC Worker Other (ms): 0.1 0.1 Avg: 0.1, Min: 0.1, Max: 0.1, Diff: 0.0] [Clear CT: 0.0 ms] [Other: 0.9 ms] [Choose CSet: 0.0 ms] [Ref Proc: 0.1 ms] [Ref Enq: 0.0 ms] [Free CSet: 0.0 ms] [Eden: 1024K(9216K)->0B(9216K) Survivors: 1024K->1024K Heap: 4601K(20M)->4544 K(20M)] [Times: user=0.03 sys=0.00, real=0.03 secs] [GC concurrent-root-region-scan-start] [GC concurrent-root-region-scan-end, 0.0016821] [GC concurrent-mark-start] [GC concurrent-mark-end, 0.0005808 sec] [GC remark [GC ref-proc, 0.0000212 secs], 0.0029291 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] [GC cleanup 8640K->4544K(20M), 0.0008895 secs] [Times: user=0.00 sys=0.00, real=0.02 secs] [GC concurrent-cleanup-start] [GC concurrent-cleanup-end, 0.0005897] [GC pause (young) (initial-mark), 0.00520737 secs] [Parallel Time: 4.3 ms] [GC Worker Start (ms): 1812.2 1812.2 Avg: 1812.2, Min: 1812.2, Max: 1812.2, Diff: 0.0] [Ext Root Scanning (ms): 1.5 1.3 Avg: 1.4, Min: 1.3, Max: 1.5, Diff: 0.2] [Update RS (ms): 0.0 0.0 Avg: 0.0, Min: 0.0, Max: 0.0, Diff: 0.0] [Processed Buffers : 0 0 Sum: 0, Avg: 0, Min: 0, Max: 0, Diff: 0] [Scan RS (ms): 0.0 0.0 Avg: 0.0, Min: 0.0, Max: 0.0, Diff: 0.0] [Object Copy (ms): 2.6 2.8 Avg: 2.7, Min: 2.6, Max: 2.8, Diff: 0.2] [Termination (ms): 0.0 0.0 Avg: 0.0, Min: 0.0, Max: 0.0, Diff: 0.0] [Termination Attempts : 1 1 Sum: 2, Avg: 1, Min: 1, Max: 1, Diff: 0] [GC Worker End (ms): 1816.4 1816.4 Avg: 1816.4, Min: 1816.4, Max: 1816.4, Diff: 0.0] [GC Worker (ms): 4.2 4.2 Avg: 4.2, Min: 4.2, Max: 4.2, Diff: 0.0] [GC Worker Other (ms): 0.1 0.1 Avg: 0.1, Min: 0.1, Max: 0.1, Diff: 0.0] [Clear CT: 0.0 ms] [Other: 0.9 ms] [Choose CSet: 0.0 ms] [Ref Proc: 0.1 ms] [Ref Enq: 0.0 ms] [Free CSet: 0.0 ms] [Eden: 0B(9216K)->0B(9216K) Survivors: 1024K->1024K Heap: 4544K(20M)->4544K(2 0M)] [Times: user=0.03 sys=0.00, real=0.03 secs] [GC concurrent-root-region-scan-start] [GC concurrent-root-region-scan-end, 0.0014873] [GC concurrent-mark-start] [GC concurrent-mark-end, 0.0006668 sec] [GC remark [GC ref-proc, 0.0000263 secs], 0.0028615 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] [GC cleanup 8640K->4544K(20M), 0.0007965 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] [GC concurrent-cleanup-start] [GC concurrent-cleanup-end, 0.0006168] Heap garbage-first heap total 20480K, used 4544K [0x02d00000, 0x04100000, 0x041000 00) region size 1024K, 2 young (2048K), 1 survivors (1024K) compacting perm gen total 12288K, used 1572K [0x04100000, 0x04d00000, 0x081000 00) the space 12288K, 12% used [0x04100000, 0x042893d0, 0x04289400, 0x04d00000) No shared spaces configured.
参考
Tenured 区并发垃圾回收器CMS介绍
http://blog.csdn.net/lxb_champagne/article/details/18357947
千丝万缕的FGC与Buffer Pool
http://fx114.net/qa-132-149018.aspx
发表评论
-
JVM字节码指令
2014-06-26 13:49 529实例分析Java Class的文件结构 http ... -
JVM字节码
2014-06-26 13:49 519实例分析Java Class的文件结构 h ... -
JVM参数调优
2014-06-23 20:00 509java -XX:+PrintFlags ... -
JVM自带的工具
2014-06-23 16:57 420appletviewer idlj ja ... -
JVM监控工具
2014-06-23 12:54 444JPS(虚拟机进程状态工具) 参数 含义 ... -
GC调优
2014-05-22 20:43 19-XX:+CMSIncrementalMode启用垃圾回收增 ... -
虚拟机相关
2012-12-21 19:03 696.Net 垃圾回收和大对象处理 http://blog.job ... -
Java字节码格式
2012-10-24 17:06 806实例分析Java Class的文件结构 http://cool ... -
jvm bug
2012-09-10 18:20 809jvm进程明明存在,但是执行jps,jstat却找不到 js ... -
JVM,内存相关
2012-04-04 17:20 1006从 Java 代码到 Java 堆 http://www.ib ... -
调优实践
2012-03-29 20:43 69关于CMS垃圾回收 http://www.iteye.com/ ... -
JVM工具
2012-02-23 19:24 213JVM监控工具介绍jstack, jconsole, jinf ... -
JVM文章汇总
2012-02-03 17:46 912JVM线程知多少 http://www.goldendoc.o ... -
JPDA文章汇总
2012-02-02 16:15 1354深入 Java 调试体系: 第 1 部分,JPDA 体系概览 ... -
GC调优文章
2012-02-01 17:14 787官方: http://www.oracle.com/techn ...
相关推荐
### 性能工程师指南:玩转OpenJDK HotSpot垃圾收集器 #### 一、性能工程概述 在软件开发过程中,性能工程是一个重要的环节,它不仅涵盖了对软件性能的需求定义与测试计划制定,还包括了软件的开发、实施及后续的...
性能工程师指南:玩转OpenJDK HotSpot垃圾收集器.ppt性能工程师指南:玩转OpenJDK HotSpot垃圾收集器.ppt性能工程师指南:玩转OpenJDK HotSpot垃圾收集器.ppt性能工程师指南:玩转OpenJDK HotSpot垃圾收集器.ppt性能...
《性能工程师指南:玩转OpenJDK HotSpot垃圾收集器》是一本专注于Java应用程序性能优化的专业书籍,尤其针对OpenJDK HotSpot虚拟机的垃圾收集器进行了深入探讨。该书共83页,旨在帮助性能工程师理解并优化Java应用的...
##### 4.2 HotSpot垃圾收集器实现 HotSpot虚拟机提供了多种垃圾收集器,包括Serial、Parallel Scavenge、Serial Old、Parallel Old、CMS、G1等,每种收集器都有自己的特点和适用场景。 - **Serial垃圾收集器**:单...
HotSpot 虚拟机提供了多种垃圾收集器,可以根据不同的应用场景选择合适的垃圾收集器。常见的垃圾收集器类型包括: * Serial 垃圾收集器:使用单线程进行垃圾收集,适合小型应用程序。 * Parallel 垃圾收集器:使用...
本指南主要涵盖了垃圾收集器的优化目标、策略以及各种实现,旨在帮助开发者更好地理解如何调整 JVM 参数以满足特定的需求。 优化目标与策略(Ergonomics) Java HotSpot VM 提供了两种主要的优化目标:最大暂停时间...
在本文中,我们将探讨如何实现一个简单的垃圾收集器,这是一个基础的自动化内存管理系统,主要针对Java环境。垃圾收集器是现代编程语言运行时系统的关键组件,负责自动管理内存,回收不再使用的对象以避免内存泄漏。...
文档接下来介绍J2SE 5.0 HotSpot JVM中的垃圾收集器,包括垃圾收集器的类型、快速分配、串行收集器、并行收集器、并行压缩收集器和并发标记-清除(CMS)收集器。此外,还探讨了自动选择收集器、堆大小和虚拟机的行为...
Java HotSpot虚拟机提供了垃圾收集器监控功能,用于实时监控垃圾收集器的活动信息。使用 `-XX:+UseGCLog`选项来启用垃圾收集器监控。 结论 Java HotSpot虚拟机提供了多种垃圾收集算法和调整选项,满足不同应用场景...
以上内容概述了Java HotSpot虚拟机内存管理的核心概念、垃圾收集器的设计与选择、以及性能调优的建议和工具。对于Java开发和系统管理员来说,理解这些概念和工具对于编写高效、稳定的Java应用程序至关重要。
#### 四、HotSpot垃圾收集器 HotSpot提供了多种垃圾收集器来适应不同的应用场景: - **年轻代(Young Generation)** - **年老代(Old Generation)** - **CMS收集器**:Concurrent Mark Sweep收集器,是一种以获取...
【HotSpot GC官网文档截图 - 20200917】是一个珍贵的资源集合,包含了一系列关于Java HotSpot虚拟机(JVM)垃圾收集器(GC)的官方文档截图。这些截图详细介绍了GC的发展历程、不同版本的特性、选择GC的策略以及调优...
5. **垃圾收集器**:Hotspot的垃圾收集器源代码展示了各种GC算法的实现,如CMS的并发标记清除过程,G1的 Region 分区和并行回收,以及ZGC的低暂停时间设计。 三、源代码学习的价值 1. **性能优化**:通过深入源...
4. **垃圾收集算法**:HotSpot支持多种垃圾收集器,如Serial、Parallel、CMS(Concurrent Mark Sweep)、G1(Garbage-First)和ZGC(Z Garbage Collector)。每种收集器有其特定的设计目标和适用场景,书里会对比...
Hotspot JVM提供了多种垃圾收集器,如Serial、Parallel、Concurrent Mark Sweep (CMS) 和Garbage First (G1)。这些收集器在内存管理和回收策略上各有特点,可以根据不同的应用场景进行选择。例如,G1收集器采用了...
Serial Garbage Collector 是一种 serial 模式的垃圾收集器,适用于小型应用程序。Parallel Garbage Collector 是一种并行模式的垃圾收集器,适用于大型应用程序。 垃圾收集类型 HotSpot 虚拟机中有三种垃圾收集...
gcviz 是垃圾收集器可视化工具/框架。gcviz 是帮助生成 gc.log 可视化的程序集合。HotSpot,一个 Java 可视化机制,用以下标记配置: -verbose:gc -verbose:sizes -Xloggc:/apps/tomcat/logs/gc.log -XX: ...
Cache、Perf Data、Crash 分析方法、转储分析方法、 垃圾收集器的设计演进、CMS 和 G1 收集器、栈、JVM 对硬件寄存器的利用、栈顶缓存技术、解释器、字节 码表、转发表、Stubs、Code Cache、Code 生成器、JIT 编译器...
4. 垃圾收集器:HotSpot提供了多种垃圾收集器,如Serial、Parallel、CMS、G1和ZGC等。每种收集器都有其独特的设计理念,例如,CMS适用于低暂停时间需求,而G1则追求空间局部性和停顿预测。这些收集器的源码实现复杂...
HotSpot包含两种垃圾收集器:Serial和Parallel。 2. **垃圾收集(GC)**:GC是Java内存管理的关键部分,负责自动释放不再使用的对象所占用的内存空间,以防止内存泄漏。GC过程包括年轻代收集、老年代收集以及全堆收集...