This release adds support for cgroup v2. This replaces cgroup v1 support, which
lacks functionality and is becoming less widely supported. While Nerves is the
current development platform for cgroup support, using cgroups on desktop Linux
works but may not be ergonomic. PRs in this area are welcome.
If you don't use cgroups, this update is not breaking for you. Library authors
are encouraged to allow both MuonTrap v1 and v2 if your library falls into this
category.
-
Breaking changes
- Cgroup v1 support removed
:cgroup_controllersand:cgroup_setsoptions replaced by a single
:cgroupconfiguration mapMuonTrap.Daemon.cgget/cgsetAPI changed for v2. They've been
de-emphasized for configuration due to their low-level nature
-
New features
- Add new
:cgroupconfiguration option as a more Elixir-friendly
configuration method MuonTrap.Daemon.cgroup_config/1returns the daemon's writable cgroup
settings as a map keyed by the same atoms accepted by the:cgroup
option, suitable for round-tripping into another daemon.MuonTrap.Daemon.statistics/1now also returns cgroup statistics as a map
under the:cgroupkey. Map keys are strings that match cgroup file names
exposed by the kernel (memory usage and peak, CPU and memory PSI,
OOM-kill counts,pids.current, etc.).MuonTrap.Daemon.cgroup_path/1returns the daemon's cgroup path (or
nilif the daemon isn't running under a cgroup).- MuonTrap now uses
cgroup.kill(kernel 5.14+) for atomic cgroup teardown
when available, falling back to per-pid SIGKILL on older kernels.
- Add new
The new configuration gives a feel for how the API has changed to reduce
manual string-based interactions:
cgroup_controllers: ["memory", "cpu"],
cgroup_sets: [
{"memory", "memory.max", "268435456"},
{"cpu", "cpu.max", "50000 100000"}
]
cgroup: %{
memory_max: 256*1024*1024,
cpu_max: {50_000, 100_000}
}