Closed nchidipothu closed 7 years ago
Hi Naresh,
The same effect than the --cpus
option can be achieved using the CPU Period and CPU Quota settings.
The CPU period defines at which frequency the container's processes access to the CPU must be reallocated. By default, the period length is set to 100000μs (100ms).
The CPU quota defines the total amount of time the container's processes can run inside a period.
The number of CPU available in percent can therefore be expressed as cpu-quota / cpu-period. So, to achieve the desired result with the default CPU period you should set the CPU quota to 30000μs in the cloud profile settings.
The Docker API version 1.25 has support for expressing the CPU availability in percent and nanoseconds (just like with the --cpus
argument). This option is likely more portable than the quota/period approach (which rely on the underlying Linux scheduler), but the container editor is currently limited to the features available in the 1.24 API at this time.
It is to my understanding that --cpu-quota doesn't work on Windows docker, as it works with the CFS (Completely Fair Scheduler). Thus for windows containers --cpus flag would be required.
Mention of --cpu-quota and CFS: https://docs.docker.com/engine/admin/resource_constraints/#configure-the-default-cfs-scheduler
If this issue relates to Windows containers (and not a virtualized Docker installation on Windows), then yes, there is effectively a whole set of settings that will simply be ignored by the Docker daemon, the Linux scheduling options are just some of them.
Some further reflection has to be made on which settings from the newer APIs to include (and how to do deal with settings that are specific to a given kernel), but the limitation of CPU usage is a fairly common requirement, and the ability to do it in a portable way would indeed be interesting.
I'll try to integrate it in the near future (some work has to be done first to handle multiple API version while preserving backward compatibility).
A new option "Number of CPUs" has been added to the container settings UI. This field should work exactly as the --cpus
command line argument.
You can give it a try using this development artifact: docker-cloud_0.4.0-SNAPSHOT_63814db.zip
A bulk integration of the other configuration fields introduced in Docker 1.13 (there are a couple of them) is currently not planned, but you can still raise new issues in order to prioritize them.
Hi,
We are using windows "Docker version 1.13.1-cs1" and we would like to customize resources section for my docker image using "--cpus=0.3" but we don't see such properties to assign value in resources section. we are referring to https://docs.docker.com/engine/admin/resource_constraints/#configure-the-default-cfs-scheduler
Can you please help me at this.
Thanks, Naresh Ch