gc 调优记录

qps 10,0000

-Xms10240m -Xmx10240m -XX:NewRatio=5 -XX:SurvivorRatio=6

2017-12-19T15:10:14.539+0800: 1367.601: [Full GC (System.gc()) [PSYoungGen: 7360K->0K(1692672K)] [ParOldGen: 4526697K->2650995K(8738304K)] 4534057K->2650995K(10430976K), [Metaspace: 55233K->55199K(1097728K)], 20.0808391 secs] [Times: user=346.64 sys=1.01, real=20.08 secs] 

2017-12-19T15:25:01.865+0800: 2254.927: [GC (Allocation Failure)
Desired survivor size 129499136 bytes, new threshold 15 (max 15)
[PSYoungGen: 1590535K->97974K(1618944K)] 4895352K->3409752K(10357248K), 0.1417415 secs] [Times: user=2.53 sys=0.00, real=0.15 secs]
2017-12-19T15:25:09.902+0800: 2262.964: [GC (Allocation Failure)
Desired survivor size 128450560 bytes, new threshold 15 (max 15)
[PSYoungGen: 1589430K->97344K(1622016K)] 4901208K->3416001K(10360320K), 0.1374235 secs] [Times: user=2.44 sys=0.01, real=0.14 secs]
2017-12-19T15:25:17.940+0800: 2271.002: [GC (Allocation Failure)
Desired survivor size 127401984 bytes, new threshold 15 (max 15)
[PSYoungGen: 1592896K->97063K(1620992K)] 4911553K->3422576K(10359296K), 0.1358406 secs] [Times: user=2.42 sys=0.00, real=0.13 secs]
2017-12-19T15:25:25.986+0800: 2279.048: [GC (Allocation Failure)
Desired survivor size 126353408 bytes, new threshold 15 (max 15)
[PSYoungGen: 1592615K->97127K(1624064K)] 4918128K->3429352K(10362368K), 0.1456303 secs] [Times: user=2.60 sys=0.00, real=0.15 secs]
2017-12-19T15:25:34.028+0800: 2287.091: [GC (Allocation Failure)
Desired survivor size 125304832 bytes, new threshold 15 (max 15)
[PSYoungGen: 1596775K->96871K(1623040K)] 4929000K->3435872K(10361344K), 0.1372397 secs] [Times: user=2.43 sys=0.00, real=0.14 secs]
2017-12-19T15:25:42.068+0800: 2295.130: [GC (Allocation Failure)
Desired survivor size 124256256 bytes, new threshold 15 (max 15)
[PSYoungGen: 1596519K->96208K(1626112K)] 4935520K->3442089K(10364416K), 0.1396860 secs] [Times: user=2.49 sys=0.00, real=0.14 secs]
2017-12-19T15:25:50.109+0800: 2303.172: [GC (Allocation Failure)
Desired survivor size 123207680 bytes, new threshold 15 (max 15)
[PSYoungGen: 1599952K->95383K(1625088K)] 4945833K->3448248K(10363392K), 0.1401272 secs] [Times: user=2.49 sys=0.00, real=0.14 secs]
2017-12-19T15:25:58.298+0800: 2311.360: [GC (Allocation Failure)
Desired survivor size 122159104 bytes, new threshold 15 (max 15)
[PSYoungGen: 1599127K->94967K(1628160K)] 4951992K->3454720K(10366464K), 0.1399527 secs] [Times: user=2.50 sys=0.00, real=0.14 secs]

老年代增长较快,这样迟早fgc

先增大年轻代,去掉 NewRatio=5参数。

2017-12-19T15:51:00.319+0800: 1389.258: [GC (System.gc())
Desired survivor size 106430464 bytes, new threshold 5 (max 15)
[PSYoungGen: 3225198K->65680K(3358208K)] 8075272K->4915755K(10349056K), 0.1640097 secs] [Times: user=2.92 sys=0.00, real=0.17 secs]
2017-12-19T15:51:00.483+0800: 1389.422: [Full GC (System.gc()) [PSYoungGen: 65680K->0K(3358208K)] [ParOldGen: 4850074K->2647118K(6990848K)] 4915755K->2647118K(10349056K), [Metaspace: 54890K->54864K(1097728K)], 15.6776634 secs] [Times: user=269.48 sys=0.69, real=15.67 secs]
2017-12-19T15:51:34.253+0800: 1423.192: [GC (Allocation Failure)
Desired survivor size 106430464 bytes, new threshold 6 (max 15)
[PSYoungGen: 3292160K->5914K(3390976K)] 5939278K->2653032K(10381824K), 0.0492608 secs] [Times: user=0.86 sys=0.00, real=0.05 secs]
2017-12-19T15:51:52.419+0800: 1441.358: [GC (Allocation Failure)
Desired survivor size 104333312 bytes, new threshold 7 (max 15)
[PSYoungGen: 3292954K->10801K(3390976K)] 5940072K->2657919K(10381824K), 0.0779235 secs] [Times: user=1.38 sys=0.01, real=0.08 secs]
2017-12-19T15:52:11.501+0800: 1460.440: [GC (Allocation Failure)
Desired survivor size 101187584 bytes, new threshold 8 (max 15)
[PSYoungGen: 3297841K->16369K(3396096K)] 5944959K->2663495K(10386944K), 0.0874535 secs] [Times: user=1.50 sys=0.05, real=0.09 secs]
2017-12-19T15:52:30.599+0800: 1479.538: [GC (Allocation Failure)
Desired survivor size 96468992 bytes, new threshold 9 (max 15)
[PSYoungGen: 3310577K->20593K(3393024K)] 5957703K->2667719K(10383872K), 0.0793526 secs] [Times: user=1.39 sys=0.00, real=0.08 secs]
2017-12-19T15:52:49.692+0800: 1498.631: [GC (Allocation Failure)
Desired survivor size 92274688 bytes, new threshold 10 (max 15)
[PSYoungGen: 3314801K->22730K(3404800K)] 5961927K->2669856K(10395648K), 0.0939741 secs] [Times: user=1.66 sys=0.00, real=0.09 secs]

fgc后,内存几乎停止增长:

[PSYoungGen: 3297841K->16369K(3396096K)] 5944959K->2663495K(10386944K), 0.0874535 secs] [Times: user=1.50 sys=0.05, real=0.09 secs]
2017-12-19T15:52:30.599+0800: 1479.538: [GC (Allocation Failure)
Desired survivor size 96468992 bytes, new threshold 9 (max 15)
[PSYoungGen: 3310577K->20593K(3393024K)] 5957703K->2667719K(10383872K), 0.0793526 secs] [Times: user=1.39 sys=0.00, real=0.08 secs]
2017-12-19T15:52:49.692+0800: 1498.631: [GC (Allocation Failure)
Desired survivor size 92274688 bytes, new threshold 10 (max 15)
[PSYoungGen: 3314801K->22730K(3404800K)] 5961927K->2669856K(10395648K), 0.0939741 secs] [Times: user=1.66 sys=0.00, real=0.09 secs]
2017-12-19T15:53:08.790+0800: 1517.728: [GC (Allocation Failure)
Desired survivor size 87031808 bytes, new threshold 11 (max 15)
[PSYoungGen: 3333322K->25591K(3400704K)] 5980448K->2672717K(10391552K), 0.0858242 secs] [Times: user=1.51 sys=0.00, real=0.09 secs]
2017-12-19T15:53:27.890+0800: 1536.829: [GC (Allocation Failure)
Desired survivor size 82313216 bytes, new threshold 12 (max 15)
[PSYoungGen: 3336183K->26599K(3414528K)] 5983309K->2673725K(10405376K), 0.1071549 secs] [Times: user=1.90 sys=0.00, real=0.11 secs]
2017-12-19T15:53:46.991+0800: 1555.930: [GC (Allocation Failure)
Desired survivor size 77594624 bytes, new threshold 13 (max 15)
[PSYoungGen: 3356135K->27079K(3409920K)] 6003261K->2674205K(10400768K), 0.1019614 secs] [Times: user=1.80 sys=0.00, real=0.10 secs]
2017-12-19T15:54:07.062+0800: 1576.001: [GC (Allocation Failure)
Desired survivor size 73400320 bytes, new threshold 14 (max 15)
[PSYoungGen: 3356615K->27463K(3423232K)] 6003741K->2674589K(10414080K), 0.1016985 secs] [Times: user=1.79 sys=0.00, real=0.10 secs]
2017-12-19T15:54:26.277+0800: 1595.216: [GC (Allocation Failure)
Desired survivor size 69730304 bytes, new threshold 15 (max 15)
[PSYoungGen: 3374919K->27671K(3419136K)] 6022045K->2674797K(10409984K), 0.1029666 secs] [Times: user=1.83 sys=0.00, real=0.10 secs]
2017-12-19T15:54:45.387+0800: 1614.325: [GC (Allocation Failure)
Desired survivor size 66060288 bytes, new threshold 15 (max 15)
[PSYoungGen: 3375127K->27815K(3430400K)] 6022253K->2674941K(10421248K), 0.1081986 secs] [Times: user=1.92 sys=0.00, real=0.10 secs]

说明从年轻代提升到老年代的非常少,大部分都在年轻代被回收掉了。

原文地址:https://www.cnblogs.com/ydxblog/p/8066238.html