Skip to content

Prevent a non-zero NanoCPUs from setting a zero CPU.Count#32727

Merged
tonistiigi merged 1 commit intomoby:masterfrom
darstahl:WindowsSmallNanoCPUs
May 4, 2017
Merged

Prevent a non-zero NanoCPUs from setting a zero CPU.Count#32727
tonistiigi merged 1 commit intomoby:masterfrom
darstahl:WindowsSmallNanoCPUs

Conversation

@darstahl
Copy link
Copy Markdown
Contributor

Signed-off-by: Darren Stahl darst@microsoft.com

- What I did

Prevent a non-zero NanoCPUs from setting a zero CPU.Count

fixes #32014

- How I did it

If calculated cpuPercent is 0, set to 1.

- How to verify it

Create a container with --cpus 0.01. Inspect the JSON blob sent to HCS, ensure that CpuMaximum is not 0.

- Description for the changelog

Windows: Fix rounding error on small values of NanoCPUs

@georgyturevich
Copy link
Copy Markdown

@darrenstahlmsft Hi Darren,

I have two points there. I would appreciate if you can clarify them:

Inspect the JSON blob sent to HCS, ensure that CpuMaximum is not 0.

Could you provide details how I can do it?

cpuPercent = 1 can be quite high for the single container. Especially when we have a lot of CPUs on the server. Is it minimum possible value of cpuPercent for passing to HCS?

@darstahl
Copy link
Copy Markdown
Contributor Author

Inspect the JSON blob sent to HCS, ensure that CpuMaximum is not 0.
Could you provide details how I can do it?

When run in Debug mode, the daemon will print out this line when a container is started:

time="2017-04-20T10:51:51.300759500-07:00" level=debug msg="HCSShim::CreateContainer id=d1ce53082bda80446e0856a50b89f877e39558b9c70a67272feead3b39c3641a config={\"SystemType\":\"Container\",\"Name\":\"d1ce53082bda80446e0856a50b89f877e39558b9c70a67272feead3b39c3641a\",\"Owner\":\"docker\",\"IsDummy\":false,\"VolumePath\":\"\\\\\\\\?\\\\Volume{bc71dd09-209e-11e7-8397-aff64d7d0191}\",\"IgnoreFlushesDuringBoot\":true,\"LayerFolderPath\":\"C:\\\\ProgramData\\\\docker\\\\windowsfilter\\\\d1ce53082bda80446e0856a50b89f877e39558b9c70a67272feead3b39c3641a\",\"Layers\":[{\"ID\":\"f67acbea-dcb4-5a4c-baa8-f0da8168cfe0",\"Path\":\"C:\\\\ProgramData\\\\docker\\\\windowsfilter\\\\5cbe1733b64afe2cc8d401e99c69ea44c48d4ce6a9c359a193afe2ed9684b225\"},{\"ID\":\"11a5eb42-92f5-5631-90c8-97e7ebafb25a\",\"Path\":\"C:\\\\ProgramData\\\\docker\\\\windowsfilter\\\\67a8a80eb238b456a72bd739414f94f9e8e8de2fa5b49b9384bddea914b84aa0\"}],\"ProcessorMaximum\":100,\"HostName\":\"d1ce53082bda\",\"MappedDirectories\":[],\"HvPartition\":false,\"EndpointList\":[\"77f0929e-7061-4e6e-a81e-bace237ba1f5\"],\"Servicing\":false,\"AllowUnqualifiedDNSQuery\":true}"

Which includes:

\"ProcessorMaximum\":100

ProcessorMaximum is a value between 1 and 10000. This is what --cpu-percent and --cpus map to.

cpuPercent = 1 can be quite high for the single container. Especially when we have a lot of CPUs on the server. Is it minimum possible value of cpuPercent for passing to HCS?

It is the smallest value that Docker currently can pass, though HCS supports smaller. I can add a work item to my list to add more granular settings to Docker.

Hyper-V containers can support --cpu-count=1 and --cpu-percent=1 together which would be essentially 1% of a single core, but I don't think that is helpful for your scenario, as Windows Server containers cannot have both specified.

Copy link
Copy Markdown
Member

@cpuguy83 cpuguy83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🐯
@darrenstahlmsft needs a rebase 👼

Signed-off-by: Darren Stahl <darst@microsoft.com>
@darstahl darstahl force-pushed the WindowsSmallNanoCPUs branch from 0606a8e to b3649f4 Compare April 26, 2017 18:06
@darstahl
Copy link
Copy Markdown
Contributor Author

Rebased

@darstahl
Copy link
Copy Markdown
Contributor Author

vendor/github.com/miekg/pkcs11/pkcs11.go:26:10: fatal error: 'ltdl.h' file not found

Unrelated failure. Is this fixed?

@tonistiigi tonistiigi merged commit 2f3f1e6 into moby:master May 4, 2017
@GordonTheTurtle GordonTheTurtle added this to the 17.06.0 milestone May 4, 2017
@darstahl darstahl deleted the WindowsSmallNanoCPUs branch May 4, 2017 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--cpus limitation does not work correctly with some containers on Windows Docker

6 participants