Experiencing occasional long garbage collection delays, why?

前端 未结 13 1053
后悔当初
后悔当初 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:21

    From the times, it seems the GC actually doesn't run all the time (see the user times), so most of the time, it's waiting.

    Just a wild guess: Doesn't it swap? How much memory does the machine have? How much of it does the java process get (resident set size)?

    Edit: why is it waiting:

    Look at this (from your transcript)

    [Times: user=0.39 sys=0.01, real=12.96 secs]
    

    This means that (I guess from the beginning to the end of GC), 12 (almost 13) seconds passed. Of these 13 seconds, .39 was spent running in user mode, .01 was spent running in kernel mode. If the time collection method isn't totally flawed (ie. the numbers really represent the running time of the GC process/thread), this means at least 12 seconds waiting.

提交回复
热议问题