-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Validate container improvements with .NET 6 #53149
Labels
Milestone
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. |
This was referenced May 23, 2021
cc @mangod9 |
I updated the testing data above with the latest build. Everything looks great. Thanks! @AntonLapounov @AaronRobinsonMSFT @jkotas This issue can be closed at any time. |
Nice. |
Similar topic for .NET Framework: microsoft/dotnet-framework-docker#935 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Validate container improvements with .NET 6
We've made various changes in .NET 6 to improve aspects of container resource limits governance, particularly for Windows containers. This issue demonstrates the new capabilities and their current behavior using the dotnetapp sample app.
Issues:
Changes:
The last change is to a sample, which will be used to demonstrate the others changes. It is a .NET 5 app. As a result, various roll-forward settings are used to coerce the app to run on .NET 6.
At the time of writing, the relevant changes have not been released in a public .NET 6 preview. As a result, I updated and locally rebuilt various Dockerfiles with daily builds from dotnet/installer.
Relevant docs:
docker run
-- runtime constraints on resourcesLinux -- CPU and memory limits
The following test demonstrates the .NET runtime honoring CPU and resource limits.
Similar, but with CPU sets (AKA CPU affinity) is used instead.
The latest .NET 6 Preview is used for these examples, since these capabilities are all pre .NET 6.
Linux -- custom processor count
The following test demonstrates the .NET runtime honoring the new
DOTNET_PROCESSOR_COUNT
ENV, which provides a different value toEnvironment.ProcessorCount
and the equivalent setting in the native runtime. It doesn't directly related to and does not affect thedocker run
--cpus
mechanism, but is intended as a higher-level signal for scaling algorithms.I used a .NET 6 Preview 6 build to demonstrate this change. It works as expected.
Let's double check that we get the right behavior if no CPU limits are set.
We do.
Let's check if we get the correct value with CPU affinity.
We do.
Windows -- CPU and memory limits
The major container improvement changes were made on Windows in .NET 6. Let's try with the .NET 6 preview 3. We're expecting that CPU limits are not honored with process isolated containers.
As expected, processor count is incorrect.
Note: You will see the correct behavior with Hyper-V isolated containers. The functionality gap is with process-isolated containers.
Let's try .NET 6 Preview 6.
Perfect.
Now let's try CPU affinity, like we did with Linux.
It isn't supported. I didn't know that.
Windows -- custom processor count
Just like with Linux, let's try setting a custom processor count.
As expected, it behaves just like demonstrated with Linux.
Validating isolation mode
Here's what I did to validate the isolation mode.
C:\git\dotnet-docker\samples\dotnetapp>docker run --rm -it --isolation=process --name dotnet6runtime dotnet6runtime
And then in another command prompt.
The text was updated successfully, but these errors were encountered: