假设一台物理机上跑了3个容器,启动的时候分配的cpu share是一样的,那如果在一个容器满负载,而另外两个空闲的情况下,那单个容器有可能跑满物理机的CPU吗,还是说撑死只能跑到30%?
PHP中文网2017-04-21 11:18:37
If docker is running a python process, a single process can run a single core (limited by GIL). In fact, looking at the process list, you will know that unlike vagrant, the docker process itself is integrated into the system process.
怪我咯2017-04-21 11:18:37
Watch your progress
docker-proxy -proto tcp
How much CPU can it occupy
Oh, if you use share, then the process will be tied to this core.
Also, if you use top to see, you can see that the process is 100%, but this 100% is 100% on this core
If you run with 3 cores, it will be 300%
ringa_lee2017-04-21 11:18:37
Even if you allocate the same cpu share to each container when starting. When the other two containers are idle, the remaining containers can still fill up the entire core.
cpu share gives me the feeling that it limits the lower limit of the container’s cpu usage. If you want to limit the upper limit of cpu usage, you need to modify the settings of the container through cgroup.
ringa_lee2017-04-21 11:18:37
This is an interesting question, I should try it as an experiment.
天蓬老师2017-04-21 11:18:37
Who is going to do the experiment and write a loop to fill up the processor?