
我正在嘗試使用Ubuntu伺服器作業系統製作伺服器,並且我不希望CPU始終處於高頻率,只是這樣我可以節省一些電費。
我希望它在沒有負載時以低頻工作,在伺服器有負載時以高頻工作。
答案1
有一個包“cpulimit”,您可以使用它來限制消耗過多資源的特定進程的 cpu 百分比
安裝後
sudo apt update && sudo apt install cpulimit
您可以使用它來分別使用 -p、-e 和 -P 來限制 1- 進程(按 ID)或 2- 進程(按可執行檔案名稱)或 3- 路徑的資源消耗。
這些範例來自手冊:
cpulimit -e foo -l 50
limits the CPU usage of the process by acting on the executable
program file (note: the argument "--bar" is omitted)
cpulimit -p 1234 -l 50
limits the CPU usage of the process by acting on its PID, as
shown by ps(1)
cpulimit -P /usr/bin/foo -l 50
same as -e but uses the absolute path name