Experiencing occasional long garbage collection delays, why?

前端 未结 13 1083
后悔当初
后悔当初 2021-02-04 06:26

I\'m having a hard time dealing with a Java garbage collection problem, and interpreting the logs.

My application requires that no GC takes longer than 2 seconds, and id

13条回答
  •  醉酒成梦
    2021-02-04 07:23

    In general, it's tough to get GC tuning right when you require such a large heap.

    That being said, most of GC hang time is caused by the memory copying of objects that survive across young garbage collections.

    Is your ConcurrentLinkedHashMap initialized with all the memory-persistent objects all at once? Or does it slowly grow bigger as the application keeps running? If it's the latter, it may be difficult to cut down your GC hang times since there are objects that always survive. If it's the former, you will need to size your tenured generation with the size of your persistent objects + 20% or so, and make sure that your young gen is large enough to keep up with the transient objects that are created during the course of your application.

提交回复
热议问题