gpt4 book ai didi

java - 为什么 G1 收集器在对象复制上花费这么多时间

转载 作者:太空宇宙 更新时间:2023-11-04 11:57:15 24 4
gpt4 key购买 nike

我的java选项是:

java -Dsun.zip.disableMemoryMapping=true -Xmx18g -Xms8g -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:InitiatingHeapOccupancyPercent=45 -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:gc.log -XX:NewSize=1500m -XX:MaxNewSize=1500m

这是我的GC日志:

    2016-12-22T09:45:51.567+0800: 145356.468: [GC pause (G1 Evacuation Pause) (young), 4.0553815 secs]        [Parallel Time: 4052.5 ms, GC Workers: 28]          [GC Worker Start (ms): Min: 145356469.0, Avg: 145356469.4, Max: 145356469.9, Diff: 0.9]          [Ext Root Scanning (ms): Min: 0.6, Avg: 1.0, Max: 1.8, Diff: 1.2, Sum: 29.1]          [Update RS (ms): Min: 12.0, Avg: 12.4, Max: 13.2, Diff: 1.2, Sum: 348.4]             [Processed Buffers: Min: 9, Avg: 13.5, Max: 24, Diff: 15, Sum: 379]          [Scan RS (ms): Min: 0.0, Avg: 0.1, Max: 0.2, Diff: 0.2, Sum: 2.3]          [Code Root Scanning (ms): Min: 0.0, Avg: 0.0, Max: 0.1, Diff: 0.1, Sum: 1.1]          [Object Copy (ms): Min: 28.7, Avg: 1927.0, Max: 4037.8, Diff: 4009.1, Sum: 53956.0]          [Termination (ms): Min: 0.0, Avg: 2111.2, Max: 4009.0, Diff: 4009.0, Sum: 59114.4]             [Termination Attempts: Min: 1, Avg: 2.2, Max: 5, Diff: 4, Sum: 63]          [GC Worker Other (ms): Min: 0.0, Avg: 0.1, Max: 0.2, Diff: 0.1, Sum: 2.0]          [GC Worker Total (ms): Min: 4051.4, Avg: 4051.9, Max: 4052.4, Diff: 1.0, Sum: 113453.2]          [GC Worker End (ms): Min: 145360521.3, Avg: 145360521.3, Max: 145360521.4, Diff: 0.1]       [Code Root Fixup: 0.1 ms]       [Code Root Purge: 0.0 ms]       [Clear CT: 0.4 ms]       [Other: 2.4 ms]          [Choose CSet: 0.0 ms]          [Ref Proc: 0.4 ms]          [Ref Enq: 0.0 ms]          [Redirty Cards: 0.5 ms]          [Humongous Register: 0.1 ms]          [Humongous Reclaim: 0.0 ms]          [Free CSet: 0.6 ms]       [Eden: 1424.0M(1424.0M)->0.0B(1416.0M) Survivors: 76.0M->84.0M Heap: 3475.6M(8192.0M)->2071.7M(8192.0M)]     [Times: user=54.84 sys=56.91, real=4.06 secs] 

我的CPU有40个核心,有时gc会导致很多时间。我发现大部分时间都花在了对象复制上,我想知道什么情况下会发生这种情况,以及我可以做些什么来优化gc...

[对象复制(毫秒):最小值:28.7,平均值:1927.0,最大值:4037.8,差异:4009.1,总和:53956.0]max 比 min 大很多,也许我可以减去 gc 工作人员??

最佳答案

我使用-XX:LargePageSizeInBytes=32m并将服务移动到另一个Linux服务器(我发现CPU运行队列有时很大)。然后发现GC时间不超过1秒。

关于java - 为什么 G1 收集器在对象复制上花费这么多时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41260467/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com