这专门针对使用最新 ISPConfig 的用户。
我在 jailkit 中安装了 nextcloud,它运行完美,只是 CPU 占用较高。
问题user-${UID}.slice 被忽略
在 ISPConfig linux 规则中,“每个用户名 1 个唯一的用户 ID”似乎被违反了,ISPConfig 用户会认识到这一点:
#cat /etc/passwd
web6:x:7886:7886::/var/www/clients/client8/web6/./home/web6:/usr/sbin/jk_chrootsh
adifferentusername:x:7886:7886::/var/www/clients/client8/web6/./home/adifferentusername:/usr/sbin/jk_chrootsh
根据 debian 管理我应该可以CPUQuota=
通过运行以下命令创建一个值并限制用户 web6 的 CPU 使用率:
#systemctl set-property user-7886.slice CPUQuota=35%
&& systemctl start user-7886.slice
&&systemcrl daemon-reload
哪一个成功的经 验证systemctl cat user-7886.slice
,其内容如下:
# /etc/systemd/system.control/user-7886.slice.d/50-CPUAccounting.conf
# This is a drop-in unit file extension, created via "systemctl set-property"
# or an equivalent operation. Do not edit.
[Slice]
CPUAccounting=yes
# /etc/systemd/system.control/user-7886.slice.d/50-CPUQuota.conf
# This is a drop-in unit file extension, created via "systemctl set-property"
# or an equivalent operation. Do not edit.
[Slice]
CPUQuota=35%
# /etc/systemd/system.control/user-7886.slice.d/50-CPUWeight.conf
# This is a drop-in unit file extension, created via "systemctl set-property"
# or an equivalent operation. Do not edit.
[Slice]
# /usr/lib/systemd/system/user-.slice.d/10-defaults.conf
# SPDX-License-Identifier: LGPL-2.1+
#
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
尽管需要正确的设置来限制用户的 CPU 使用率(如上所示),但每当位于 /var/www/clients/client8/web6/web 目录的 nextcloud 安装(记住“web6”也是系统用户)执行同步功能时,它仍然能够使用无限的 CPU。
CPUQuota=45%
我已通过直接添加到 临时将 CPUQuota 直接放置在 nextcloud 和所有应用程序(wordpress /drupal 等)使用的 php7.4-fpm 上#nano /usr/lib/systemd/system/php7.4-fpm.service
。说明CPUQuota
(systemd / cgroup)运行正常,但 ISPConfig 独特的 linux 用户配置似乎会干扰/阻止 systemd / cgroup 正确应用用户。${UID} .slice 属性。
还有其他人找到使用 debian/ubuntu systemd v241 限制每个 ISPConfig 用户的 CPU 使用率的解决方案吗?