module
SystemD::MemoryPressure
Overview
Module to monitor memory pressure using systemd's memory pressure notification mechanism.
Defined in:
memory_pressure.crConstant Summary
-
Log =
::Log.for("systemd.memory_pressure")
Class Method Summary
-
.monitor(&block : -> )
The block is called when memory pressure is detected
- .parse(data : String) : Pressure | Nil
- .pressure(path : String) : Pressure | Nil
-
.pressure : Pressure | Nil
Current memory pressure, see
.pressure_pathfor which file is read -
.pressure_path : String | Nil
The watched file if it is a regular PSI file, otherwise the process' cgroup v2 memory.pressure, falling back to the system wide one
-
.watch(release_below : Float64 = 1.0, check_interval : Time::Span = 1.second, &block : Bool -> )
The block is called with
truewhen memory pressure is detected and withfalsewhen it is relieved.
Class Method Detail
Current memory pressure, see .pressure_path for which file is read
The watched file if it is a regular PSI file, otherwise the process' cgroup v2 memory.pressure, falling back to the system wide one
The block is called with true when memory pressure is detected and
with false when it is relieved. Notifications only signal the onset,
so while under pressure the PSI file is polled every check_interval
and relief is signalled once its "some avg10" drops below
release_below (percent), or at the first check if no PSI file can be
read.