We use systemd --user
to run certain services of our own. In some cases, these "get out of hand" -- spawn way too many processes, which exhausts RAM and causes the machine to "thrash".
When this happens, kernel tries to kill some processes, but is not aggressive enough in that murder -- causing the machine to, effectively, lock up: no new ssh-logins, and even the existing ones aren't really usable.
Is it possible to, somehow, advise the kernel (ahead of time) for one or more of the following:
- Set a combined limit on memory usage by all processes spawn by the service?
- Kill all processes launched by the service, if it finds it necessary to kill one of them?
- Begin the killing with this service -- if it finds a need to kill anything at all?
I don't want to impose artificial limits on the service's children individually -- because, when things are fine, they should be using all of the hardware...