Docker服务限制和保留 [英] Docker service Limits and Reservations

查看:225
本文介绍了Docker服务限制和保留的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Docker v1.12服务带有四个用于设置服务资源限制的标志。


-limit-cpu值限制CPU(默认0.000) )


-限制内存值Limit Memory(默认0 B)


-reserve-cpu value保留CPU(默认0.000)


-保留内存值Reserve Memory(默认0 B)




  1. 在这种情况下,限制和保留之间有什么区别?



  2. 此处的cpu值是什么意思?这是否意味着核心数量? cpu分享?什么是单位?




解决方案

保留资源在主机上,因此它们始终可用于容器。考虑专用资源。



限制限制了容器内的二进制文件使用的资源不止于此。考虑控制容器中的失控过程。



基于我对


Docker v1.12 service comes with four flags for setting the resource limits on a service.

--limit-cpu value Limit CPUs (default 0.000)

--limit-memory value Limit Memory (default 0 B)

--reserve-cpu value Reserve CPUs (default 0.000)

--reserve-memory value Reserve Memory (default 0 B)

  1. What is the difference between limit and reserve in this context?

  2. What does the cpu value mean in here? Does this mean number of cores? cpu share? What is the unit?

解决方案

Reserve holds those resources on the host so they are always available for the container. Think dedicated resources.

Limit prevents the binary inside the container from using more than that. Think of controlling runaway processes in container.

Based on my limited testing with stress, --limit-cpu is percent of a core, though if there are multiple threads, it'll spread those out across core's and seems to attempt to keep the total near what you'd expect.

In the below pic, from left to right, was --limit-cpu 4, then 2.5, then 2, then 1. All of those tests had stress set to CPU of 4 (worker threads).

这篇关于Docker服务限制和保留的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆