-
Notifications
You must be signed in to change notification settings - Fork 161
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
Add --cpus context #267
Add --cpus context #267
Conversation
Co-authored-by: Jan Kotas <[email protected]>
I view memory limit very different from cpu limit because they are handled very differently. memory limit is heavily influenced by the GC where cpu limit is just enforced by the OS (and specified by something in a container), the only thing GC does there is how many heaps it creates because of different ways to interpret the cpu limit. memory limit has been supported since .net core 3.0. it'd be good to talk about the difference between the 2 ways of specifying cpu limits - one is by affinity, ie, the process can only run on these individual cores and the other one is by cpu time limit, ie, the process can run on any cores this container can use, but the total cpu time is limited to a number. and it would be really helpful to discuss these not just in the low level configs in the runtime, but a mapping between what the customers specify and how the runtime interprets that. so something like if you specify if you specify ``docker run --rm -m 256mb --cpuset-cpus 2`, it translates to 256*0.75 for the GC heap limit and 2 GC heaps (no ambiguity there) and if a user wants to do more detailed config, there's also the hardlimit configs and the GCHeapCount config they can use. |
I added a bunch more context to address your feedback @Maoni0.
Sure, but they both impact the # of GC heaps. Right?
By default, it will match This is how CPU affinity works. % docker run --rm -it -m 256mb --cpuset-cpus 0,2,3 mcr.microsoft.com/dotnet/samples | grep Processor
ProcessorCount: 3 Here, I'm saying, please use these three specific CPUs. They are then unavailable for other containers. This option is only supported on Linux. One can imagine "I'd like to lease 3 CPUs but don't care which they are." At least via the docker CLI, that option doesn't exist. It sounds like a cool option to me. However, it has a sort of "fragmentation" problem. From an orchestrator standpoint, you then need to find a pod that can deliver that. With the CPU time idea, it enables over provisioning. Whether that's a good thing is a different question. |
Co-authored-by: Jan Kotas <[email protected]>
Title in INDEX.md needs to be updated to pass the CI checks |
The following configuration knobs are exposed to configure applications: | ||
|
||
* `GCHeapHardLimit` - specifies a hard limit for the GC heap as an absolute value, in bytes (hex value). | ||
* `GCHeapHardLimitPercent` - specifies a hard limit for the GC heap as a percentage of the cgroup hard limit (hex value). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to add an example of what a GCHeapHardLimit
hex value looks like? Does it have a prefix like 0xf00d
or f00d
?
For GCHeapHardLimitPercent
, does it range from 0 to 100 (or hex 0x0
to 0x64
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have the full documentation with examples and other details at https://docs.microsoft.com/en-us/dotnet/core/runtime-config/garbage-collector
Should we move some of these edits to the official docs instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I think just having links to the full docs will be great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the link to the doc.
@Maoni0 -- I ran a bunch of tests in a variety of important scenarios. The tests validate the spec, AFAICT. I even tested the |
I think this PR is ready to go now. Are your concerns addressed @Maoni0? |
I made a few changes:
--cpus
context.DOTNET_PROCESSOR_COUNT
context.@Maoni0 @jkotas