Java – how to reduce the processing time of weak references in GC?

At present, the problem I face is that my application occasionally shows long GC time, but these are only due to weak reference processing Therefore, the thread stop time is always close to the weak ref processing time All other GC cycles range from 0.0001 seconds to 0.200 seconds

From GC Log (reformat):

10388.186: [GC[YG occupancy: 206547 K (306688 K)]10388.186: [Rescan (parallel),0.1095860 secs]10388.295: [weak refs processing,2.0799570 secs] 
 [1 CMS-remark:  2973838K(3853568K)] 3180386K(4160256K),2.1899230 secs] 
 [Times: user=2.51 sys=0.00,real=2.18 secs]
Total time for which application threads were stopped: 2.1906890 seconds

I already have these settings Try a simpler setup, but there is no change

-Xms4g
-Xmx4g
-XX:NewSize=128m
-XX:+UseConcMarkSweepGC
-XX:+CMSIncrementalMode
-XX:MaxGCPauseMillis=50
-XX:CMSInitiatingOccupancyFraction=50
-XX:ParallelGCThreads=16
-XX:+DisableExplicitGC

If I open newsize, I will eventually encounter a long GC cycle The machine has eight cores and does not burn too many CPUs for applications Trying to run the old Gen GC early and simultaneously

Yes, I can't get rid of weak reference usage because it's part of a third-party library

Solution

I found this message in the "hotspot – GC use" mailing list

In short, try the - XX: parallelrefprocenabled switch

UPDATE

I found a better explanation in Jon Masamitsu's Weblog:

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>