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

  1. On each Compute node, edit /opt/pf9/etc/nova/conf.d/nova.conf and add vcpu_pin_set under the DEFAULT section. Set the vcpu_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.
Copy
  1. Set the reserved_host_memory_mb to reserve RAM for host processes.
Copy

Note: By default, this value is set to 512 MB.

  1. 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. Append isolcpus=2,3,4,5,6,7 to GRUB_CMDLINE_LINUX in /etc/default/grub, without modifying any existing arguments.
  2. Rebuild grub.
Copy
  1. Reboot the node.
  2. 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.
  3. Within the UI, create a new flavor and add the following metadata/specifications to it.
Copy
  1. Launch an instance using the newly created flavor.
  2. To verify the CPU(s) pinned to the instance, first identify the instance from the virsh list output.
Copy
Copy

Note: In the example above, the instance only has 1 CPU; and it's assigned to NUMA node 0 and core 3.

Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard