Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Windows CPU Percent to Maximum #777

Merged
merged 1 commit into from
May 8, 2017

Conversation

darstahl
Copy link
Contributor

In order to increase the granularity of CPU resource control, change the CPU Percent (0-100) resource setting to CPU Maximum (0-10000)

The HCS API accepts a ProcessorMaximum, which is a percentage multiplied by 100. This PR allows finer control over the CPU resources of Windows containers by extending the ProcessorMaximum into the OCI spec, rather than truncating to a 0-100 percent.

The discussion context is moby/moby#32014 and moby/moby#32608. The implementation of NanoCPUs in Moby should be able to scale to precision smaller than a single percent of total CPU resources.

/cc @jhowardmsft

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

schema/defs.json Outdated
@@ -41,10 +41,10 @@
"minimum": 0,
"maximum": 18446744073709552000
},
"percent": {
"maximum": {
"type": "integer",
"minimum": 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

You probably want to bump this from 0 to 1 to match your Markdown docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looking at this again. I think this is actually a generic percent definition, rather than specific to CPU Percent (Oops), so I should not touch it. Am I reading that right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at this again. I think this is actually a generic percent definition, rather than specific to CPU Percent…

Ah, right. But it looks like the Windows field is the sole consumer. I'd recommend dropping percent from defs.json and inlining the new limits in the maximum entry in config-windows.json. But I'm not a maintainer, so you may want to wait for one of them to chime in.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I agree with that, and I've made the change locally, but I'll wait for more input before I push those changes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Another possibility, now that this shares the same 1–10k range as cpuShares, would be to rename the cpuShares entry in defs-windows.json to basisPoint or some such (permyriad? perTenThousand?). That's generic enough that it could live in defs.json

@@ -40,15 +40,15 @@ The following parameters can be specified:

* **`shares`** *(uint16, OPTIONAL)* - specifies the relative weight to other containers with CPU shares. The range is from 1 to 10000.

* **`percent`** *(uint, OPTIONAL)* - specifies the percentage of available CPUs usable by the container.
* **`maximum`** *(uint, OPTIONAL)* - specifies the portion of processor cycles that this container can use as a percentage times 100 . Range is from 1 to 10000.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we want the change from percent to maximum, but we dont want to encode the limit into the specs. Also #780

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we want the change from percent to maximum, but we dont want to encode the limit into the specs.

The important exception to this, discussed in today's meeting, is when the value is unique to this spec and there are no matching kernel docs. I expect this property, and likely shares (adjusted in #780) both fall into that category, and need to retain their runtime-spec-defined limits.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

FWIW, I agree that for the Windows shares and maximum values, the ranges should be left in the spec. While the values could be followed through to the implementation in Microsoft/hcsshim, the ranges are not to change between kernel versions, and not easily mapped back to matching docs without looking at implementation.

Copy link
Contributor

Choose a reason for hiding this comment

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

(Not a maintainer) but I concur with @darrenstahlmsft - on Windows, the ranges probably should remain in the OCI spec.

This was referenced Apr 27, 2017
@darstahl
Copy link
Contributor Author

darstahl commented May 8, 2017

Should I remove the limits from this PR and add a new PR to add them back in? I think this change is important, and that the limits should remain in the spec for Windows, but if that's the only thing holding this PR then I can split them up to get this one merged.

@crosbymichael
Copy link
Member

@darrenstahlmsft would probably be better.

In order to increase the granularity of CPU resource control, change
the CPU Percent (0-100) resource setting to CPU Maximum (0-10000)

Signed-off-by: Darren Stahl <darst@microsoft.com>
@darstahl darstahl force-pushed the WindowsCpuMaximum branch from 464bdfe to 7d007ca Compare May 8, 2017 21:08
@darstahl
Copy link
Contributor Author

darstahl commented May 8, 2017

Updated to remove limits. Once this is merged I'll open another PR to continue that discussion.

@crosbymichael
Copy link
Member

crosbymichael commented May 8, 2017

LGTM

Approved with PullApprove

1 similar comment
@dqminh
Copy link
Contributor

dqminh commented May 8, 2017

LGTM

Approved with PullApprove

@dqminh dqminh merged commit d42f1eb into opencontainers:master May 8, 2017
@darstahl darstahl deleted the WindowsCpuMaximum branch May 8, 2017 21:36
@vbatts vbatts mentioned this pull request Jul 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants