cpulimit 介紹使用方法

cpulimit 可以用於限制特定 process 的 CPU 使用率,避免影響系統的整體效能。

安裝 cpulimit (以 Ubuntu 22.04 LTS 為例)

1
sudo apt-get install cpulimit

基本用法

1
cpulimit -l {value} -p {PID}

參數說明:
-l :指定 CPU 使用率的上限,範圍從 1 到 100。
-p :指定要限制的 PID。

cpulimit 預設只會對主 process 做限制, 若有 fork process 要記得加上 -m 參數