參數(shù)優(yōu)化
-Xmx15G
-Xms15G
-XX:MaxDirectMemorySize=5G
-XX:+UnlockExperimentalVMOptions
-XX:G1NewSizePercent=5
-XX:G1RSetUpdatingPauseTimePercent=1
-XX:+ParallelRefProcEnabled
-XX:MetaspaceSize=1G
-XX:+UseG1GC
-XX:G1MixedGCCountTarget=16
-XX:StringTableSize=4000000
-XX:+PrintStringTableStatistics
-XX:+PrintGCDetails
-XX:+PrintGCDateStamps
-Xloggc:/data/logs/intelligent-mr-%p-%t.log
-XX:+PrintGCApplicationConcurrentTime
-XX:+PrintGCApplicationStoppedTime
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=/data/logs
-Djava.net.preferIPv4Stack=true
-XX:G1MaxNewSizePercent=30
-XX:InitiatingHeapOccupancyPercent=45
-XX:+UnlockDiagnosticVMOptions
-XX:+PrintHeapAtGC
-XX:+PrintTenuringDistribution
-XX:G1HeapRegionSize=32M
-XX:MaxGCPauseMillis=100
-XX:GCPauseIntervalMillis=200
-XX:+ParallelRefProcEnabled
-XX:+PrintReferenceGC
XX:ParallelGCThreads
結(jié)論
-XX:ParallelGCThreads=32 影響非常大,超時(shí)嚴(yán)重虹蒋,默認(rèn)效果最優(yōu)(該場(chǎng)景下)
Region調(diào)節(jié)對(duì)比
結(jié)論
32m相對(duì)較好
-XX:G1MaxNewSizePercent=30
-XX:InitiatingHeapOccupancyPercent=45
-XX:G1HeapRegionSize=8M
-XX:G1MaxNewSizePercent=30
-XX:InitiatingHeapOccupancyPercent=45
-XX:G1HeapRegionSize=16M
-XX:G1MaxNewSizePercent=30
-XX:InitiatingHeapOccupancyPercent=45
-XX:G1HeapRegionSize=32M
GC日志分析
結(jié)論
開(kāi)啟參數(shù)ParallelRefProcEnabled ref對(duì)象并行化處理
2021-05-28T10:10:38.532+0800: 444.869: [GC pause (G1 Evacuation Pause) (young)
Desired survivor size 402653184 bytes, new threshold 15 (max 15)
- age 1: 3103320 bytes, 3103320 total
- age 2: 178000 bytes, 3281320 total
- age 3: 3920 bytes, 3285240 total
- age 4: 98016 bytes, 3383256 total
- age 5: 70144 bytes, 3453400 total
- age 6: 3464 bytes, 3456864 total
- age 7: 99304 bytes, 3556168 total
- age 8: 4048 bytes, 3560216 total
- age 9: 4712 bytes, 3564928 total
- age 10: 2304 bytes, 3567232 total
- age 11: 4400 bytes, 3571632 total
- age 12: 864 bytes, 3572496 total
- age 13: 1032 bytes, 3573528 total
- age 14: 1304 bytes, 3574832 total
- age 15: 256 bytes, 3575088 total
, 0.2690707 secs]
[Parallel Time: 34.7 ms, GC Workers: 13]
[GC Worker Start (ms): Min: 444869.6, Avg: 444892.9, Max: 444903.7, Diff: 34.0]
[Ext Root Scanning (ms): Min: 0.0, Avg: 3.8, Max: 21.7, Diff: 21.7, Sum: 49.6]
[Update RS (ms): Min: 0.0, Avg: 0.1, Max: 0.4, Diff: 0.4, Sum: 1.7]
[Processed Buffers: Min: 0, Avg: 3.4, Max: 21, Diff: 21, Sum: 44]
[Scan RS (ms): Min: 0.0, Avg: 0.1, Max: 0.2, Diff: 0.2, Sum: 1.2]
[Code Root Scanning (ms): Min: 0.0, Avg: 0.0, Max: 0.2, Diff: 0.2, Sum: 0.2]
[Object Copy (ms): Min: 0.0, Avg: 0.8, Max: 2.3, Diff: 2.3, Sum: 10.6]
[Termination (ms): Min: 0.0, Avg: 6.0, Max: 9.7, Diff: 9.7, Sum: 78.5]
[Termination Attempts: Min: 1, Avg: 1.0, Max: 1, Diff: 0, Sum: 13]
[GC Worker Other (ms): Min: 0.0, Avg: 0.1, Max: 0.2, Diff: 0.2, Sum: 0.7]
[GC Worker Total (ms): Min: 0.2, Avg: 11.0, Max: 34.3, Diff: 34.1, Sum: 142.6]
[GC Worker End (ms): Min: 444903.8, Avg: 444903.9, Max: 444904.0, Diff: 0.2]
[Code Root Fixup: 0.1 ms]
[Code Root Purge: 0.0 ms]
[Clear CT: 1.9 ms]
[Other: 232.3 ms]
[Choose CSet: 0.0 ms]
[Ref Proc: 229.3 ms]
[Ref Enq: 0.6 ms]
[Redirty Cards: 0.6 ms]
[Humongous Register: 0.2 ms]
[Humongous Reclaim: 0.0 ms]
[Free CSet: 0.8 ms]
[Eden: 6128.0M(6128.0M)->0.0B(752.0M) Survivors: 16.0M->16.0M Heap: 6415.2M(15.0G)->288.8M(15.0G)]
[Times: user=1.24 sys=0.02, real=0.27 secs]
2021-06-03T14:41:47.017+0800: 155609.008:
[SoftReference, 0 refs, 0.0042561 secs]2021-06-03T14:41:47.021+0800: 155609.012:
[WeakReference, 0 refs, 0.0010238 secs]2021-06-03T14:41:47.022+0800: 155609.014:
[FinalReference, 5 refs, 0.0021924 secs]2021-06-03T14:41:47.025+0800: 155609.016:
[PhantomReference, 0 refs, 0 refs, 0.0315034 secs]2021-06-03T14:41:47.056+0800: 155609.047: [JNI Weak Reference, 0.0000365 secs], 0.0575484 secs]
DUMP. 內(nèi)存分析
結(jié)論
線程占用threadLocal 較多,WeakRef較多催烘,減少Dubbo線程數(shù)
<dubbo:provider timeout="1000" filter="notice" threadpool="fixed" threads="300" dispatcher="message" retries="0"/>
改為
<dubbo:provider timeout="1000" filter="notice" threadpool="cached" threads="300" dispatcher="message" retries="0"/>
大盤(pán)線程數(shù)降低
E4