Node.JS
Node.JS

Reputation: 1568

dotnet core limit memory usage

I'm trying to run dotnet core project in Kubernetes and I am wondering if there a way to limit memory usage from dotnet core project itself the same way we can set a limit for jvm projects.

I see there is an optional argument in Docker to set memory limit:

docker run --memory="198m" xxx

Also in Kubernetes yaml file, we can set memory limit as well:

resources:
  requests:
    # ~402 MB
    memory: "384Mi"
    cpu: "250m"
  limits:
    # ~1500MB
    memory: "1430Mi"
    cpu: "500m"

Upvotes: 4

Views: 6025

Answers (1)

switchboard.op
switchboard.op

Reputation: 2268

If you're using dotnet core 2.0.2 or higher I believe it respects Docker's cgroup limits by default.
So all good on 2.0.2+. Just set the resource limits in K8S 👍

https://github.com/dotnet/coreclr/pull/13895

Upvotes: 1

Related Questions