-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Container CPU limits not supported by .NET runtime in process isolation mode -- Windows containers #46889
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
I am not sure what "not being honored" means here. It is the operating system's job to allocate resources and honor any CPU and memory limits. For |
The repro steps are not demonstrating the problem that this issue is meant to be about. The repro steps should be displaying |
I think runtime/src/coreclr/gc/windows/gcenv.windows.cpp Lines 314 to 326 in 207b03a
gc_heap::total_physical_mem :
gc_heap::total_physical_mem = GCToOSInterface::GetPhysicalMemoryLimit (&gc_heap::is_restricted_physical_mem); and returned by *totalAvailableMemoryBytes = gc_heap::heap_hard_limit != 0 ? gc_heap::heap_hard_limit : gc_heap::total_physical_mem; |
Agree. It would be useful to validate that it actually works for an actual process-isolated container. We are missing the CPU limits though (https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-jobobject_cpu_rate_control_information). |
Here is what I see with 80 MB memory and 1.0 CPU quota limits:
The memory limit is respected and If it has been decided to hijack the |
I don't think that's true. Our cgroup behavior does something different. That's what I'm asking for Windows process-isolated containers. |
What exactly is not true? I have provided results for both isolation modes on Windows above. |
I made a PR to docs: dotnet/dotnet-api-docs#6668. The result of this change does not report the total number of processors on the machine. That's what I meant. |
See #53149 for a demonstration of this change. |
We intend to support container limits on both Linux and Windows. It appears that we don't have support for process-isolated containers on Windows. That should be resolved.
In particular, CPUs are not being honored for process-isolated Windows containers. They should behave the same way as Linux containers. We need to fix that. Let's start with .NET 6.0, and then look at backporting needs.
Command used in each example:
docker run --rm -p 8080:80 -m 80 --cpus 1 mcr.microsoft.com/dotnet/samples:aspnetapp
Windows process-isolated behavior:
Note: My local machine is on insider builds, and so doesn't support process-isolated containers of any kind. This example is from a Windows Server 2019 Azure VM. The examples below are from my local machine. That's why they look different.
Windows Hyper-V-isolated behavior:
Linux behavior:
The text was updated successfully, but these errors were encountered: