Package com.github.jpmsilva.jsystemd
Class CgroupMemoryStatusProvider
java.lang.Object
com.github.jpmsilva.jsystemd.CgroupMemoryStatusProvider
- All Implemented Interfaces:
StatusProvider
Implementation of
StatusProvider that provides the memory used by the control group of the process, out of its limit, such as
Cgroup memory: 700.0 MiB/1.0 GiB, or without the limit when there is none, such as Cgroup memory: 700.0 MiB.
Unlike the memory reported by the other status providers, this is the memory the kernel accounts to the service, and holds it to: all the memory of
the process, including the native memory of the JVM, the thread stacks and the page cache. Once it reaches the limit, the kernel kills the process, even
though the heap may still have room. The limit is the one systemd sets with MemoryMax in the service unit, or in any of the slices it belongs
to, whichever is lowest.
Only the unified hierarchy of control groups (cgroup v2) is supported, the one systemd uses on current Linux distributions, as the legacy one is deprecated. Nothing is reported otherwise, or when not running on Linux.
- Author:
- Joao Silva
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new CgroupMemoryStatusProvider, for the control group the process is in when created. -
Method Summary
-
Constructor Details
-
CgroupMemoryStatusProvider
public CgroupMemoryStatusProvider()Create a new CgroupMemoryStatusProvider, for the control group the process is in when created.
-
-
Method Details
-
status
Description copied from interface:StatusProviderExposes status information to send to systemd.- Specified by:
statusin interfaceStatusProvider- Returns:
- the string message to add to the service status
-