k8s pod 内存 所以判断container_memory_working_set_bytes会比container_memory_usage_bytes更为准确
container_memory_working_set_bytes = container_memory_usage_bytes - total_inactive_anon - total_inactive_file
memory used =container_memory_usage_bytes - cache
cache = total_inactive_file + total_active_file
PS:kubelet比较container_memory_working_set_bytes和container_spec_memory_limit_bytes来决定oom container
total_inactive_anon、total_inactive_file为非活动内存,可以被交换到磁盘 cache 缓存存储器存储当前保存在内存中的磁盘数据,所以判断container_memory_working_set_bytes会比container_memory_usage_bytes更为准确
这里workingSet的计算是先比较memory.memory.usage_in_bytes的大小是不是比memory.stats里面的total_inactive_file小,如果没有,就减去total_inactive_file的值,最后为workingSet的值,这部分的值我们可以认为是linux占用的hot(正在使用)内存值(容器同理)。
https://segmentfault.com/a/1190000021402244?utm_source=tag-newest
https://blog.csdn.net/palet/article/details/82889493
https://zhuanlan.zhihu.com/p/96597715
https://www.ibm.com/support/pages/kubectl-top-pods-and-docker-stats-show-different-memory-statistics
kubectl top 12.5G
container_memory_working_set_bytes = container_memory_usage_bytes - total_inactive_anon - total_inactive_file rss = total_inactive_anon + total_active_anon cache = total_inactive_file + total_active_file
kubelet比较container_memory_working_set_bytes和container_spec_memory_limit_bytes来决定oom container
相关文章
- 如何在k8s集群节点故障时(not ready,unreachable),定义pod的驱逐行为?
- 备战CKA每日一题——第8天 | initContainer概念、用法、使用场景简介;k8s secret env、volume考题引出
- 顶级工具 | Popeye帮你发现k8s集群潜在问题
- k8s 资源限制——Limits和Requests使用
- Kubernetes(K8s)部署 SpringCloud 服务实战
- error: unable to retrieve the complete list of server APIs: metrics.k8s.io/v1beta1: the server is cu
- 02-k8s资源管理与实战入门
- k8s节点升级cpu与内存后,静态pod无法启动-cpuManagerPolicy
- 解决 K8s 调度不均衡问题
- k8s subPathExpr stat no such file or directory 及挂载后找不到文件的问题
- k8s 使用非root用户启动
- k8s 集群中的etcd故障解决