Linuxでmaxcpusを調整してみる
制限した場合の性能チェックなどに。
/etc/grub.conf
1 2 3 4 5 6 7 8 9 10 11 |
$ cat /etc/grub.conf # created by imagebuilder default=0 fallback=1 timeout=1 hiddenmenu title Amazon Linux 2016.03 (4.4.5-15.26.amzn1.x86_64) root (hd0,0) kernel /boot/vmlinuz-4.4.5-15.26.amzn1.x86_64 root=LABEL=/ console=ttyS0 initrd /boot/initramfs-4.4.5-15.26.amzn1.x86_64.img |
HVMはGRUBでCPUコア数を変更できるとのこと
1 2 |
$ sudo /sbin/grubby --update-kernel=ALL --args=maxcpus=18 $ sudo /sbin/shutdown -r now |
再起動してもう一度確認
1 2 3 4 5 6 7 8 9 10 |
$ cat /etc/grub.conf # created by imagebuilder default=0 timeout=1 hiddenmenu title Amazon Linux 2016.03 (4.4.5-15.26.amzn1.x86_64) root (hd0,0) kernel /boot/vmlinuz-4.4.5-15.26.amzn1.x86_64 root=LABEL=/ console=ttyS0 maxcpus=18 initrd /boot/initramfs-4.4.5-15.26.amzn1.x86_64.img |
maxcpusの設定が増えてますね。
次にlscpuコマンドでCPUの確認
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
$ lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 1 On-line CPU(s) list: 0 Thread(s) per core: 1 Core(s) per socket: 1 Socket(s): 1 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 63 Model name: Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz Stepping: 2 CPU MHz: 2394.480 BogoMIPS: 4788.96 Hypervisor vendor: Xen Virtualization type: full L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 30720K NUMA node0 CPU(s): 0 |
あれ、t2.microで起動してたのでそもそもCPUが1コアでした…
というわけでスペックをc4.8xlargeに変更して再度確認。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
$ lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 36 On-line CPU(s) list: 0-17 Off-line CPU(s) list: 18-35 Thread(s) per core: 1 Core(s) per socket: 9 Socket(s): 2 NUMA node(s): 2 Vendor ID: GenuineIntel CPU family: 6 Model: 63 Model name: Intel(R) Xeon(R) CPU E5-2666 v3 @ 2.90GHz Stepping: 2 CPU MHz: 1398.796 BogoMIPS: 5876.20 Hypervisor vendor: Xen Virtualization type: full L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 25600K NUMA node0 CPU(s): 0-8 NUMA node1 CPU(s): 9-17 |
36CPUに対して、On-LineのCPUが0-17(18個)となりました。