K8S增加限制后的启动时间验证
背景
前段时间看了下JVM载linux上面的启动时间, 进行过一些验证.
最近想着能够验证一下K8S上面的启动相关的信息
所以就整理了一下.
虽然没有特别好的结论,
但是还是发现自己对JVM的启动和参数还是了解的不够深入.
自己的几个启动参数
1. "-XX:MaxRAMPercentage=80.0","-XX:MinRAMPercentage=50.0"
2. "-XX:-UseAdaptiveSizePolicy","-XX:MaxRAMPercentage=80.0","-XX:MinRAMPercentage=50.0"
3. "-XX:-UseAdaptiveSizePolicy","-XX:InitialRAMPercentage=75.0","-XX:MaxRAMPercentage=75.0","-XX:MinRAMPercentage=75.0"
4. "-XX:InitialRAMPercentage=75.0","-XX:MaxRAMPercentage=75.0","-XX:MinRAMPercentage=75.0","-XX:SurvivorRatio=3","-XX:NewRatio=1",
启动脚本挨个说明
启动顺序的排序为:
4 3 1 2
详细信息为:
4. 最快, 怀疑启动过程中, 需要消耗最多的young区域. old区域可以不用非常大. 所以比较适合启动.
3. 次之, 与4的启动速度相差无几, 所以感觉方式3 应该是比较好的启动方式.
1. 再次之, 慢大约 5%左右, 其实差异性不是很大, 但是堆区大小有一些差异.
2. 最慢, 堆没有设置初始堆大小, 最大最小堆不一样, 然后还关闭了 自适应堆区设置, 导致启动速度很慢, 90min都没有启动起来.
堆区显示也只有1G左右, 所以几乎不可用.
关于堆区的显示问题
进入容器后可以使用jmap -heap 1 的方式进行查看.
New Generation (Eden + 1 Survivor Space):
capacity = 9709027328 (9259.25MB)
Eden Space:
capacity = 7281836032 (6944.5MB)
From Space:
capacity = 2427191296 (2314.75MB)
To Space:
capacity = 2427191296 (2314.75MB)
tenured generation:
capacity = 12136218624 (11574.0MB)
注意这个设置的是 :
"-XX:SurvivorRatio=3","-XX:NewRatio=1"
关于开启UseAdaptiveSizePolicy的情况
内存启动过程中 堆区变化是很大的
一开始:
Heap Configuration:
MinHeapFreeRatio = 0
MaxHeapFreeRatio = 100
MaxHeapSize = 24052236288 (22938.0MB)
NewSize = 156237824 (149.0MB)
MaxNewSize = 8017412096 (7646.0MB)
OldSize = 313524224 (299.0MB)
NewRatio = 2
SurvivorRatio = 8
MetaspaceSize = 21807104 (20.796875MB)
CompressedClassSpaceSize = 1073741824 (1024.0MB)
MaxMetaspaceSize = 17592186044415 MB
G1HeapRegionSize = 0 (0.0MB)
三分钟后
Heap Configuration:
MinHeapFreeRatio = 0
MaxHeapFreeRatio = 100
MaxHeapSize = 24052236288 (22938.0MB)
NewSize = 156237824 (149.0MB)
MaxNewSize = 8017412096 (7646.0MB)
OldSize = 313524224 (299.0MB)
NewRatio = 2
SurvivorRatio = 8
MetaspaceSize = 21807104 (20.796875MB)
CompressedClassSpaceSize = 1073741824 (1024.0MB)
MaxMetaspaceSize = 17592186044415 MB
G1HeapRegionSize = 0 (0.0MB)
关于资源限制
resources:
limits:
cpu: 6
memory: 28Gi
requests:
cpu: 6
memory: 28Gi
标签:capacity,启动,堆区,MB,75.0,XX,验证,K8S
From: https://www.cnblogs.com/jinanxiaolaohu/p/17919746.html