Use control groups aka cgroups:
- verify that you are running cgroups v2:
$ ls /sys/fs/cgroup/cgroup.controllers
- Check available features to control:
$ cat /sys/fs/cgroup/cgroup.subtree_control
- Adjust TasksMax - the number of tasks that can be started by a user. This ensures that the number of tasks accounted for the user stays below a specific limit. A reasonable value might be
2500
.
# make a drop-in file
$ mkdir -p /etc/systemd/system/[email protected]
$ cat > /etc/systemd/system/[email protected]/delegate.conf << EOF
[Service] Delegate=tasks cpu io memory pids cpuset
EOF
$ systemctl daemon-reload
- Configure the user you want to control by using linger, enter the following:
loginctl enable-linger admin
You can see if a user is lingered by entering:
loginctl user-status admin
- To enable cgroups at the server level, in OpenLiteSpeed WebAdmin, navigate to Server Configuration > Security , edit the CGI Settings group and enable cgroups by setting it to
on
Note: Avoid systemctl
configuration if you see it in any tutorial in the web