Skip to content

[rfc] how best to reduce runc's effects on cgroup memory limits #4021

@cyphar

Description

@cyphar

Temporarily "unresolving" to un-hide on GitHub, and maybe there's some follow-up discussions to be had (NOT for this PR fwiw) but we can move the comment elsewhere.

We initially set this limit to 4MB, and raised it to 6MB when later versions of runc became more memory-hungry (I think that was part of a security fix?)

While looking that up, I found;

Honestly, from Moby/Docker's (and other "higher level" runtimes, I don't think it's "ideal"

  • It requires higher-level runtimes to have knowledge about the implementation's requirements
  • It requires them to (hard-code) based on the "worst case" scenario (e.g. would crun have a lower requirement?)
  • It limits users to set the limit to what their container process requires at runtime (which may be lower than memory needed during init).

This is orthogonally related to a (rather heated) discussion we had recently about moby/moby#45511, during which a question was raised "what does the runtime-spec actually describe?"

  • Is it declarative? Does it define the container "at runtime" (after execve) to execute, meaning: the spec is "declarative", and defines the user's intent w.r.t. describing requirements for the container(s process).
  • Or does it describe the container including the initial init (runc) to execute: the spec defines what's needed to construct the container (including capabilities and resources needed to do so).

The difference is very subtle, and in MOST cases, they are interchangeable (which is likely why they were never explicitly defined), however there are situations such as the one being discussed here (and the one I linked), where

My (personal) ideal would be to somehow get to the "declarative" variant; the user describes their intent ("make it so!"), and the runtime(s) take care of "whatever is needed" to make it happen. This would be the most user-friendly approach, and most "portable", as it would remove implementation-specific conditions out of the equation. But of course, this may not be something that can be realized (easily), beyond that ship possibly having sailed (runc effectively being the "reference implementation", and the runtime-spec usually being adjusted to fit (not the reverse)).

That said, MAYBE there are some options if we take the "features" option into account (opencontainers/runtime-spec#1130); perhaps an addition there could either specify the minimum requirements for the runtime that's used, or advertise the runtime's own requirements (i.e.; for this specific case: add XXk of memory to what's specified in the provided OCI spec).

Originally posted by @thaJeztah in #3987 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions