GC设置为:
# Min, max, total JVM size (-Xms -Xmx)
JVM_SIZE="-Xms48g -Xmx48g"
# New Generation Sizes (-XX:NewSize -XX:MaxNewSize)
JVM_SIZE_NEW="-XX:NewSize=8192m -XX:MaxNewSize=8192m"
# Type of Garbage Collector to use
JVM_GC_TYPE="-XX:+UseConcMarkSweepGC -XX:+UseParNewGC"
# Tuning options for the above garbage collector
JVM_GC_OPTS="-XX:CMSInitiatingOccupancyFraction=75 -XX:SurvivorRatio=30 -XX:+CMSParallelRemarkEnabled -XX:+CMSScavengeBeforeRemark"
GC日志:
2014-02-28T23:57:44.267+0800: 1427589.638: [GC 1427589.638: [ParNew (0: promotion failure size = 2315) (1: promotion failure size = 2314) (2: promotion failure size = 1027) (3: promotion failure size = 4) (4: promotion failure size = 2310) (5: promotion failure size = 4) (6: promotion failure size = 1027) (7: promotion failure size = 4) (8: promotion failure size = 4) (9: promotion failure size = 4) (**promotion failed**)
Desired survivor size 134217728 bytes, new threshold 1 (max 15)
- age 1: 268435048 bytes, 268435048 total
: 8126464K->8126464K(8126464K), 529.2651060 secs]1428118.904: [CMS2014-03-01T00:06:40.620+0800: 1428125.992: [CMS-concurrent-mark: 32.592/602.493 secs] [Times: user=1196.12 sys=108.73, real=602.40 secs]
(**concurrent mode failure**): **38068955K->3758792K(41943040K)**, 27.0563910 secs] 45944487K->3758792K(50069504K), [CMS Perm : 60159K->59831K(83968K)], 556.3220190 secs] [Times: user=754.14 sys=57.00, real=556.23 secs]
CMSInitiatingOccupancyFraction是75,但似乎CMS gc被调用太晚了。为什么呢?
任期大小应为48g - 8g = 40g,而40g的75%应为30G,但日志显示 38068955K-> 3758792K(41943040K)
答案 0 :(得分:6)
促销失败是由fragmentation of free space引起的,与CMSInitiatingOccupancyFraction
-XX:CMSInitiatingOccupancyFraction
仅为第一次收集设置阈值,之后JVM将调整因子,除非指定-XX:+UseCMSInitiatingOccupancyOnly
。