> For the complete documentation index, see [llms.txt](https://platform9.com/kb/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://platform9.com/kb/pmo/how-to/configure-cpu-pinning-nova.md).

# 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.

{% tabs %}
{% tab title="None" %}

```none
vcpu_pin_set=2-7
```

{% endtab %}
{% endtabs %}

2. Set the *`reserved_host_memory_mb`* to reserve RAM for host processes.

{% tabs %}
{% tab title="None" %}

```none
reserved_host_memory_mb=2048
```

{% endtab %}
{% endtabs %}

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

3. 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.
4. Rebuild grub.

{% tabs %}
{% tab title="None" %}

```none
# grub-mkconfig -o /boot/grub2/grub.cfg
```

{% endtab %}
{% endtabs %}

5. Reboot the node.
6. 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.***
7. Within the UI, create a new flavor and add the following metadata/specifications to it.

{% tabs %}
{% tab title="None" %}

```none
hw:cpu_policy -> dedicated 
aggregate_instance_extra_specs:pinned -> true
```

{% endtab %}
{% endtabs %}

8. Launch an instance using the newly created flavor.
9. To verify the CPU(s) pinned to the instance, first identify the instance from the **`virsh list`** output.

{% tabs %}
{% tab title="None" %}

```none
# virsh list Id    
Name                           State
---------------------------------------------------- 
7     773fcf47-07e4-4e07-b681-ee2c39727666 running 
8     5a80a581-7259-4c6e-82c4-8cbb48100186 running
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="None" %}

```none
After identifying the instance, pass its ID to the virsh vcpupin command:
# virsh vcpupin 8
VCPU: CPU Affinity
----------------------------------
0: 3
```

{% endtab %}
{% endtabs %}

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://platform9.com/kb/pmo/how-to/configure-cpu-pinning-nova.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
