雨翔河
首页
列表
关于
G1 垃圾回收器 GC 频繁导致的系统波动问题 (后续)
2019-08-14 09:44
承接上文的问题 : [G1 垃圾回收器 GC 频繁导致的系统波动问题](https://yuxianghe.net/blog/54) 上文提到问题的解决方案有两种: 1. 设置 getMaxRequestSizeBytes 的值为 `1024*256` ,减少每一个消息的数组的大小,使其不会超过 HeapRegionSize 的一半大小,这个缺陷就是需要保证消息的大小必须在 `1024*256` 字节以内。(最后我们改成了 `1024*4` ) 2. 调整堆内存大小为8G或以上,同时增加配置 -XX:G1HeapRegionSize=4M ,使得1M的消息数组大小小于 HeapRegionSize 的一半。 采用的最为稳妥的方案二,这样当大对象过来的时候不直接分配到老年代,而是在伊甸区,回收的时间和次数明显减少,效果显著。 如下是gc的情况: ``` S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT GCT 0.0 28672.0 0.0 28672.0 5255168.0 921600.0 3104768.0 462976.5 183168.0 171928.0 21120.0 19328.0 1201 32.053 0 0.000 32.053 0.0 28672.0 0.0 28672.0 5255168.0 1228800.0 3104768.0 462976.5 183168.0 171928.0 21120.0 19328.0 1201 32.053 0 0.000 32.053 0.0 28672.0 0.0 28672.0 5255168.0 1478656.0 3104768.0 462976.5 183168.0 171928.0 21120.0 19328.0 1201 32.053 0 0.000 32.053 0.0 28672.0 0.0 28672.0 5255168.0 1781760.0 3104768.0 462976.5 183168.0 171928.0 21120.0 19328.0 1201 32.053 0 0.000 32.053 0.0 28672.0 0.0 28672.0 5255168.0 2101248.0 3104768.0 462976.5 183168.0 171928.0 21120.0 19328.0 1201 32.053 0 0.000 32.053 0.0 28672.0 0.0 28672.0 5255168.0 2355200.0 3104768.0 462976.5 183168.0 171928.0 21120.0 19328.0 1201 32.053 0 0.000 32.053 0.0 28672.0 0.0 28672.0 5255168.0 2678784.0 3104768.0 462976.5 183168.0 171928.0 21120.0 19328.0 1201 32.053 0 0.000 32.053 0.0 28672.0 0.0 28672.0 5255168.0 2965504.0 3104768.0 462976.5 183168.0 171928.0 21120.0 19328.0 1201 32.053 0 0.000 32.053 0.0 28672.0 0.0 28672.0 5255168.0 3309568.0 3104768.0 462976.5 183168.0 171928.0 21120.0 19328.0 1201 32.053 0 0.000 32.053 0.0 28672.0 0.0 28672.0 5255168.0 3604480.0 3104768.0 462976.5 183168.0 171928.0 21120.0 19328.0 1201 32.053 0 0.000 32.053 0.0 28672.0 0.0 28672.0 5255168.0 3891200.0 3104768.0 462976.5 183168.0 171928.0 21120.0 19328.0 1201 32.053 0 0.000 32.053 0.0 28672.0 0.0 28672.0 5255168.0 4161536.0 3104768.0 462976.5 183168.0 171928.0 21120.0 19328.0 1201 32.053 0 0.000 32.053 0.0 28672.0 0.0 28672.0 5255168.0 4505600.0 3104768.0 462976.5 183168.0 171928.0 21120.0 19328.0 1201 32.053 0 0.000 32.053 0.0 28672.0 0.0 28672.0 5255168.0 4796416.0 3104768.0 462976.5 183168.0 171928.0 21120.0 19328.0 1201 32.053 0 0.000 32.053 0.0 20480.0 0.0 20480.0 5263360.0 53248.0 3104768.0 464538.5 183168.0 171928.0 21120.0 19328.0 1202 32.077 0 0.000 32.077 0.0 20480.0 0.0 20480.0 5263360.0 290816.0 3104768.0 464538.5 183168.0 171928.0 21120.0 19328.0 1202 32.077 0 0.000 32.077 0.0 20480.0 0.0 20480.0 5263360.0 737280.0 3104768.0 464538.5 183168.0 171928.0 21120.0 19328.0 1202 32.077 0 0.000 32.077 0.0 20480.0 0.0 20480.0 5263360.0 1032192.0 3104768.0 464538.5 183168.0 171928.0 21120.0 19328.0 1202 32.077 0 0.000 32.077 0.0 20480.0 0.0 20480.0 5263360.0 1294336.0 3104768.0 464538.5 183168.0 171928.0 21120.0 19328.0 1202 32.077 0 0.000 32.077 0.0 20480.0 0.0 20480.0 5263360.0 1613824.0 3104768.0 464538.5 183168.0 171928.0 21120.0 19328.0 1202 32.077 0 0.000 32.077 0.0 20480.0 0.0 20480.0 5263360.0 1896448.0 3104768.0 464538.5 183168.0 171928.0 21120.0 19328.0 1202 32.077 0 0.000 32.077 0.0 20480.0 0.0 20480.0 5263360.0 2191360.0 3104768.0 464538.5 183168.0 171928.0 21120.0 19328.0 1202 32.077 0 0.000 32.077 0.0 20480.0 0.0 20480.0 5263360.0 2482176.0 3104768.0 464538.5 183168.0 171928.0 21120.0 19328.0 1202 32.077 0 0.000 32.077 0.0 20480.0 0.0 20480.0 5263360.0 2793472.0 3104768.0 464538.5 183168.0 171928.0 21120.0 19328.0 1202 32.077 0 0.000 32.077 0.0 20480.0 0.0 20480.0 5263360.0 3125248.0 3104768.0 464538.5 183168.0 171928.0 21120.0 19328.0 1202 32.077 0 0.000 32.077 0.0 20480.0 0.0 20480.0 5263360.0 3403776.0 3104768.0 464538.5 183168.0 171928.0 21120.0 19328.0 1202 32.077 0 0.000 32.077 0.0 20480.0 0.0 20480.0 5263360.0 3653632.0 3104768.0 464538.5 183168.0 171928.0 21120.0 19328.0 1202 32.077 0 0.000 32.077 0.0 20480.0 0.0 20480.0 5263360.0 3948544.0 3104768.0 464538.5 183168.0 171928.0 21120.0 19328.0 1202 32.077 0 0.000 32.077 0.0 20480.0 0.0 20480.0 5263360.0 4227072.0 3104768.0 464538.5 183168.0 171928.0 21120.0 19328.0 1202 32.077 0 0.000 32.077 0.0 20480.0 0.0 20480.0 5263360.0 4501504.0 3104768.0 464538.5 183168.0 171928.0 21120.0 19328.0 1202 32.077 0 0.000 32.077 0.0 20480.0 0.0 20480.0 5263360.0 4825088.0 3104768.0 464538.5 183168.0 171928.0 21120.0 19328.0 1202 32.077 0 0.000 32.077 0.0 24576.0 0.0 24576.0 5259264.0 102400.0 3104768.0 465687.5 183168.0 171928.0 21120.0 19328.0 1203 32.100 0 0.000 32.100 0.0 24576.0 0.0 24576.0 5259264.0 364544.0 3104768.0 465687.5 183168.0 171928.0 21120.0 19328.0 1203 32.100 0 0.000 32.100 0.0 24576.0 0.0 24576.0 5259264.0 671744.0 3104768.0 465687.5 183168.0 171928.0 21120.0 19328.0 1203 32.100 0 0.000 32.100 0.0 24576.0 0.0 24576.0 5259264.0 860160.0 3104768.0 465687.5 183168.0 171928.0 21120.0 19328.0 1203 32.100 0 0.000 32.100 0.0 24576.0 0.0 24576.0 5259264.0 1224704.0 3104768.0 465687.5 183168.0 171928.0 21120.0 19328.0 1203 32.100 0 0.000 32.100 0.0 24576.0 0.0 24576.0 5259264.0 1548288.0 3104768.0 465687.5 183168.0 171928.0 21120.0 19328.0 1203 32.100 0 0.000 32.100 0.0 24576.0 0.0 24576.0 5259264.0 1826816.0 3104768.0 465687.5 183168.0 171928.0 21120.0 19328.0 1203 32.100 0 0.000 32.100 0.0 24576.0 0.0 24576.0 5259264.0 2056192.0 3104768.0 465687.5 183168.0 171928.0 21120.0 19328.0 1203 32.100 0 0.000 32.100 0.0 24576.0 0.0 24576.0 5259264.0 2449408.0 3104768.0 465687.5 183168.0 171928.0 21120.0 19328.0 1203 32.100 0 0.000 32.100 0.0 24576.0 0.0 24576.0 5259264.0 2727936.0 3104768.0 465687.5 183168.0 171928.0 21120.0 19328.0 1203 32.100 0 0.000 32.100 0.0 24576.0 0.0 24576.0 5259264.0 2990080.0 3104768.0 465687.5 183168.0 171928.0 21120.0 19328.0 1203 32.100 0 0.000 32.100 0.0 24576.0 0.0 24576.0 5259264.0 3194880.0 3104768.0 465687.5 183168.0 171928.0 21120.0 19328.0 1203 32.100 0 0.000 32.100 0.0 24576.0 0.0 24576.0 5259264.0 3616768.0 3104768.0 465687.5 183168.0 171928.0 21120.0 19328.0 1203 32.100 0 0.000 32.100 0.0 24576.0 0.0 24576.0 5259264.0 3870720.0 3104768.0 465687.5 183168.0 171928.0 21120.0 19328.0 1203 32.100 0 0.000 32.100 0.0 24576.0 0.0 24576.0 5259264.0 4059136.0 3104768.0 465687.5 183168.0 171928.0 21120.0 19328.0 1203 32.100 0 0.000 32.100 0.0 24576.0 0.0 24576.0 5259264.0 4440064.0 3104768.0 465687.5 183168.0 171928.0 21120.0 19328.0 1203 32.100 0 0.000 32.100 0.0 24576.0 0.0 24576.0 5259264.0 4784128.0 3104768.0 465687.5 183168.0 171928.0 21120.0 19328.0 1203 32.100 0 0.000 32.100 0.0 24576.0 0.0 24576.0 5259264.0 167936.0 3104768.0 465669.3 183168.0 171928.0 21120.0 19328.0 1204 32.139 0 0.000 32.139 0.0 24576.0 0.0 24576.0 5259264.0 434176.0 3104768.0 465669.3 183168.0 171928.0 21120.0 19328.0 1204 32.139 0 0.000 32.139 0.0 24576.0 0.0 24576.0 5259264.0 708608.0 3104768.0 465669.3 183168.0 171928.0 21120.0 19328.0 1204 32.139 0 0.000 32.139 0.0 24576.0 0.0 24576.0 5259264.0 1040384.0 3104768.0 465669.3 183168.0 171928.0 21120.0 19328.0 1204 32.139 0 0.000 32.139 0.0 24576.0 0.0 24576.0 5259264.0 1294336.0 3104768.0 465669.3 183168.0 171928.0 21120.0 19328.0 1204 32.139 0 0.000 32.139 0.0 24576.0 0.0 24576.0 5259264.0 1572864.0 3104768.0 465669.3 183168.0 171928.0 21120.0 19328.0 1204 32.139 0 0.000 32.139 0.0 24576.0 0.0 24576.0 5259264.0 1839104.0 3104768.0 465669.3 183168.0 171928.0 21120.0 19328.0 1204 32.139 0 0.000 32.139 0.0 24576.0 0.0 24576.0 5259264.0 2109440.0 3104768.0 465669.3 183168.0 171928.0 21120.0 19328.0 1204 32.139 0 0.000 32.139 0.0 24576.0 0.0 24576.0 5259264.0 2441216.0 3104768.0 465669.3 183168.0 171928.0 21120.0 19328.0 1204 32.139 0 0.000 32.139 0.0 24576.0 0.0 24576.0 5259264.0 2703360.0 3104768.0 465669.3 183168.0 171928.0 21120.0 19328.0 1204 32.139 0 0.000 32.139 0.0 24576.0 0.0 24576.0 5259264.0 2990080.0 3104768.0 465669.3 183168.0 171928.0 21120.0 19328.0 1204 32.139 0 0.000 32.139 0.0 24576.0 0.0 24576.0 5259264.0 3198976.0 3104768.0 465669.3 183168.0 171928.0 21120.0 19328.0 1204 32.139 0 0.000 32.139 0.0 24576.0 0.0 24576.0 5259264.0 3485696.0 3104768.0 465669.3 183168.0 171928.0 21120.0 19328.0 1204 32.139 0 0.000 32.139 0.0 24576.0 0.0 24576.0 5259264.0 3887104.0 3104768.0 465669.3 183168.0 171928.0 21120.0 19328.0 1204 32.139 0 0.000 32.139 0.0 24576.0 0.0 24576.0 5259264.0 4173824.0 3104768.0 465669.3 183168.0 171928.0 21120.0 19328.0 1204 32.139 0 0.000 32.139 0.0 24576.0 0.0 24576.0 5259264.0 4427776.0 3104768.0 465669.3 183168.0 171928.0 21120.0 19328.0 1204 32.139 0 0.000 32.139 0.0 24576.0 0.0 24576.0 5259264.0 4743168.0 3104768.0 465669.3 183168.0 171928.0 21120.0 19328.0 1204 32.139 0 0.000 32.139 0.0 28672.0 0.0 28672.0 5255168.0 69632.0 3104768.0 465445.3 183168.0 171928.5 21120.0 19328.0 1205 32.163 0 0.000 32.163 0.0 28672.0 0.0 28672.0 5255168.0 380928.0 3104768.0 465445.3 183168.0 171928.5 21120.0 19328.0 1205 32.163 0 0.000 32.163 0.0 28672.0 0.0 28672.0 5255168.0 565248.0 3104768.0 465445.3 183168.0 171928.5 21120.0 19328.0 1205 32.163 0 0.000 32.163 0.0 28672.0 0.0 28672.0 5255168.0 937984.0 3104768.0 465445.3 183168.0 171928.5 21120.0 19328.0 1205 32.163 0 0.000 32.163 0.0 28672.0 0.0 28672.0 5255168.0 1105920.0 3104768.0 465445.3 183168.0 171928.5 21120.0 19328.0 1205 32.163 0 0.000 32.163 0.0 28672.0 0.0 28672.0 5255168.0 1380352.0 3104768.0 465445.3 183168.0 171928.5 21120.0 19328.0 1205 32.163 0 0.000 32.163 0.0 28672.0 0.0 28672.0 5255168.0 1851392.0 3104768.0 465445.3 183168.0 171928.5 21120.0 19328.0 1205 32.163 0 0.000 32.163 0.0 28672.0 0.0 28672.0 5255168.0 2125824.0 3104768.0 465445.3 183168.0 171928.5 21120.0 19328.0 1205 32.163 0 0.000 32.163 0.0 28672.0 0.0 28672.0 5255168.0 2375680.0 3104768.0 465445.3 183168.0 171928.5 21120.0 19328.0 1205 32.163 0 0.000 32.163 0.0 28672.0 0.0 28672.0 5255168.0 2748416.0 3104768.0 465445.3 183168.0 171928.5 21120.0 19328.0 1205 32.163 0 0.000 32.163 0.0 28672.0 0.0 28672.0 5255168.0 3022848.0 3104768.0 465445.3 183168.0 171928.5 21120.0 19328.0 1205 32.163 0 0.000 32.163 0.0 28672.0 0.0 28672.0 5255168.0 3219456.0 3104768.0 465445.3 183168.0 171928.5 21120.0 19328.0 1205 32.163 0 0.000 32.163 0.0 28672.0 0.0 28672.0 5255168.0 3584000.0 3104768.0 465445.3 183168.0 171928.5 21120.0 19328.0 1205 32.163 0 0.000 32.163 0.0 28672.0 0.0 28672.0 5255168.0 3911680.0 3104768.0 465445.3 183168.0 171928.5 21120.0 19328.0 1205 32.163 0 0.000 32.163 0.0 28672.0 0.0 28672.0 5255168.0 4202496.0 3104768.0 465445.3 183168.0 171928.5 21120.0 19328.0 1205 32.163 0 0.000 32.163 0.0 28672.0 0.0 28672.0 5255168.0 4509696.0 3104768.0 465445.3 183168.0 171928.5 21120.0 19328.0 1205 32.163 0 0.000 32.163 0.0 28672.0 0.0 28672.0 5255168.0 4775936.0 3104768.0 465445.3 183168.0 171928.5 21120.0 19328.0 1205 32.163 0 0.000 32.163 0.0 24576.0 0.0 24576.0 5259264.0 86016.0 3104768.0 465426.3 183168.0 171928.5 21120.0 19328.0 1206 32.185 0 0.000 32.185 0.0 24576.0 0.0 24576.0 5259264.0 417792.0 3104768.0 465426.3 183168.0 171928.5 21120.0 19328.0 1206 32.185 0 0.000 32.185 0.0 24576.0 0.0 24576.0 5259264.0 663552.0 3104768.0 465426.3 183168.0 171928.5 21120.0 19328.0 1206 32.185 0 0.000 32.185 0.0 24576.0 0.0 24576.0 5259264.0 1011712.0 3104768.0 465426.3 183168.0 171928.5 21120.0 19328.0 1206 32.185 0 0.000 32.185 0.0 24576.0 0.0 24576.0 5259264.0 1277952.0 3104768.0 465426.3 183168.0 171928.5 21120.0 19328.0 1206 32.185 0 0.000 32.185 0.0 24576.0 0.0 24576.0 5259264.0 1601536.0 3104768.0 465426.3 183168.0 171928.5 21120.0 19328.0 1206 32.185 0 0.000 32.185 0.0 24576.0 0.0 24576.0 5259264.0 1875968.0 3104768.0 465426.3 183168.0 171928.5 21120.0 19328.0 1206 32.185 0 0.000 32.185 0.0 24576.0 0.0 24576.0 5259264.0 2220032.0 3104768.0 465426.3 183168.0 171928.5 21120.0 19328.0 1206 32.185 0 0.000 32.185 0.0 24576.0 0.0 24576.0 5259264.0 2486272.0 3104768.0 465426.3 183168.0 171928.5 21120.0 19328.0 1206 32.185 0 0.000 32.185 0.0 24576.0 0.0 24576.0 5259264.0 2805760.0 3104768.0 465426.3 183168.0 171928.5 21120.0 19328.0 1206 32.185 0 0.000 32.185 0.0 24576.0 0.0 24576.0 5259264.0 3076096.0 3104768.0 465426.3 183168.0 171928.5 21120.0 19328.0 1206 32.185 0 0.000 32.185 0.0 24576.0 0.0 24576.0 5259264.0 3354624.0 3104768.0 465426.3 183168.0 171928.5 21120.0 19328.0 1206 32.185 0 0.000 32.185 0.0 24576.0 0.0 24576.0 5259264.0 3649536.0 3104768.0 465426.3 183168.0 171928.5 21120.0 19328.0 1206 32.185 0 0.000 32.185 0.0 24576.0 0.0 24576.0 5259264.0 3928064.0 3104768.0 465426.3 183168.0 171928.5 21120.0 19328.0 1206 32.185 0 0.000 32.185 0.0 24576.0 0.0 24576.0 5259264.0 4141056.0 3104768.0 465426.3 183168.0 171928.5 21120.0 19328.0 1206 32.185 0 0.000 32.185 0.0 24576.0 0.0 24576.0 5259264.0 4399104.0 3104768.0 465426.3 183168.0 171928.5 21120.0 19328.0 1206 32.185 0 0.000 32.185 0.0 24576.0 0.0 24576.0 5259264.0 4800512.0 3104768.0 465426.3 183168.0 171928.5 21120.0 19328.0 1206 32.185 0 0.000 32.185 0.0 24576.0 0.0 24576.0 5259264.0 118784.0 3104768.0 464564.0 183168.0 171928.5 21120.0 19328.0 1207 32.208 0 0.000 32.208 0.0 24576.0 0.0 24576.0 5259264.0 368640.0 3104768.0 464564.0 183168.0 171928.5 21120.0 19328.0 1207 32.208 0 0.000 32.208 0.0 24576.0 0.0 24576.0 5259264.0 647168.0 3104768.0 464564.0 183168.0 171928.5 21120.0 19328.0 1207 32.208 0 0.000 32.208 0.0 24576.0 0.0 24576.0 5259264.0 966656.0 3104768.0 464564.0 183168.0 171928.5 21120.0 19328.0 1207 32.208 0 0.000 32.208 0.0 24576.0 0.0 24576.0 5259264.0 1302528.0 3104768.0 464564.0 183168.0 171928.5 21120.0 19328.0 1207 32.208 0 0.000 32.208 0.0 24576.0 0.0 24576.0 5259264.0 1589248.0 3104768.0 464564.0 183168.0 171928.5 21120.0 19328.0 1207 32.208 0 0.000 32.208 0.0 24576.0 0.0 24576.0 5259264.0 1843200.0 3104768.0 464564.0 183168.0 171928.5 21120.0 19328.0 1207 32.208 0 0.000 32.208 0.0 24576.0 0.0 24576.0 5259264.0 2121728.0 3104768.0 464564.0 183168.0 171928.5 21120.0 19328.0 1207 32.208 0 0.000 32.208 0.0 24576.0 0.0 24576.0 5259264.0 2482176.0 3104768.0 464564.0 183168.0 171928.5 21120.0 19328.0 1207 32.208 0 0.000 32.208 0.0 24576.0 0.0 24576.0 5259264.0 2723840.0 3104768.0 464564.0 183168.0 171928.5 21120.0 19328.0 1207 32.208 0 0.000 32.208 0.0 24576.0 0.0 24576.0 5259264.0 2969600.0 3104768.0 464564.0 183168.0 171928.5 21120.0 19328.0 1207 32.208 0 0.000 32.208 0.0 24576.0 0.0 24576.0 5259264.0 3248128.0 3104768.0 464564.0 183168.0 171928.5 21120.0 19328.0 1207 32.208 0 0.000 32.208 0.0 24576.0 0.0 24576.0 5259264.0 3555328.0 3104768.0 464564.0 183168.0 171928.5 21120.0 19328.0 1207 32.208 0 0.000 32.208 0.0 24576.0 0.0 24576.0 5259264.0 3817472.0 3104768.0 464564.0 183168.0 171928.5 21120.0 19328.0 1207 32.208 0 0.000 32.208 0.0 24576.0 0.0 24576.0 5259264.0 4145152.0 3104768.0 464564.0 183168.0 171928.5 21120.0 19328.0 1207 32.208 0 0.000 32.208 0.0 24576.0 0.0 24576.0 5259264.0 4403200.0 3104768.0 464564.0 183168.0 171928.5 21120.0 19328.0 1207 32.208 0 0.000 32.208 0.0 24576.0 0.0 24576.0 5259264.0 4730880.0 3104768.0 464564.0 183168.0 171928.5 21120.0 19328.0 1207 32.208 0 0.000 32.208 0.0 24576.0 0.0 24576.0 5259264.0 4939776.0 3104768.0 464564.0 183168.0 171928.5 21120.0 19328.0 1207 32.208 0 0.000 32.208 0.0 24576.0 0.0 24576.0 5259264.0 266240.0 3104768.0 466185.0 183168.0 171931.3 21120.0 19328.0 1208 32.228 0 0.000 32.228 0.0 24576.0 0.0 24576.0 5259264.0 585728.0 3104768.0 466185.0 183168.0 171931.3 21120.0 19328.0 1208 32.228 0 0.000 32.228 0.0 24576.0 0.0 24576.0 5259264.0 798720.0 3104768.0 466185.0 183168.0 171931.3 21120.0 19328.0 1208 32.228 0 0.000 32.228 0.0 24576.0 0.0 24576.0 5259264.0 1175552.0 3104768.0 466185.0 183168.0 171931.3 21120.0 19328.0 1208 32.228 0 0.000 32.228 0.0 24576.0 0.0 24576.0 5259264.0 1478656.0 3104768.0 466185.0 183168.0 171931.3 21120.0 19328.0 1208 32.228 0 0.000 32.228 0.0 24576.0 0.0 24576.0 5259264.0 1765376.0 3104768.0 466185.0 183168.0 171931.3 21120.0 19328.0 1208 32.228 0 0.000 32.228 0.0 24576.0 0.0 24576.0 5259264.0 2031616.0 3104768.0 466185.0 183168.0 171931.3 21120.0 19328.0 1208 32.228 0 0.000 32.228 0.0 24576.0 0.0 24576.0 5259264.0 2289664.0 3104768.0 466185.0 183168.0 171931.3 21120.0 19328.0 1208 32.228 0 0.000 32.228 0.0 24576.0 0.0 24576.0 5259264.0 2695168.0 3104768.0 466185.0 183168.0 171931.3 21120.0 19328.0 1208 32.228 0 0.000 32.228 0.0 24576.0 0.0 24576.0 5259264.0 2998272.0 3104768.0 466185.0 183168.0 171931.3 21120.0 19328.0 1208 32.228 0 0.000 32.228 0.0 24576.0 0.0 24576.0 5259264.0 3260416.0 3104768.0 466185.0 183168.0 171931.3 21120.0 19328.0 1208 32.228 0 0.000 32.228 0.0 24576.0 0.0 24576.0 5259264.0 3571712.0 3104768.0 466185.0 183168.0 171931.3 21120.0 19328.0 1208 32.228 0 0.000 32.228 0.0 24576.0 0.0 24576.0 5259264.0 3768320.0 3104768.0 466185.0 183168.0 171931.3 21120.0 19328.0 1208 32.228 0 0.000 32.228 0.0 24576.0 0.0 24576.0 5259264.0 4001792.0 3104768.0 466185.0 183168.0 171931.3 21120.0 19328.0 1208 32.228 0 0.000 32.228 0.0 24576.0 0.0 24576.0 5259264.0 4419584.0 3104768.0 466185.0 183168.0 171931.3 21120.0 19328.0 1208 32.228 0 0.000 32.228 0.0 24576.0 0.0 24576.0 5259264.0 4771840.0 3104768.0 466185.0 183168.0 171931.3 21120.0 19328.0 1208 32.228 0 0.000 32.228 0.0 24576.0 0.0 24576.0 5259264.0 90112.0 3104768.0 464426.7 183168.0 171931.3 21120.0 19328.0 1209 32.327 0 0.000 32.327 0.0 24576.0 0.0 24576.0 5259264.0 405504.0 3104768.0 464426.7 183168.0 171931.3 21120.0 19328.0 1209 32.327 0 0.000 32.327 0.0 24576.0 0.0 24576.0 5259264.0 667648.0 3104768.0 464426.7 183168.0 171931.3 21120.0 19328.0 1209 32.327 0 0.000 32.327 0.0 24576.0 0.0 24576.0 5259264.0 933888.0 3104768.0 464426.7 183168.0 171931.3 21120.0 19328.0 1209 32.327 0 0.000 32.327 0.0 24576.0 0.0 24576.0 5259264.0 1048576.0 3104768.0 464426.7 183168.0 171931.3 21120.0 19328.0 1209 32.327 0 0.000 32.327 0.0 24576.0 0.0 24576.0 5259264.0 1499136.0 3104768.0 464426.7 183168.0 171931.3 21120.0 19328.0 1209 32.327 0 0.000 32.327 0.0 24576.0 0.0 24576.0 5259264.0 1798144.0 3104768.0 464426.7 183168.0 171931.3 21120.0 19328.0 1209 32.327 0 0.000 32.327 0.0 24576.0 0.0 24576.0 5259264.0 2076672.0 3104768.0 464426.7 183168.0 171931.3 21120.0 19328.0 1209 32.327 0 0.000 32.327 0.0 24576.0 0.0 24576.0 5259264.0 2371584.0 3104768.0 464426.7 183168.0 171931.3 21120.0 19328.0 1209 32.327 0 0.000 32.327 0.0 24576.0 0.0 24576.0 5259264.0 2658304.0 3104768.0 464426.7 183168.0 171931.3 21120.0 19328.0 1209 32.327 0 0.000 32.327 0.0 24576.0 0.0 24576.0 5259264.0 2887680.0 3104768.0 464426.7 183168.0 171931.3 21120.0 19328.0 1209 32.327 0 0.000 32.327 0.0 24576.0 0.0 24576.0 5259264.0 3244032.0 3104768.0 464426.7 183168.0 171931.3 21120.0 19328.0 1209 32.327 0 0.000 32.327 0.0 24576.0 0.0 24576.0 5259264.0 3530752.0 3104768.0 464426.7 183168.0 171931.3 21120.0 19328.0 1209 32.327 0 0.000 32.327 0.0 24576.0 0.0 24576.0 5259264.0 3883008.0 3104768.0 464426.7 183168.0 171931.3 21120.0 19328.0 1209 32.327 0 0.000 32.327 0.0 24576.0 0.0 24576.0 5259264.0 4161536.0 3104768.0 464426.7 183168.0 171931.3 21120.0 19328.0 1209 32.327 0 0.000 32.327 0.0 24576.0 0.0 24576.0 5259264.0 4448256.0 3104768.0 464426.7 183168.0 171931.3 21120.0 19328.0 1209 32.327 0 0.000 32.327 0.0 24576.0 0.0 24576.0 5259264.0 4726784.0 3104768.0 464426.7 183168.0 171931.3 21120.0 19328.0 1209 32.327 0 0.000 32.327 ``` 可以看出来,只使用方案二来优化的话,8秒一次gc,一次gc时间在30ms左右。 因为采用的是方案二,缺陷就是治标不治本,且对硬件资源要求高,因为这需要提升所有机器的内存,成本是很高的。 使用方案一才是最终的解决方案,减少代码里的没有意义的大对象,比如上文提及的在分配未知数组大小的时候分配方式为 `1024*128` 或者 `1024*256`。 假设当堆内存小于4G的时候,heapRegionSize通常会是1M大小,这样不至于触发大对象分配失败导致GC停顿时间及其的长。 猜想如果有机会实行方案一,减小这个大对象的大小,老年代就几乎不会增长,伊甸区的增长也会明显减缓,对象几乎都活不到幸存区,youngGC的次数会大大减少,也使得每一次GC的停顿时间都减少,这才是最佳的实现方案。 补充:最后用了方案一,结果显著,业务高峰期10秒一次YGC,YGC一次时间为22毫秒左右。
类型:工作
标签:g1,gc,java
Copyright © 雨翔河
我与我周旋久
独孤影
开源实验室