Configure CPU Pinning (Nova)
Problem
Configure dedicated CPU cores pinned to instances for improved performance.
Environment
Platform9 Managed OpenStack - v3.4.0 and Higher
Nova
Procedure
On each Compute node, edit /opt/pf9/etc/nova/conf.d/nova.conf and add
vcpu_pin_setunder theDEFAULTsection. Set thevcpu_pin_setvalue to a list or range of physical CPU cores to reserve for virtual machine processes. If the number of cores is 8 then set aside cores 0 and 1 for the host, and assign cores 2 through 7 for instances.
vcpu_pin_set=2-7Set the
reserved_host_memory_mbto reserve RAM for host processes.
reserved_host_memory_mb=2048Note: By default, this value is set to 512 MB.
To restrict the host process from using the vcpu, add the
isolcpuskernel argument to the GRUB configuration so that the kernel is aware of the pinning. Appendisolcpus=2,3,4,5,6,7to GRUB_CMDLINE_LINUX in /etc/default/grub, without modifying any existing arguments.Rebuild grub.
# grub-mkconfig -o /boot/grub2/grub.cfgReboot the node.
From the UI, create a host aggregate and add all the nodes with pinning configured. Along with that, add the metadata with key as pinned and value as true.
Within the UI, create a new flavor and add the following metadata/specifications to it.
Launch an instance using the newly created flavor.
To verify the CPU(s) pinned to the instance, first identify the instance from the
virsh listoutput.
Note: In the example above, the instance only has 1 CPU; and it's assigned to NUMA node 0 and core 3.
Last updated
