性能问答>G1垃圾收集器频繁GC,却一直不超过最小堆内存>
8回复

G1垃圾收集器频繁GC,却一直不超过最小堆内存



CommandLine flags: -XX:G1ReservePercent=20 -XX:GCLogFileSize=2097152 -XX:InitialHeapSize=1073741824 -XX:MaxHeapSize=4294967296 -XX:NumberOfGCLogFiles=5 -XX:+PrintGC -XX:+PrintGCDateStamps -XX:-PrintGCDetails -XX:+PrintGCTimeStamps -XX:-PrintTenuringDistribution -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseG1GC -XX:+UseGCLogFileRotation 

   gc日志输出配置的jvm参数如上,采用G1垃圾收集器,最小堆内存1G,最大最内存4G,没有配置最大停顿时间

   访问量增大时一分钟多次GC,GC停顿时间也变大了许多,但是堆内存始终小于1G而没有进行扩充,后来将最小堆内存1G不变,将最大堆内存改成2G,1.1G的情况下,堆内存占用还是没有超过1G而没有扩充。

   疑问:为何当访问量加大时,堆内存始终没有扩大到大于最小堆内存呢?请大佬们帮忙解惑,谢谢。

271 阅读
请先登录,再评论

架构发现低版本Druid连接池跟mysql8.0驱动不兼容,升级Druid版本之后qps直接翻倍,gc次数也少了很多,但是堆内存占用还是不会超过1G

5月前

里面没有大对象,old区占用很少,频繁的进行young gc,下面是一段gc日志
2021-11-19T12:05:40.448+0800: 229904.470: [GC pause (G1 Evacuation Pause) (young) 808M->264M(1024M), 0.0584033 secs]
2021-11-19T12:05:41.414+0800: 229905.436: [GC pause (G1 Evacuation Pause) (young) 808M->264M(1024M), 0.0488243 secs]
2021-11-19T12:05:42.331+0800: 229906.353: [GC pause (G1 Evacuation Pause) (young) 808M->264M(1024M), 0.0579844 secs]
2021-11-19T12:05:43.308+0800: 229907.330: [GC pause (G1 Evacuation Pause) (young) 807M->264M(1024M), 0.0492198 secs]
2021-11-19T12:05:44.344+0800: 229908.366: [GC pause (G1 Evacuation Pause) (young) 807M->264M(1024M), 0.0485281 secs]
2021-11-19T12:05:45.253+0800: 229909.274: [GC pause (G1 Evacuation Pause) (young) 807M->264M(1024M), 0.0552156 secs]
2021-11-19T12:05:46.127+0800: 229910.148: [GC pause (G1 Evacuation Pause) (young) 807M->264M(1024M), 0.0488548 secs]
2021-11-19T12:05:47.055+0800: 229911.077: [GC pause (G1 Evacuation Pause) (young) 807M->264M(1024M), 0.0516669 secs]
2021-11-19T12:05:47.983+0800: 229912.005: [GC pause (G1 Evacuation Pause) (young) 807M->264M(1024M), 0.1134353 secs]
2021-11-19T12:05:49.006+0800: 229913.027: [GC pause (G1 Evacuation Pause) (young) 807M->264M(1024M), 0.0520400 secs]
2021-11-19T12:05:50.032+0800: 229914.054: [GC pause (G1 Evacuation Pause) (young) 807M->264M(1024M), 0.0456796 secs]

5月前

有大对象吗

5月前

建议作者贴下详细gc时候的日志,或者内存文件到社区的性能工具分析一下。让大佬们帮忙看下

5月前

是不是对象存活时间很短

5月前
回复 核桃:

对象存活时间短,回收的时候,好多垃圾对象。存活对象少。标记复制过程不是应该很快吗

5月前回复

我也想知道答案。

5月前
5月前回复