From: tastytea <gentoo@tastytea.de>
To: gentoo-user@lists.gentoo.org
Subject: [gentoo-user] cgroups and OpenRC: Am I doing it wrong?
Date: Thu, 15 Jul 2021 09:58:00 +0200 [thread overview]
Message-ID: <20210715095800.6dbcdfe5@ventiloplattform.tastytea.de> (raw)
[-- Attachment #1: Type: text/plain, Size: 1836 bytes --]
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 tastytea@tastytea.de` or at
<https://tastytea.de/tastytea.asc>.
[-- Attachment #2: Digitale Signatur von OpenPGP --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next reply other threads:[~2021-07-15 7:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-15 7:58 tastytea [this message]
2021-07-16 8:50 ` [gentoo-user] cgroups and OpenRC: Am I doing it wrong? tastytea
2021-07-16 16:41 ` tastytea
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210715095800.6dbcdfe5@ventiloplattform.tastytea.de \
--to=gentoo@tastytea.de \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox