- 如果来宾需要多于 10 个核心和约 100GB 内存,那么来宾应使用两个节点。在下面的 libvirt XML 定义示例中,使用了节点 16 和 17 来限制来宾。
...
<memory unit='KiB'>125566976</memory>
<currentMemory unit='KiB'>125566976</currentMemory>
<memoryBacking>
<hugepages/>
</memoryBacking>
<vcpu placement='static'>80</vcpu>
<cputune>
<vcpupin vcpu='0' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='1' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='2' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='3' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='4' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='5' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='6' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='7' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='8' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='9' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='10' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='11' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='12' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='13' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='14' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='15' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='16' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='17' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='18' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='19' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='20' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='21' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='22' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='23' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='24' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='25' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='26' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='27' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='28' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='29' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='30' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='31' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='32' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='33' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='34' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='35' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='36' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='37' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='38' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='39' cpuset='80,88,96,104,112'/>
<vcpupin vcpu='40' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='41' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='42' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='43' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='44' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='45' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='46' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='47' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='48' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='49' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='50' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='51' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='52' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='53' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='54' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='55' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='56' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='57' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='58' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='59' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='60' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='61' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='62' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='63' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='64' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='65' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='66' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='67' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='68' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='69' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='70' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='71' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='72' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='73' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='74' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='75' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='76' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='77' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='78' cpuset='120,128,136,144,152'/>
<vcpupin vcpu='79' cpuset='120,128,136,144,152'/>
</cputune>
……
<numa>
<cell cpus='0-39' memory='62783488'/>
<cell cpus='40-79' memory='62783488'/>
</numa>
...
|
- 在来宾使用大页面时,向主机上的节点 16 和 17 分配足够多的大页面:
echo 3840 >/sys/devices/system/node/node16/hugepages/hugepages-16384kB/nr_hugepages
|
echo 3840 >/sys/devices/system/node/node17/hugepages/hugepages-16384kB/nr_hugepages
|
- 使用 pagemapscan-numa 实用程序,确保来宾限制在节点 16 和 17 中,如下所示:
./pagemapscan-numa 85538 2
host-node00 host-node01 host-node16 host-node17 not-present
----------- ----------- ----------- ----------- -----------
VM-node00| 0(000%) 0(000%) 978176(100%) 0(000%) 0(000%)
VM-node01| 0(000%) 0(000%) 0(000%) 978176(100%) 0(000%)
|
- 在 PowerKVM 3.1 中,libvirt XML 定义有一个新的内存固定选项,该选项不需要使用大页面来在来宾上设置内存关联。
- 新 numatune memnode 特性可将来宾节点 cellid(与它上方的单元创建节匹配)映射到相应的主机节点 nodeset。下面的代码示例显示了定义的第一个单元创建部分:
<cpu>
<topology sockets='2' cores='10' threads='8'/>
<numa>
<cell id='0' cpus='0-79' memory='5242880' unit='KiB'/>
<cell id='1' cpus='80-159' memory='5242880' unit='KiB'/>
</numa>
</cpu>
<numatune>
<memnode cellid='0' mode='strict' nodeset='1'/>
<memnode cellid='1' mode='strict' nodeset='16'/>
</numatune>
|
大页面支持在使用基于 Java™ 的 MongoDB 应用程序时,只需要在来宾上配置大页面支持。
- libvirt XML 定义文件中的来宾定义必须按以下方式指定 memoryBacking:
<domain type=’kvm’>
<name>myguest<\name>
<uuid>...</uuid>
<memory>2048</memory>
<currentMemory>2048</currentMemory>
<memoryBacking>
<hugepages/>
</memoryBacking>
...
</domain>
|
- 运营以下命令在来宾中启用大页面:echo 2000 > /proc/sys/vm/nr_hugepages
hugeadm --create-mounts
- 您还需要根据后面的 Application-level -> Java Tuning 部分的介绍,在主机上分配大内存。
数据磁盘直通因为来宾分区上的虚拟 SCSI (VSCSI) 模拟磁盘通常很慢,所以您应在 libvirt XML 定义文件中将磁盘设置为 lun,如下所示:
<disk type="block" device="lun">
<driver name="qemu" type="raw" cache="directsync"/>
<source dev="/dev/sdb"/>
<target dev="sdb" bus="scsi"/>
<address type="drive" controller="0" bus="0" target="3" unit="0"/>
</disk>
|
有关更多信息,请参阅 IBM Redbooks 中的第 98 页。
网络 PCI 直通在 libvirt XML 定义中将 type 属性设置为 pci,如下面的示例所示:
<devices>
...
<hostdev mode=’subsystem’ type=’pci’ managed=’yes’>
<source>
<address domain=’0x000’ bus=’0x15’ slot=’0x00’ function=’0x0’/>
</source>
</hostdev>
</devices> |