码迷,mamicode.com
首页 > 其他好文 > 详细

JVM试用G1的垃圾收集器

时间:2015-01-09 12:04:58      阅读:272      评论:0      收藏:0      [点我收藏+]

标签:

因为以前用默认的GC,,老年代经常在占比超过99%才发生一个GC行为,感觉不爽。。。尽管每次FULL GC只要0.5S。

结合上次听中华构架师大会,一哥们分享的G1 GC。。。试试。。

就在TOMCAT的catania.sh里JAVA的启动参数加一段吧。。

JAVA_OPTS=‘ -Xms512m -Xmx1024m -XX:PermSize=256M -XX:MaxNewSize=256m -XX:MaxPermSize=256m -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC

JMAP输出如下啦:

jmap -heap xxxx
Attaching to process ID xxx, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 24.0-b56

using thread-local object allocation.
Garbage-First (G1) GC with 4 thread(s)

Heap Configuration:
   MinHeapFreeRatio = 40
   MaxHeapFreeRatio = 70
   MaxHeapSize      = 1073741824 (1024.0MB)
   NewSize          = 1363144 (1.2999954223632812MB)
   MaxNewSize       = 268435456 (256.0MB)
   OldSize          = 5452592 (5.1999969482421875MB)
   NewRatio         = 2
   SurvivorRatio    = 8
   PermSize         = 268435456 (256.0MB)
   MaxPermSize      = 268435456 (256.0MB)
   G1HeapRegionSize = 1048576 (1.0MB)

Heap Usage:
G1 Heap:
   regions  = 1024
   capacity = 1073741824 (1024.0MB)
   used     = 525790240 (501.4326477050781MB)
   free     = 547951584 (522.5673522949219MB)
   48.968032002449036% used
G1 Young Generation:
Eden Space:
   regions  = 108
   capacity = 275775488 (263.0MB)
   used     = 113246208 (108.0MB)
   free     = 162529280 (155.0MB)
   41.06463878326996% used
Survivor Space:
   regions  = 6
   capacity = 6291456 (6.0MB)
   used     = 6291456 (6.0MB)
   free     = 0 (0.0MB)
   100.0% used
G1 Old Generation:
   regions  = 415
   capacity = 791674880 (755.0MB)
   used     = 406252576 (387.4326477050781MB)
   free     = 385422304 (367.5673522949219MB)
   51.31558247749379% used
Perm Generation:
   capacity = 268435456 (256.0MB)
   used     = 65695576 (62.652183532714844MB)
   free     = 202739880 (193.34781646728516MB)
   24.473509192466736% used

35236 interned Strings occupying 3876240 bytes.

JMAP相关GC输出如下:

jstat -gc xxxx 1000 10
 S0C    S1C    S0U    S1U      EC       EU        OC         OU       PC     PU    YGC     YGCT    FGC    FGCT     GCT   
 0.0   6144.0  0.0   6144.0 269312.0 81920.0   773120.0   396840.2  262144.0 64155.8   3579   84.690   0      0.000   84.690
 0.0   6144.0  0.0   6144.0 269312.0 100352.0  773120.0   396840.2  262144.0 64155.8   3579   84.690   0      0.000   84.690
 0.0   6144.0  0.0   6144.0 269312.0 120832.0  773120.0   396840.2  262144.0 64155.8   3579   84.690   0      0.000   84.690
 0.0   6144.0  0.0   6144.0 269312.0 139264.0  773120.0   396840.2  262144.0 64155.8   3579   84.690   0      0.000   84.690
 0.0   6144.0  0.0   6144.0 269312.0 176128.0  773120.0   396840.2  262144.0 64155.8   3579   84.690   0      0.000   84.690
 0.0   6144.0  0.0   6144.0 269312.0 193536.0  773120.0   396840.2  262144.0 64155.8   3579   84.690   0      0.000   84.690
 0.0   6144.0  0.0   6144.0 269312.0 211968.0  773120.0   396840.2  262144.0 64155.8   3579   84.690   0      0.000   84.690
 0.0   6144.0  0.0   6144.0 269312.0 229376.0  773120.0   396840.2  262144.0 64155.8   3579   84.690   0      0.000   84.690
 0.0   6144.0  0.0   6144.0 269312.0 243712.0  773120.0   400994.0  262144.0 64155.8   3579   84.690   0      0.000   84.690
 0.0   8192.0  0.0   8192.0 267264.0 44032.0   773120.0   402843.3  262144.0 64155.8   3580   84.719   0      0.000   84.719

 ZABBIX的输出图马上由大宝剑变成了蜿行蛇啦。。。

技术分享

JVM试用G1的垃圾收集器

标签:

原文地址:http://www.cnblogs.com/aguncn/p/4212780.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!