Memory limit: requests/limits like in kubernetes

Is there a way to configure guaranteed limit and max limit for memory like requests/limits in kubernetes?

I think I need something working like:

  • hard limit, visible as memory limit inside CT via top/free and /proc/meminfo. OOM if hard limit is reached
  • guaranteed amount, no OOM if this limit is not reached, optional blocking creating new CT if “total guaranteed amount” of memory is overcommitted

That’s basically the limits.memory behavior, we set a soft limit of 90% of the amount and a hard limit at 100% of the amount, the OOM will trigger within the container if you use it all.

You can do that at the project level by setting a limits.memory on the project.
When you do that, every instance will need to have a limits.memory set so the total allocated (rather than used) can be computed, preventing you from creating instances once you’ve reached the project limit.

Do not understand idea about project limit.

The primary goal is not about preventing overcommitting, but about manageble guaranteed amount of memory level with no OOM.

The case is many CTs with sum(memory.limit) > node memory.

I’d like to set “no OOM amount” for some of them

Ah, right, so you want a two tier kinda limit for each instance, allowing to burst with extra risk.
I don’t believe there’s any way to do that at the kernel level on either cgroup1 or cgroup2.