> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/fpp/latest/llms.txt) (all documentation: [llms.txt](https://docs.cennso.com/llms.txt)). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cennso.com/components/fpp/latest/deployment-guides/resource-configuration.md).

# Configure resource usage

You can configure the resource usage of Fast Path Provider (FPP).

## Memory configuration

For the most common cases, allocate the following resources to FPP node pods:

```yaml
resources:
  cpu: "10"
  hugepages-2Mi: 9Gi
  memory: 2Gi
```

For FPP 1.0, use the following settings:

```yaml
resources:
  cpu: "10"
  hugepages-2Mi: 6Gi
  memory: 6Gi
```

## CPU pinning

By default, FPP relies on [Kubernetes CPU Manager](https://kubernetes.io/docs/tasks/administer-cluster/cpu-management-policies/) running in the `static` mode. In this mode, FPP pods use the Guaranteed QoS class, where requests are the same as the limits. As a result, FPP reads the cpuset cgroup configuration and assigns cores to the Vector Packet Processing (VPP) process through `startup.conf`. To check the cores of the VPP process, run the following command in the VPP switch pod:

```bash
cat /var/run/vppswitch/startup.conf
```

The output shows the CPU cores that FPP pins for the VPP process:

```text
cpu {
  main-core 27
  corelist-workers 28,29,30,31
}
```

The output shows that FPP pins the VPP main thread to core 27 (`main-core 27`). Without `main-core`, VPP uses the first available core. The line `corelist-workers 28,29,30,31` means VPP automatically assigns those CPU cores to worker threads.

### Max CPU cores

Another approach to VPP CPU allocation is to use `vpp.maxCPUCores` without the `isolcpus` kernel parameter. As in a regular FPP deployment, FPP pods use the Guaranteed QoS class, so Kubernetes CPU Manager gives them a dedicated cpuset. Assign the FPP pod more CPU than VPP uses, for example, 14:

```yaml
resources:
  cpu: "14"
  hugepages-2Mi: 9Gi
  memory: 2Gi
vpp:
  maxCPUCores: "5"
```

In this case, the FPP pod gets seven physical cores, and VPP uses five of them. To check the cores of the pod, run the following command in the FPP pod:

```bash
cat /proc/self/status | grep Cpus
```

See the output example:

```text
Cpus_allowed_list: 1-7,49-55
```

This output lists the CPU cores that the Kubernetes CPU Manager assigns to the FPP pod. In this case, the pod has cores 1–7 and 49–55. VPP uses five of these cores, as `vpp.maxCPUCores: "5"` sets.

The resulting `startup.conf` file contains the following CPU section:

```text
cpu {
  main-core 1
  corelist-workers 2,3,4,5
}
```

The Linux scheduler uses cores 6 and 7 for processes other than VPP. The most important of them are the kernel threads that serve TAP interfaces (`vhost-<PID>`).

### Hyper-threading siblings

**spec.vpp.allowHtSiblings** sets how much CPU one VPP thread takes. With the default `false`, a thread takes a whole physical core, which is two logical CPUs on a host with hyper-threading. With `true`, a thread takes a single sibling, so the same **spec.resources.cpu** gives twice as many threads. The field exists on both `FPPDeployment` and `CGWDeployment`.

Thread 0 is the VPP main thread. The main thread forwards traffic only when it is the only thread. When at least one worker thread exists, the worker threads forward the traffic.

The following table lists the threads that each allocation gives on a host with two siblings per physical core:

| spec.vpp.allowHtSiblings | spec.resources.cpu | VPP threads | Worker threads | Physical cores |
|---|---|---|---|---|
| `false` | 6 | 3 | 2 | 3 |
| `true` | 3 | 3 | 2 | 1.5 |
| `false` | 10 | 5 | 4 | 5 |
| `true` | 5 | 5 | 4 | 2.5 |
| `false` | 18 | 9 | 8 | 9 |
| `true` | 9 | 9 | 8 | 4.5 |

> [!IMPORTANT]
> The schema marks **spec.vpp.allowHtSiblings** for testing purposes only. Set it to `true` only in test environments.

The following snippet sets **spec.vpp.allowHtSiblings** to `true` and gives VPP five threads on 2.5 physical cores:

```yaml
resources:
  cpu: "5"
vpp:
  allowHtSiblings: true
```

A thread on a sibling forwards less than a thread on a whole physical core. A physical core with two threads forwards more than a physical core with one thread. [Performance](https://docs.cennso.com/components/fpp/latest/benchmarking.md#hyper-threading-siblings) lists both figures, for the memif (in-memory interface) path and for the single root I/O virtualization (SR-IOV) uplink. These results cover throughput only, not latency.

## Verification

To verify that FPP applies the resource configuration correctly, check DaemonSet or StatefulSet on the target Core Cluster. `FPPDeployment` creates a DaemonSet, while `CGWDeployment` creates a StatefulSet. See [deployment modes](https://docs.cennso.com/components/fpp/latest/deployment-guides.md#deployment-modes) for more details.

1. Check resource requests and limits on `FPPDeployment` pods:

   ```bash
   kubectl get pod -l cennso.net/cka=fpp -A -o custom-columns="NAME:.metadata.name,CPU-REQ:.spec.containers[*].resources.requests.cpu,MEM-REQ:.spec.containers[*].resources.requests.memory,CPU-LIM:.spec.containers[*].resources.limits.cpu,MEM-LIM:.spec.containers[*].resources.limits.memory"
   ```

   Sample output:

   ```text
   NAME             CPU-REQ   MEM-REQ   CPU-LIM   MEM-LIM
   fpp-node-tdgkm   10        2Gi       10        2Gi
   ```

2. For `CGWDeployment`, check the resources using the value of **spec.releaseName** as `{CGW_RELEASE_NAME}` in a `kubectl` query (by default `cgw-instance`):

   ```bash
   kubectl get pod -l cennso.net/cnf={CGW_RELEASE_NAME} -A -o custom-columns="NAME:.metadata.name,CPU-REQ:.spec.containers[*].resources.requests.cpu,MEM-REQ:.spec.containers[*].resources.requests.memory,CPU-LIM:.spec.containers[*].resources.limits.cpu,MEM-LIM:.spec.containers[*].resources.limits.memory"
   ```

   Sample output:

   ```text
   NAME           CPU-REQ   MEM-REQ   CPU-LIM   MEM-LIM
   fpp-cgw-r1-0   2         1050Mi    2         1050Mi
   ```
