内存大页支持
在系统启动期间,你能用“大内存页”为应用程序预留一部分内存。这部分内存,即被“大内存页”占用的这些存储器永远不会被交换出内存。它会一直保留其中,除非你修改了配置。例如像PolarO这样的计算密集型应用,需要开启大页内存管理。
使用说明
在kubernetes中开启大页内存管理的方法如下
需要在工作负载中加入启动参数:
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: privileged
spec:
selector:
matchLabels:
name: privileged-container
template:
metadata:
labels:
name: privileged-container
spec:
containers:
- name: busybox
image: busybox
command: ["/bin/sh","-c"]
args: ["mkdir -p host/mnt/huge; mount -t hugetlbfs nodev host/mnt/huge; echo 1024 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages"]
resources:
limits:
cpu: 200m
memory: 100Mi
requests:
cpu: 100m
memory: 50Mi
stdin: true
securityContext:
privileged: true
volumeMounts:
- name: host-root-volume
mountPath: /host
readOnly: false
volumes:
- name: host-root-volume
hostPath:
path: /
hostNetwork: true
hostPID: true
restartPolicy: Always
重启kubelet
# node systemctl releaod & restart kubelet
systemctl daemon-reload
systemctl restart kubelet
注意:只有重启kubelet,内存大页的配置才能生效。