论坛首页 Java企业应用论坛

一次Java垃圾收集调优实战

浏览 29002 次
该帖已经被评为良好帖
作者 正文
   发表时间:2008-07-09   最后修改:2009-10-12

1 资料

2 GC日志打印

  GC调优是个很实验很伽利略的活儿,GC日志是先决的数据参考和最终验证:

-XX:+PrintGCDetails -XX:+PrintGCTimeStamps(GC发生的时间) -XX:+PrintGCApplicationStoppedTime(GC消耗了多少时间) -XX:+PrintGCApplicationConcurrentTime(GC之间运行了多少时间)

 

3 收集器选择

CMS收集器:暂停时间优先

   配置参数:-XX:+UseConcMarkSweepGC
   已默认无需配置的参数:-XX:+UseParNewGC(Parallel收集新生代) -XX:+CMSPermGenSweepingEnabled(CMS收集持久代) -XX:UseCMSCompactAtFullCollection(full gc时压缩年老代)

   初始效果:1g堆内存的新生代约60m,minor gc约5-20毫秒,full gc约130毫秒。

Parallel收集器:吞吐量优先

    配置参数: -XX:+UseParallelGC -XX:+UseParallelOldGC(Parallel收集年老代,从JDK6.0开始支持)

    已默认无需配置的参数: -XX:+UseAdaptiveSizePolicy(动态调整新生代大小)

    初始效果:1g堆内存的新生代约90-110m(动态调整),minor gc约5-20毫秒,full gc有无UseParallelOldGC 参数分别为1.3/1.1秒,差别不大。

    另外-XX:MaxGCPauseMillis=100 设置minor gc的期望最大时间,JVM会以此来调整新生代的大小,但在此测试环境中对象死的太快,此参数作用不大。

4 调优实战

      Parallel收集高达1秒的暂停时间基本不可忍受,所以选择CMS收集器。

      在被压测的Mule 2.0应用里,每秒都有大约400M的海量短命对象产生:

  1. 因为默认60M的新生代太小了,频繁发生minor gc,大约0.2秒就进行一次。
  2. 因为CMS收集器中MaxTenuringThreshold(生代对象撑过过多少次minor gc才进入年老代的设置)默认0,存活的临时对象不经过Survivor区直接进入年老代,不久就占满年老代发生full gc。

     对这两个参数的调优,既要改善上面两种情况,又要避免新生代过大,复制次数过多造成minor gc的暂停时间过长。

  1. 使用-Xmn调到1/3 总内存。观察后设置-Xmn500M,新生代实际约460m。(用-XX:NewRatio设置无效,只能用 -Xmn)。
  2. 添加-XX:+PrintTenuringDistribution 参数观察各个Age的对象总大小,观察后设置-XX:MaxTenuringThreshold=5。

      优化后,大约1.1秒才发生一次minor gc,且速度依然保持在15-20ms之间。同时年老代的增长速度大大减缓,很久才发生一次full gc,

      参数定稿:

 -server -Xms1024m -Xmx1024m -Xmn500m -XX:+UseConcMarkSweepGC   -XX:MaxTenuringThreshold=5  -XX:+ExplicitGCInvokesConcurrent

 

      最后服务处理速度从1180 tps 上升到1380 tps,调整两个参数提升17%的性能还是笔很划算的买卖。

 

     另外,JDK6 Update 7自带了一个VisualVM工具,内里就是之前也有用过的Netbean Profiler,类似JConsole一样使用,可以看到线程状态,内存中对象以及方法的CPU时间等调优重要参考依据。免费捆绑啊,Sun 这样搞法,其他做Profiler的公司要关门了。

   发表时间:2008-07-10  
系列文章一一拜读
不愧是SpringSide的老大
写出的文章简单易读 操作性实用性很强
0 请登录后投票
   发表时间:2008-07-10  
冒失的顶一贴询问一下我的系统发生full gc 的原因


看了您的文章对gc又有了进一步的认识,马上对系统进行调优测试
从原来300个并发就出错到现在600个并发不出错,性能有了很大的提高

但是不明白为什么会发生full gc

这是我设置的参数

CATALINA_OPTS="-server -Xms1024m -Xmx1024m -XX:+UseConcMarkSweepGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:/opt/kpiroot/SmsSendService/gc.log"
export CATALINA_OPTS


为什么 Perm  只有19M就开始full gc

另外
引用
130.554: [Full GC 130.554: [CMS: 150257K->85316K(1015808K), 1.0890484 secs] 172319K->85316K(1048512K), [CMS Perm : 26311K->26300K(43256K)], 1.0939440 secs]

是说这次full gc使用了1秒多么
这是gc日志


3.275: [GC 3.275: [ParNew: 32640K->0K(32704K), 0.0235023 secs] 32640K->1965K(1048512K), 0.0236947 secs]
5.454: [GC 5.454: [ParNew: 32640K->0K(32704K), 0.0095111 secs] 34605K->3031K(1048512K), 0.0096097 secs]
7.829: [GC 7.829: [ParNew: 32640K->0K(32704K), 0.0144786 secs] 35671K->4295K(1048512K), 0.0146183 secs]
8.723: [Full GC 8.723: [CMS: 4295K->4607K(1015808K), 0.4216244 secs] 19424K->4607K(1048512K), [CMS Perm : 19929K->19903K(19968K)], 0.4222205 secs]
10.746: [GC 10.747: [ParNew: 32640K->0K(32704K), 0.0130792 secs] 37247K->6664K(1048512K), 0.0132204 secs]
56.239: [GC 56.239: [ParNew: 32640K->0K(32704K), 0.0224648 secs] 39304K->9246K(1048512K), 0.0226105 secs]
57.081: [GC 57.081: [ParNew: 32640K->0K(32704K), 0.0445177 secs] 41886K->22208K(1048512K), 0.0449293 secs]
57.299: [GC 57.300: [ParNew: 32640K->0K(32704K), 0.0605747 secs] 54848K->44738K(1048512K), 0.0611476 secs]
57.863: [GC 57.863: [ParNew: 32632K->0K(32704K), 0.0342347 secs] 77370K->50679K(1048512K), 0.0347938 secs]
59.354: [GC 59.354: [ParNew: 32640K->0K(32704K), 0.0153614 secs] 83319K->52353K(1048512K), 0.0159584 secs]
60.149: [GC 60.150: [ParNew: 32640K->0K(32704K), 0.0525923 secs] 84993K->67746K(1048512K), 0.0531216 secs]
60.653: [GC 60.653: [ParNew: 32639K->0K(32704K), 0.0380152 secs] 100385K->78305K(1048512K), 0.0386190 secs]
62.195: [GC 62.195: [ParNew: 32640K->0K(32704K), 0.0211858 secs] 110945K->79860K(1048512K), 0.0218637 secs]
62.540: [GC 62.540: [ParNew: 32640K->0K(32704K), 0.0217575 secs] 112500K->81869K(1048512K), 0.0223958 secs]
62.909: [GC 62.909: [ParNew: 32640K->0K(32704K), 0.0281260 secs] 114509K->83901K(1048512K), 0.0287711 secs]
63.939: [GC 63.940: [ParNew: 32640K->0K(32704K), 0.0222111 secs] 116541K->86089K(1048512K), 0.0229424 secs]
64.268: [GC 64.269: [ParNew: 32640K->0K(32704K), 0.0199706 secs] 118729K->88086K(1048512K), 0.0205777 secs]
64.729: [GC 64.730: [ParNew: 32640K->0K(32704K), 0.0176380 secs] 120726K->90028K(1048512K), 0.0182495 secs]
65.838: [GC 65.838: [ParNew: 32640K->0K(32704K), 0.0236812 secs] 122668K->92358K(1048512K), 0.0242273 secs]
66.157: [GC 66.157: [ParNew: 32640K->0K(32704K), 0.0308813 secs] 124998K->97215K(1048512K), 0.0316275 secs]
66.637: [GC 66.637: [ParNew: 32638K->0K(32704K), 0.0339635 secs] 129853K->105318K(1048512K), 0.0347392 secs]
66.896: [GC 66.896: [ParNew: 32640K->0K(32704K), 0.0233215 secs] 137958K->107717K(1048512K), 0.0239815 secs]
67.697: [GC 67.698: [ParNew: 32639K->0K(32704K), 0.0218523 secs] 140357K->109882K(1048512K), 0.0227158 secs]
67.933: [GC 67.933: [ParNew: 32639K->0K(32704K), 0.0268811 secs] 142521K->111896K(1048512K), 0.0277722 secs]
68.191: [GC 68.191: [ParNew: 32640K->0K(32704K), 0.0208651 secs] 144536K->113701K(1048512K), 0.0219260 secs]
68.422: [GC 68.422: [ParNew: 32639K->0K(32704K), 0.0256097 secs] 146341K->115948K(1048512K), 0.0262746 secs]
69.128: [GC 69.129: [ParNew: 32640K->0K(32704K), 0.0170922 secs] 148588K->117729K(1048512K), 0.0178420 secs]
69.166: [Full GC 69.166: [CMS: 117729K->87065K(1015808K), 1.3597540 secs] 119626K->87065K(1048512K), [CMS Perm : 26012K->25948K(33176K)], 1.3648961 secs]
70.791: [GC 70.792: [ParNew: 32640K->0K(32704K), 0.0235200 secs] 119705K->89227K(1048512K), 0.0243707 secs]
71.003: [GC 71.004: [ParNew: 32640K->0K(32704K), 0.0265451 secs] 121867K->91572K(1048512K), 0.0275096 secs]
71.626: [GC 71.627: [ParNew: 32640K->0K(32704K), 0.0192408 secs] 124212K->93776K(1048512K), 0.0202011 secs]
72.404: [GC 72.404: [ParNew: 32640K->0K(32704K), 0.0212003 secs] 126416K->95399K(1048512K), 0.0220405 secs]
72.916: [GC 72.916: [ParNew: 32640K->0K(32704K), 0.0154482 secs] 128039K->96428K(1048512K), 0.0166601 secs]
73.139: [GC 73.140: [ParNew: 32640K->0K(32704K), 0.0380855 secs] 129068K->99534K(1048512K), 0.0389076 secs]
74.810: [GC 74.810: [ParNew: 32640K->0K(32704K), 0.0144915 secs] 132174K->100503K(1048512K), 0.0152938 secs]
75.015: [GC 75.015: [ParNew: 32640K->0K(32704K), 0.0181668 secs] 133143K->102576K(1048512K), 0.0188320 secs]
75.890: [GC 75.891: [ParNew: 32640K->0K(32704K), 0.0184099 secs] 135216K->104347K(1048512K), 0.0190862 secs]
76.515: [GC 76.515: [ParNew: 32640K->0K(32704K), 0.0156175 secs] 136987K->106021K(1048512K), 0.0163426 secs]
76.776: [GC 76.777: [ParNew: 32640K->0K(32704K), 0.0177525 secs] 138661K->107989K(1048512K), 0.0183496 secs]
77.744: [GC 77.745: [ParNew: 32640K->0K(32704K), 0.0158691 secs] 140629K->109571K(1048512K), 0.0165182 secs]
78.244: [GC 78.245: [ParNew: 32640K->0K(32704K), 0.0211335 secs] 142211K->112501K(1048512K), 0.0221032 secs]
79.414: [GC 79.415: [ParNew: 32637K->0K(32704K), 0.0179112 secs] 145139K->114265K(1048512K), 0.0188204 secs]
79.832: [GC 79.833: [ParNew: 32640K->0K(32704K), 0.0163920 secs] 146905K->116171K(1048512K), 0.0174178 secs]
80.004: [GC 80.004: [ParNew: 32640K->0K(32704K), 0.0169749 secs] 148811K->118277K(1048512K), 0.0176588 secs]
80.168: [GC 80.168: [ParNew: 32640K->0K(32704K), 0.0205123 secs] 150917K->120277K(1048512K), 0.0213368 secs]
80.684: [GC 80.684: [ParNew: 32640K->0K(32704K), 0.0249274 secs] 152917K->122581K(1048512K), 0.0255980 secs]
81.355: [GC 81.356: [ParNew: 32640K->0K(32704K), 0.0176106 secs] 155221K->124478K(1048512K), 0.0183270 secs]
81.574: [GC 81.574: [ParNew: 32640K->0K(32704K), 0.0162822 secs] 157118K->125758K(1048512K), 0.0170658 secs]
81.923: [GC 81.924: [ParNew: 32635K->0K(32704K), 0.0212576 secs] 158394K->128582K(1048512K), 0.0219272 secs]
82.597: [GC 82.598: [ParNew: 32639K->0K(32704K), 0.0182568 secs] 161222K->129857K(1048512K), 0.0188918 secs]
83.051: [GC 83.051: [ParNew: 32640K->0K(32704K), 0.0151076 secs] 162497K->131545K(1048512K), 0.0158651 secs]
83.322: [GC 83.323: [ParNew: 32640K->0K(32704K), 0.0343496 secs] 164185K->134249K(1048512K), 0.0351920 secs]
84.382: [GC 84.383: [ParNew: 32640K->0K(32704K), 0.0244374 secs] 166889K->136242K(1048512K), 0.0252470 secs]
84.563: [GC 84.564: [ParNew: 32640K->0K(32704K), 0.0231565 secs] 168882K->138157K(1048512K), 0.0239511 secs]
86.305: [GC 86.305: [ParNew: 32631K->0K(32704K), 0.0137152 secs] 170788K->139034K(1048512K), 0.0144395 secs]
88.254: [GC 88.254: [ParNew: 32640K->0K(32704K), 0.0132529 secs] 171674K->139961K(1048512K), 0.0139783 secs]
89.428: [GC 89.429: [ParNew: 32640K->0K(32704K), 0.0178933 secs] 172601K->141017K(1048512K), 0.0186092 secs]
90.662: [GC 90.662: [ParNew: 32640K->0K(32704K), 0.0135292 secs] 173657K->142143K(1048512K), 0.0144701 secs]
92.522: [GC 92.523: [ParNew: 32634K->0K(32704K), 0.0117624 secs] 174777K->143009K(1048512K), 0.0124716 secs]
94.253: [GC 94.254: [ParNew: 32640K->0K(32704K), 0.0128338 secs] 175649K->144163K(1048512K), 0.0135451 secs]
96.015: [GC 96.015: [ParNew: 32636K->0K(32704K), 0.0105137 secs] 176799K->144989K(1048512K), 0.0111873 secs]
97.808: [GC 97.809: [ParNew: 32640K->0K(32704K), 0.0134703 secs] 177629K->145808K(1048512K), 0.0142102 secs]
99.627: [GC 99.628: [ParNew: 32639K->0K(32704K), 0.0105676 secs] 178447K->146663K(1048512K), 0.0112380 secs]
101.476: [GC 101.477: [ParNew: 32640K->0K(32704K), 0.0106948 secs] 179303K->147598K(1048512K), 0.0112534 secs]
103.318: [GC 103.319: [ParNew: 32637K->0K(32704K), 0.0101387 secs] 180235K->148391K(1048512K), 0.0111004 secs]
105.042: [GC 105.043: [ParNew: 32628K->0K(32704K), 0.0144883 secs] 181020K->149455K(1048512K), 0.0154482 secs]
106.662: [GC 106.663: [ParNew: 32640K->0K(32704K), 0.0092628 secs] 182095K->150257K(1048512K), 0.0098371 secs]
130.554: [Full GC 130.554: [CMS: 150257K->85316K(1015808K), 1.0890484 secs] 172319K->85316K(1048512K), [CMS Perm : 26311K->26300K(43256K)], 1.0939440 secs]
191.657: [Full GC 191.658: [CMS: 85316K->83555K(1015808K), 0.9106571 secs] 89960K->83555K(1048512K), [CMS Perm : 26306K->26306K(43840K)], 0.9115662 secs]
212.897: [GC 212.898: [ParNew: 32640K->0K(32704K), 0.0299138 secs] 116195K->88214K(1048512K), 0.0307433 secs]
214.800: [GC 214.800: [ParNew: 32640K->0K(32704K), 0.0125022 secs] 120854K->88945K(1048512K), 0.0130286 secs]
216.099: [GC 216.099: [ParNew: 32640K->0K(32704K), 0.0222496 secs] 121585K->92020K(1048512K), 0.0230238 secs]
217.835: [GC 217.836: [ParNew: 32640K->0K(32704K), 0.0159653 secs] 124660K->92781K(1048512K), 0.0165769 secs]
219.575: [GC 219.575: [ParNew: 32636K->0K(32704K), 0.0155901 secs] 125417K->93668K(1048512K), 0.0163095 secs]
221.372: [GC 221.372: [ParNew: 32640K->0K(32704K), 0.0149892 secs] 126308K->94650K(1048512K), 0.0157134 secs]
222.820: [GC 222.821: [ParNew: 32636K->0K(32704K), 0.0205232 secs] 127287K->97027K(1048512K), 0.0212609 secs]
224.772: [GC 224.772: [ParNew: 32633K->0K(32704K), 0.0152403 secs] 129660K->97803K(1048512K), 0.0159689 secs]
226.538: [GC 226.538: [ParNew: 32640K->0K(32704K), 0.0150330 secs] 130443K->98707K(1048512K), 0.0159206 secs]
228.293: [GC 228.293: [ParNew: 32640K->0K(32704K), 0.0147842 secs] 131347K->99525K(1048512K), 0.0154964 secs]
230.080: [GC 230.080: [ParNew: 32640K->0K(32704K), 0.0144334 secs] 132165K->100397K(1048512K), 0.0151286 secs]
231.954: [GC 231.954: [ParNew: 32640K->0K(32704K), 0.0145324 secs] 133037K->101285K(1048512K), 0.0152572 secs]
233.648: [GC 233.648: [ParNew: 32640K->0K(32704K), 0.0147830 secs] 133925K->102239K(1048512K), 0.0153334 secs]
235.490: [GC 235.490: [ParNew: 32640K->0K(32704K), 0.0157059 secs] 134879K->103089K(1048512K), 0.0164160 secs]
237.356: [GC 237.356: [ParNew: 32640K->0K(32704K), 0.0138615 secs] 135729K->103826K(1048512K), 0.0144954 secs]
239.004: [GC 239.004: [ParNew: 32632K->0K(32704K), 0.0132568 secs] 136459K->104675K(1048512K), 0.0139609 secs]
240.768: [GC 240.769: [ParNew: 32628K->0K(32704K), 0.0127728 secs] 137303K->105460K(1048512K), 0.0133174 secs]
242.606: [GC 242.607: [ParNew: 32640K->0K(32704K), 0.0141282 secs] 138100K->106275K(1048512K), 0.0149763 secs]
244.274: [GC 244.274: [ParNew: 32640K->0K(32704K), 0.0121769 secs] 138915K->107121K(1048512K), 0.0127006 secs]
246.157: [GC 246.157: [ParNew: 32640K->0K(32704K), 0.0144286 secs] 139761K->108028K(1048512K), 0.0151242 secs]
247.944: [GC 247.944: [ParNew: 32640K->0K(32704K), 0.0114199 secs] 140668K->108954K(1048512K), 0.0120647 secs]
249.991: [GC 249.992: [ParNew: 32640K->0K(32704K), 0.0115345 secs] 141594K->109644K(1048512K), 0.0121072 secs]
251.747: [GC 251.748: [ParNew: 32635K->0K(32704K), 0.0106543 secs] 142280K->110427K(1048512K), 0.0111712 secs]
252.578: [Full GC 252.578: [CMS: 110427K->91212K(1015808K), 1.2491085 secs] 124781K->91212K(1048512K), [CMS Perm : 26321K->26319K(43968K)], 1.2501915 secs]
255.631: [GC 255.632: [ParNew: 32640K->0K(32704K), 0.0118237 secs] 123852K->92032K(1048512K), 0.0125400 secs]
257.446: [GC 257.447: [ParNew: 32640K->0K(32704K), 0.0198318 secs] 124672K->93163K(1048512K), 0.0208174 secs]
259.392: [GC 259.392: [ParNew: 32640K->0K(32704K), 0.0099065 secs] 125803K->94031K(1048512K), 0.0105696 secs]
261.112: [GC 261.112: [ParNew: 32640K->0K(32704K), 0.0100303 secs] 126671K->94983K(1048512K), 0.0106244 secs]
262.727: [GC 262.727: [ParNew: 32634K->0K(32704K), 0.0120384 secs] 127617K->95920K(1048512K), 0.0126225 secs]
264.625: [GC 264.626: [ParNew: 32640K->0K(32704K), 0.0090178 secs] 128560K->96691K(1048512K), 0.0097384 secs]
311.645: [GC 311.645: [ParNew: 32640K->0K(32704K), 0.0224944 secs] 129331K->99616K(1048512K), 0.0232725 secs]
313.026: [GC 313.026: [ParNew: 32637K->0K(32704K), 0.0172582 secs] 132253K->102092K(1048512K), 0.0179799 secs]
313.854: [Full GC 313.855: [CMS: 102092K->80904K(1015808K), 1.3255757 secs] 116191K->80904K(1048512K), [CMS Perm : 27918K->27916K(43968K)], 1.3268241 secs]
316.193: [GC 316.194: [ParNew: 32640K->0K(32704K), 0.0236996 secs] 113544K->84173K(1048512K), 0.0245066 secs]
318.012: [GC 318.013: [ParNew: 32634K->0K(32704K), 0.0150966 secs] 116807K->85028K(1048512K), 0.0157808 secs]
319.896: [GC 319.896: [ParNew: 32640K->0K(32704K), 0.0154914 secs] 117668K->85843K(1048512K), 0.0161983 secs]
321.587: [GC 321.587: [ParNew: 32640K->0K(32704K), 0.0210291 secs] 118483K->88432K(1048512K), 0.0216402 secs]
323.239: [GC 323.240: [ParNew: 32640K->0K(32704K), 0.0151051 secs] 121072K->89265K(1048512K), 0.0158029 secs]
325.040: [GC 325.041: [ParNew: 32627K->0K(32704K), 0.0155399 secs] 121893K->90070K(1048512K), 0.0165021 secs]
326.885: [GC 326.885: [ParNew: 32640K->0K(32704K), 0.0151912 secs] 122710K->90981K(1048512K), 0.0157796 secs]
328.740: [GC 328.740: [ParNew: 32640K->0K(32704K), 0.0149483 secs] 123621K->91745K(1048512K), 0.0155503 secs]
330.428: [GC 330.429: [ParNew: 32640K->0K(32704K), 0.0156388 secs] 124385K->92631K(1048512K), 0.0163919 secs]
332.252: [GC 332.253: [ParNew: 32640K->0K(32704K), 0.0144377 secs] 125271K->93427K(1048512K), 0.0150436 secs]
334.298: [GC 334.299: [ParNew: 32635K->0K(32704K), 0.0137476 secs] 126063K->94183K(1048512K), 0.0144258 secs]
374.909: [GC 374.910: [ParNew: 32640K->0K(32704K), 0.0154759 secs] 126823K->95890K(1048512K), 0.0166178 secs]
375.202: [Full GC 375.203: [CMS: 95890K->78388K(1015808K), 0.9902914 secs] 102194K->78388K(1048512K), [CMS Perm : 27932K->27932K(46536K)], 0.9955181 secs]
377.841: [GC 377.842: [ParNew: 32640K->0K(32704K), 0.0156856 secs] 111028K->80654K(1048512K), 0.0164299 secs]
378.388: [GC 378.388: [ParNew: 32640K->0K(32704K), 0.0297404 secs] 113294K->85967K(1048512K), 0.0306222 secs]
380.052: [GC 380.053: [ParNew: 32640K->0K(32704K), 0.0150093 secs] 118607K->87069K(1048512K), 0.0157141 secs]
381.843: [GC 381.843: [ParNew: 32640K->0K(32704K), 0.0143696 secs] 119709K->87834K(1048512K), 0.0150668 secs]
383.523: [GC 383.523: [ParNew: 32640K->0K(32704K), 0.0141682 secs] 120474K->88601K(1048512K), 0.0147301 secs]
385.164: [GC 385.164: [ParNew: 32640K->0K(32704K), 0.0180610 secs] 121241K->90496K(1048512K), 0.0186178 secs]
387.103: [GC 387.103: [ParNew: 32640K->0K(32704K), 0.0171782 secs] 123136K->91599K(1048512K), 0.0180210 secs]
388.512: [GC 388.512: [ParNew: 32640K->0K(32704K), 0.0159297 secs] 124239K->92720K(1048512K), 0.0164884 secs]
390.478: [GC 390.479: [ParNew: 32640K->0K(32704K), 0.0146347 secs] 125360K->93530K(1048512K), 0.0153607 secs]
392.240: [GC 392.240: [ParNew: 32640K->0K(32704K), 0.0157987 secs] 126170K->94324K(1048512K), 0.0165455 secs]
393.975: [GC 393.975: [ParNew: 32640K->0K(32704K), 0.0156304 secs] 126964K->95128K(1048512K), 0.0162173 secs]
395.654: [GC 395.654: [ParNew: 32640K->0K(32704K), 0.0148063 secs] 127768K->95955K(1048512K), 0.0154825 secs]
397.452: [GC 397.452: [ParNew: 32640K->0K(32704K), 0.0151151 secs] 128595K->96668K(1048512K), 0.0158227 secs]
399.267: [GC 399.268: [ParNew: 32632K->0K(32704K), 0.0131184 secs] 129301K->97522K(1048512K), 0.0138654 secs]
401.006: [GC 401.007: [ParNew: 32640K->0K(32704K), 0.0203753 secs] 130162K->98336K(1048512K), 0.0210614 secs]
402.820: [GC 402.821: [ParNew: 32640K->0K(32704K), 0.0144165 secs] 130976K->99090K(1048512K), 0.0151548 secs]
404.416: [GC 404.417: [ParNew: 32630K->0K(32704K), 0.0125525 secs] 131721K->99957K(1048512K), 0.0131245 secs]
406.137: [GC 406.138: [ParNew: 32640K->0K(32704K), 0.0132161 secs] 132597K->100762K(1048512K), 0.0139184 secs]
407.853: [GC 407.853: [ParNew: 32640K->0K(32704K), 0.0117671 secs] 133402K->101529K(1048512K), 0.0124211 secs]
409.574: [GC 409.574: [ParNew: 32640K->0K(32704K), 0.0115104 secs] 134169K->102301K(1048512K), 0.0121559 secs]
411.453: [GC 411.453: [ParNew: 32640K->0K(32704K), 0.0135882 secs] 134941K->103061K(1048512K), 0.0142976 secs]
413.345: [GC 413.346: [ParNew: 32640K->0K(32704K), 0.0126473 secs] 135701K->103820K(1048512K), 0.0133938 secs]
415.109: [GC 415.110: [ParNew: 32640K->0K(32704K), 0.0110400 secs] 136460K->104635K(1048512K), 0.0117455 secs]
416.707: [GC 416.707: [ParNew: 32640K->0K(32704K), 0.0193735 secs] 137275K->105620K(1048512K), 0.0201002 secs]
418.437: [GC 418.437: [ParNew: 32640K->0K(32704K), 0.0112798 secs] 138260K->106370K(1048512K), 0.0119686 secs]
420.022: [GC 420.023: [ParNew: 32640K->0K(32704K), 0.0157250 secs] 139010K->107815K(1048512K), 0.0166899 secs]
421.721: [GC 421.721: [ParNew: 32640K->0K(32704K), 0.0107022 secs] 140455K->108696K(1048512K), 0.0114462 secs]
423.440: [GC 423.441: [ParNew: 32640K->0K(32704K), 0.0108448 secs] 141336K->109583K(1048512K), 0.0114186 secs]
425.306: [GC 425.306: [ParNew: 32640K->0K(32704K), 0.0088568 secs] 142223K->110341K(1048512K), 0.0095388 secs]
436.207: [Full GC 436.207: [CMS: 110341K->85001K(1015808K), 1.0373090 secs] 119135K->85001K(1048512K), [CMS Perm : 27954K->27947K(46664K)], 1.0382699 secs]

2 请登录后投票
   发表时间:2008-07-16  
白衣兄的又一篇好文章,一次又一次的,都不知道学了多少东西了。 
1 请登录后投票
   发表时间:2008-07-18  
楼主,
-XX:+ExplicitGCInvokesConcurrent
这个变量在官方文档里面都没有,你是怎么可以通过呢?
http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp
1 请登录后投票
   发表时间:2008-08-15  
 

偶然机会看到你的文章,

经理让我 看看

哈哈

以后 多多关照
0 请登录后投票
   发表时间:2008-12-17  
sundysea 写道
楼主,
-XX:+ExplicitGCInvokesConcurrent
这个变量在官方文档里面都没有,你是怎么可以通过呢?
http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp

0 请登录后投票
   发表时间:2008-12-17   最后修改:2008-12-17
jjyy2008 写道
冒失的顶一贴询问一下我的系统发生full gc 的原因


看了您的文章对gc又有了进一步的认识,马上对系统进行调优测试
从原来300个并发就出错到现在600个并发不出错,性能有了很大的提高

但是不明白为什么会发生full gc

这是我设置的参数

CATALINA_OPTS="-server -Xms1024m -Xmx1024m -XX:+UseConcMarkSweepGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:/opt/kpiroot/SmsSendService/gc.log"
export CATALINA_OPTS


为什么 Perm  只有19M就开始full gc

另外
引用
130.554: [Full GC 130.554: [CMS: 150257K->85316K(1015808K), 1.0890484 secs] 172319K->85316K(1048512K), [CMS Perm : 26311K->26300K(43256K)], 1.0939440 secs]

是说这次full gc使用了1秒多么
这是gc日志

 

我按照lz的配置没有full gc.

多核情况和多cup此处是否有差别??

0 请登录后投票
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics