0

The problem is about the systemd services. I know we can limit the Memory Usage or Cpu usage of services but my question is that is there a way to restart service when it reaches to its Memory high limit(or cpu)? Because i want to know that if the service is out of memory(leak) it has to restart again. I used these in unit file for limiting memory and cpu of service:

MemoryHigh=100K
MemoryMax=150K
CPUQuota=10% 
mrbiyik
  • 1
  • 1
  • Conceptually l think the limits in a systemd service unit are designed to protect all the other services on your system from a run-away process and not the process itself - I think such a runaway service is expected to either gracefully recover from a MemoryHigh or to die when the hard limit MemoryMax is reached (and then systemd can restart it for you with `Restart=on-failure` ) see https://www.freedesktop.org/software/systemd/man/systemd.resource-control.html and the references therein - I think you need external monitoring on occurrences of MemoryHigh events – Bob Jan 07 '20 at 14:55

0 Answers0