
私は、Ubuntu Server オペレーティング システムを使用してサーバーを作成しようとしていますが、電気代を節約するために、CPU を常に高い周波数にしたくありません。
負荷がない場合は低周波数で動作し、サーバーに負荷がある場合は高周波数で動作するようにしたいです。
答え1
リソースを過剰に消費する特定のプロセスのCPU使用率を制限するために使用できるパッケージ「cpulimit」があります。
インストール後
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