Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
.NET Core Docker Limits Test

.NET Core Docker Limits Test

Docker enables you to limit a container's resources. This control is great for high-density hosting and other low-resource scenarios. Developers have the expectation that the application platform respects these limits and does its best to work within them.

I wrote a crude test framework to determine how .NET Core behaves when various resource limits are set. The following are the results.

The testing varied the following:

  • Host OS
  • Server vs Workstation GC
  • Memory alloted to container
  • CPU alloted to container

The various combinations are summarized below, with links to the logs that the test framework produces. The test framework generates many client requests on a container, configured for a GC type and CPU allotment. The key metric is the minimum memory size that can be used for a given configuration without crashing (presumably due to OOM). Naturally, some customers will want to configure containerized .NET Core apps with the minimum resources and will expect those apps not to crash. We need to determine some combination of product changes and customer guidance to deliver on the intuitive expectation that customers have.

It is easy to think of this topic as just containers, as if containers are an abstract concept. These are apps that are distributed as containers. Customers will expect their apps to work in containers just like they do not in containers, and at the same time, take advantage of the value and characteristics that are available with containers.

Linux containers on Ubuntu 18.04

.NET Core Docker Limits Test - Linux on Linux

  • Server GC resticted to .5 CPU: 88 mb (log)
  • Server GC (no CPU restriction): 220 mb (log)
  • Workstation GC resticted to .5 CPU: 46 mb (log)
  • Workstation GC (no CPU restriction): 46 mb (log)

Linux containers on Windows

.NET Core Docker Limits Test - Linux on Windows

  • Server GC resticted to .5 CPU: 20 mb (log)
  • Server GC (no CPU restriction): 31 mb (log)
  • Workstation GC resticted to .5 CPU: 16 mb (log)
  • Workstation GC (no CPU restriction): 16 mb (log)

Linux containers on macOS

.NET Core Docker Limits Test - Linux on macOS

  • Server GC resticted to .5 CPU: 146 mb (log)
  • Server GC (no CPU restriction): gave up at 263 mb (didn't discover minimum memory size) (log)
  • Workstation GC resticted to .5 CPU: 55 mb (log)
  • Workstation GC (no CPU restriction): 46 mb (log)

Windows container on Windows

I ran into technical problems and was unable to run the test framework in this combination

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.