tech:limiter_les_ressources_cpu_pour_un_process_donne

Limiter les ressources CPU pour un process donne

Restreindre l'usage de CPU

How to limit CPU Usage of a process

Voir :

nice -n 19 COMMAND

ou

renice +19 1234
#ionice -c3 -p 1234

Ou encode

systemd-run -p IOWeight=10 updatedb

Exemple

# best effort, highest priority
sudo ionice -c2 -n0 -p `pgrep etcd`
cgcreate -g cpu:/cpulimit
cgset -r cpu.cfs_period_us=1000000 cpulimit
cgset -r cpu.cfs_quota_us=100000 cpulimit

check

cgget -g cpu:cpulimit
cgexec -g cpu:cpulimit COMMAND

ou

echo 1234 > /sys/fs/cgroup/cpu/cpulimit/tasks

ou

#cpulimit -p <PID> -l <%CPU>
cpulimit -p 1234 -l 80

Pb

write error: No space left on device

Erreur

# echo 1234 > /sys/fs/cgroup/cpuset/cpulimit/tasks
-bash: echo: write error: No space left on device

Solution

echo 0 > /sys/fs/cgroup/cpuset/cpulimit/cpuset.mems 
echo 0 > /sys/fs/cgroup/cpuset/cpulimit/cpuset.cpu

How to limit a process to one CPU core in Linux - CPU affinity

start a command with the given affinity

taskset -c 0 mycommand --option

set the affinity of a running process

taskset -c -pa 0 1234
tech/limiter_les_ressources_cpu_pour_un_process_donne.txt · Dernière modification : de Jean-Baptiste

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki