性能问答>JDK8u221 + Docker,Heap Usage 远远小于分配的NewSize、OldSize>
3回复
11月前

JDK8u221 + Docker,Heap Usage 远远小于分配的NewSize、OldSize



我们的某个应用跑在JDK8u221上,使用Docker

容器资源配置如下:

resources:
  limits:
    cpu: '4'
    memory: 4Gi
  requests:
    cpu: '1'
    memory: 2Gi

JVM启动信息如下:

-server -XX:InitialRAMPercentage=60.0 -XX:MinRAMPercentage=60.0 -XX:MaxRAMPercentage=60.0 -Xss256k -XX:SurvivorRatio=3 -XX:+UseFastAccessorMethods

jmap -heap 信息如下:

Heap Configuration:
   MinHeapFreeRatio         = 0
   MaxHeapFreeRatio         = 100
   MaxHeapSize              = 2577399808 (2458.0MB)
   NewSize                  = 858783744 (819.0MB)
   MaxNewSize               = 858783744 (819.0MB)
   OldSize                  = 1718616064 (1639.0MB)
   NewRatio                 = 2
   SurvivorRatio            = 3
   MetaspaceSize            = 21807104 (20.796875MB)
   CompressedClassSpaceSize = 1073741824 (1024.0MB)
   MaxMetaspaceSize         = 17592186044415 MB
   G1HeapRegionSize         = 0 (0.0MB)

Heap Usage:
PS Young Generation
Eden Space:
   capacity = 156762112 (149.5MB)
   used     = 91814128 (87.56077575683594MB)
   free     = 64947984 (61.93922424316406MB)
   58.5690807738033% used
From Space:
   capacity = 3145728 (3.0MB)
   used     = 2719744 (2.59375MB)
   free     = 425984 (0.40625MB)
   86.45833333333333% used
To Space:
   capacity = 5242880 (5.0MB)
   used     = 0 (0.0MB)
   free     = 5242880 (5.0MB)
   0.0% used
PS Old Generation
   capacity = 246415360 (235.0MB)
   used     = 210939648 (201.167724609375MB)
   free     = 35475712 (33.832275390625MB)
   85.60328706781915% used

44662 interned Strings occupying 5495696 bytes.

该应用已经跑了好几天

观察到:

  1. Eden Space capacity + From Space capacity + To Space capacity 远远小于 NewSize
  2. PS Old Generation capacity 远远小于 OldSize

为什么分配了这么多空间,JVM它不用,而是在这么小的新生代里不断GC呢?

请教一下各位大佬,这是什么原因,有什么文档可供参考吗?
以前没有使用容器的时候,使用-Xms -Xmn -Xmx 印象中不会出现这样的问题

1540 阅读
请先登录,查看3条精彩评论吧
快去登录吧,你将获得
  • 浏览更多精彩评论
  • 和开发者讨论交流,共同进步