简体   繁体   English

容器如何使用超过限制的内存?

[英]How does the container use more memory than the limit?

My project might be an overcommitted system, and I have to improve the reliability by specifying an appropriate container mem limit, by which the total mem of the node should not be divided.我的项目可能是一个过度使用的系统,我必须通过指定适当的容器内存限制来提高可靠性,节点的总内存不应被划分。 But I'm confused with the following statements in the Kubernetes v1.1 doc Resource of Qos :但我对 Kubernetes v1.1 doc Resource of Qos 中的以下陈述感到困惑:

Incompressible Resource Guarantees不可压缩的资源保证

  • if they exceed their memory request, they could be killed (if some other container needs memory)如果它们超过了它们的内存请求,它们可能会被杀死(如果其他容器需要内存)

  • Containers will be killed if they use more memory than their limit.如果容器使用的内存超过其限制,它们将被杀死。

and the command docker stats shows a "LIMIT" for each container:并且命令docker stats显示每个容器的“限制”:

在此处输入图片说明

I think it means that containers will not use mems more than the "LIMIT" since I've met sometimes the MEM% stays at 100% for a while, so how and when the containers are killed?我认为这意味着容器不会使用超过“LIMIT”的MEM%因为我有时会遇到MEM%保持在100%一段时间,那么容器是如何以及何时被杀死的?

Update更新

I think OOM Killer is enabled with the default value 0 .我认为 OOM Killer 启用了默认值0

> cat /proc/sys/vm/oom_kill_allocating_task
0

Cgroup memory limit feature is used, so I recommend to read cgroup doc:使用了 Cgroup 内存限制功能,所以我建议阅读 cgroup 文档:

Tasks that attempt to consume more memory than they are allowed are immediately killed by the OOM killer.尝试消耗超过允许的内存的任务会立即被 OOM 杀手杀死。

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Resource_Management_Guide/sec-memory.html https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Resource_Management_Guide/sec-memory.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM