[systemd-devel] setting cpulimit/iolimit on mysql thread not entire process

Mantas Mikulėnas grawity at gmail.com
Tue Nov 28 06:35:29 UTC 2023


On Tue, Nov 28, 2023 at 8:27 AM jai <jaimin at webuzo.com> wrote:

> I am able to set cpulimit, iolimit, etc for a process using its pid
> through cgroups v2. But for some threads of a single mysql process, how can
> I achieve that?
>

You cannot; 1) the limits are per-cgroup and the entire service is a single
cgroup; 2) the threads are created by mysqld, not by systemd, and systemd
does not monitor and move service processes across cgroups once the service
is already running; 3) afaik, in cgroups v2 it isn't even allowed for
threads of a single process to straddle multiple cgroups anymore.

I'm not a DBA but I've heard that one common way to handle this would be to
create a separate MySQL instance (probably on a separate machine, even)
that would replicate all the data, for the heavy users to query. (Or the
other way around, main instance for the heavy updates ⇒ replica for regular
queries.)

-- 
Mantas Mikulėnas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20231128/3534c51c/attachment.htm>


More information about the systemd-devel mailing list