www-apps/gitea often used all 4 of my CPU cores and slowed everything
else down. So I attempted to limit CPU usage with cgroups:
I have set this in /etc/rc.conf:
rc_cgroup_mode="unified"
rc_cgroup_controllers="cpu memory io pids"
And this in /etc/conf.d/gitea:
rc_cgroup_settings="
cpu.shares 128
cpu.cfs_period_us 1000000
cpu.cfs_quota_us 1000000
memory.limit_in_bytes 8G
"
According to my research, setting cpu.cfs_period_us and
cpu.cfs_quota_us to the same value should ensure that only the power of
one core is used, and “cpu.shares 128” should only use 12.5% (half a
core in my case) of the CPU if the system is under load. The CPU usage
in htop should be at most 100%, right?. However, I often see 110%,
sometimes up to 180% and rarely 230%. Are that all accounting errors or
did I do someting wrong? How can I check if my settings are applied?
/sys/fs/cgroup/gitea/cgroup.threads contains all the gitea-pids and the
pids of its child processes.
$ zgrep CGROUP /proc/config.gz
CONFIG_CGROUPS=y
CONFIG_BLK_CGROUP=y
CONFIG_CGROUP_WRITEBACK=y
CONFIG_CGROUP_SCHED=y
CONFIG_CGROUP_PIDS=y
# CONFIG_CGROUP_RDMA is not set
CONFIG_CGROUP_FREEZER=y
CONFIG_CGROUP_HUGETLB=y
CONFIG_CGROUP_DEVICE=y
CONFIG_CGROUP_CPUACCT=y
CONFIG_CGROUP_PERF=y
# CONFIG_CGROUP_DEBUG is not set
CONFIG_SOCK_CGROUP_DATA=y
CONFIG_BLK_CGROUP_RWSTAT=y
# CONFIG_BLK_CGROUP_IOLATENCY is not set
# CONFIG_BLK_CGROUP_IOCOST is not set
# CONFIG_NETFILTER_XT_MATCH_CGROUP is not set
CONFIG_NET_CLS_CGROUP=y
CONFIG_CGROUP_NET_PRIO=y
CONFIG_CGROUP_NET_CLASSID=y
$ mount | grep cgroup
none on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime)
Kind regards, tastytea
--
Get my PGP key with `gpg --locate-keys
tast...@tastytea.de` or at
<
https://tastytea.de/tastytea.asc>.