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_set
under theDEFAULT
section. Set thevcpu_pin_set
value 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.
- Set the
reserved_host_memory_mb
to reserve RAM for host processes.
Note: By default, this value is set to 512 MB.
- To restrict the host process from using the vcpu, add the
isolcpus
kernel argument to the GRUB configuration so that the kernel is aware of the pinning. Appendisolcpus=2,3,4,5,6,7
to GRUB_CMDLINE_LINUX in /etc/default/grub, without modifying any existing arguments. - Rebuild grub.
- Reboot 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 list
output.
Note: In the example above, the instance only has 1 CPU; and it's assigned to NUMA node 0 and core 3.
Was this page helpful?