容器进程因io导致cacheMemory较高处理随记:修订间差异

来自三线的随记
(创建页面,内容为“就好像harbor的registry容器,因为经常有io,所以比较容易触发这种现象。 或者频繁追加写日志到文件的进程,也会触发这种现象 如果是cgroup2,就可以用cgroup2 的mem.high处理。找到相应的cgroup2路径,配置mem.high即可 以harbor为例 ffffff 分类:K8s {{DEFAULTSORT:container容器进程因io导致cacheMemory较高处理随记}}”)
 
无编辑摘要
第7行: 第7行:
以harbor为例
以harbor为例


  ffffff
  <nowiki>
nerdctl ps|grep registry-photon|awk '{print "nerdctl inspect --mode native -f \"{{json .Spec.linux.cgroupsPath}}\" "$1}'|sh|cut -c 2-|cut -c -144|awk 'BEGIN{FS=":"};{print "cat /sys/fs/cgroup/kubepods.slice/kubepods-burstable.slice/"$1"/"$2"-"$3".scope/memory.high"}'
 
 
nerdctl ps|grep registry-photon|awk '{print "nerdctl inspect --mode native -f \"{{json .Spec.linux.cgroupsPath}}\" "$1}'|sh|cut -c 2-|cut -c -144|awk 'BEGIN{FS=":"};{print "echo 2G >  /sys/fs/cgroup/kubepods.slice/kubepods-burstable.slice/"$1"/"$2"-"$3".scope/memory.high"}'
</nowiki>
 
[[分类:K8s]]
[[分类:K8s]]
{{DEFAULTSORT:container容器进程因io导致cacheMemory较高处理随记}}
{{DEFAULTSORT:container容器进程因io导致cacheMemory较高处理随记}}

2025年10月22日 (三) 18:19的版本

就好像harbor的registry容器,因为经常有io,所以比较容易触发这种现象。

或者频繁追加写日志到文件的进程,也会触发这种现象

如果是cgroup2,就可以用cgroup2 的mem.high处理。找到相应的cgroup2路径,配置mem.high即可

以harbor为例

nerdctl ps|grep registry-photon|awk '{print "nerdctl inspect --mode native -f \"{{json .Spec.linux.cgroupsPath}}\" "$1}'|sh|cut -c 2-|cut -c -144|awk 'BEGIN{FS=":"};{print "cat /sys/fs/cgroup/kubepods.slice/kubepods-burstable.slice/"$1"/"$2"-"$3".scope/memory.high"}'


nerdctl ps|grep registry-photon|awk '{print "nerdctl inspect --mode native -f \"{{json .Spec.linux.cgroupsPath}}\" "$1}'|sh|cut -c 2-|cut -c -144|awk 'BEGIN{FS=":"};{print "echo 2G >  /sys/fs/cgroup/kubepods.slice/kubepods-burstable.slice/"$1"/"$2"-"$3".scope/memory.high"}'