32.10. 低レイテンシーチューニングへの TuneD の cpu-partitioning プロファイルの使用
この手順では、TuneD の cpu-partitioning
プロファイルを使用して、低レイテンシーになるようにシステムをチューニングする方法を説明します。これは、cpu-partitioning の図で説明されているように、cpu-partitioning
と CPU レイアウトを使用できる低レイテンシーのアプリケーションの例を使用します。
この場合のアプリケーションでは、以下を使用します。
- ネットワークからデータを読み込む 1 つの専用リーダースレッドが、CPU 2 に固定されます。
- このネットワークデータを処理する多数のスレッドは、CPU 4-23 に固定されます。
- 処理されたデータをネットワークに書き込む専用のライタースレッドは、CPU 3 に固定されます。
前提条件
-
yum install tuned-profiles-cpu-partitioning
コマンドを root で使用して、cpu-partitioning
TuneD プロファイルをインストールしている。
手順
/etc/tuned/cpu-partitioning-variables.conf
ファイルを次のように編集します。isolation_cores=${f:calc_isolated_cores:1}
行をコメントアウトします。# isolated_cores=${f:calc_isolated_cores:1}
分離された CPU について次の情報を追加します。
# All isolated CPUs: isolated_cores=2-23 # Isolated CPUs without the kernel’s scheduler load balancing: no_balance_cores=2,3
cpu-partitioning
TuneD プロファイルを設定します。# tuned-adm profile cpu-partitioning
システムを再起動します。
再起動後、システムは、cpu-partitioning の図の分離に従って、低レイテンシーにチューニングされます。このアプリケーションでは、タスクセットを使用して、リーダーおよびライターのスレッドを CPU 2 および 3 に固定し、残りのアプリケーションスレッドを CPU 4-23 に固定できます。
検証
分離された CPU が
Cpus_allowed_list
フィールドに反映されていないことを確認します。# cat /proc/self/status | grep Cpu Cpus_allowed: 003 Cpus_allowed_list: 0-1
すべてのプロセスのアフィニティーを確認するには、次のように入力します。
# ps -ae -o pid= | xargs -n 1 taskset -cp pid 1's current affinity list: 0,1 pid 2's current affinity list: 0,1 pid 3's current affinity list: 0,1 pid 4's current affinity list: 0-5 pid 5's current affinity list: 0,1 pid 6's current affinity list: 0,1 pid 7's current affinity list: 0,1 pid 9's current affinity list: 0 ...
注記TuneD は、一部のプロセス (主にカーネルプロセス) のアフィニティーを変更できません。この例では、PID 4 および 9 のプロセスは変更されません。
関連情報
-
tuned-profiles-cpu-partitioning(7)
man ページ