we have 342 RHEL 8.6 machines and all machines are with the same situation when systemctl service took much more memory then the PID itself
systemctl status presto.service ● presto.service - Perforce Server . . . Main PID: 3683651 (presto-server) Tasks: 284 (limit: 3297083) Memory: 298.1G CGroup: /system.slice/presto.service while the presto PID itself consume around 32G
more /sys/fs/cgroup/memory/system.slice/presto.service/memory.usage_in_bytes 31329787904 --> ~32G we can also check how much presto PID consuming by ps aux --sort=-%mem | head
in any case we can do workaround as the follwing in order to limit the service as
[Service] User=presto Group=presto_group MemoryMax=64000M MemoryHigh=60000M but before above setting we want to know how it can be that systemctl show consuming of ~300G while the presto PID itself takes much less - 32G
here the command that systemctl controlled
# The type should always be set to "forking" to support # multiple Perforce processes: Type=forking # The command used to start Perforce: ExecStart=/home/presto/server/bin/launcher start ExecStop=/home/presto/server/bin/launcher stop Restart=always RestartSec=30s StartLimitInterval=0 StartLimitBurst=5 RemainAfterExit=no LimitNOFILE=65536 [Install] # Describes the target for this service -- this will always # be 'multi-user.target': WantedBy=multi-user.target