スレッドとプロセスの共有にcgconfigを使用する(CPU制限)

スレッドとプロセスの共有にcgconfigを使用する(CPU制限)

cgconfig ルールでは、ユーザーに対して次の制限を設定しました。

# cat /etc/cgconfig.conf
group group_mahmood {
  cpu {
    cpu.shares = 300;
  }
  memory {
    memory.limit_in_bytes = 1073741824;
  }
}
# cat /etc/cgrules.conf
mahmood     cpu,memory grou_mahmood/
# service cgred restart
Redirecting to /bin/systemctl restart cgred.service
# service cgconfig restart
Redirecting to /bin/systemctl restart cgconfig.service

ストレスコマンドを実行すると、stress --cpu 8 --timeout 20topの出力は次のようになります。

28685 mahmood   20   0    7312    100      0 R 100.0  0.0   0:11.41 stress
28686 mahmood   20   0    7312    100      0 R  99.7  0.0   0:11.42 stress
28687 mahmood   20   0    7312    100      0 R  99.7  0.0   0:11.42 stress
28688 mahmood   20   0    7312    100      0 R  99.7  0.0   0:11.42 stress
28689 mahmood   20   0    7312    100      0 R  99.7  0.0   0:11.42 stress
28690 mahmood   20   0    7312    100      0 R  99.7  0.0   0:11.43 stress
28691 mahmood   20   0    7312    100      0 R  99.7  0.0   0:11.43 stress
28692 mahmood   20   0    7312    100      0 R  99.7  0.0   0:11.43 stress

スレッドの共有制限(800%)のようです。 CPU制限プロセス数を設定するには?実際には両方が必要です。論理的に一緒に「OR」する必要があります。

ベストアンサー1

あなたは調整する必要があります。CPU.cfs_quota_usCPU.sharesではなく調整可能です。 RHEL6 ドキュメントに接続したが、cgredRHEL7 で使用する場合も同様です。

systemd関連ユニットでは、以下を設定できます。CPUクォータ環境。 user-1001.sliceに設定できますが(ユーザーのUIDが1001であると仮定)、RHEL7のsystemdバージョンではこれを行う普遍的な方法はありません。 (テンプレート単位は後で表示されます)

おすすめ記事