Configuring CPU affinity

Overview

By default, the DANOS vRouter control and data planes share the CPUs. The data plane uses threads per CPU to perform forwarding work and additional tasks. Its optimization is automatic and high performance for average use environments. However, many environments are not average, for example:

  • Extra resources are required for controller or routing protocols.

  • Data plane threads must be reduced to avoid consuming resources.

The DANOS vRouter allows you to configure CPU affinity on the default data plane. CPU affinity allows you to designate a range of CPUs used by the data plane threads.

Misconfiguration of CPU affinity may adversely affect the performance of the vRouter.

If you define CPU affinity for the data plane, the data plane threads are bound to a range of CPUs and executed only on these CPUs. When the CPUs are bound to the data plane, the system and controller threads do not use these CPUs. For example, if the data plane is on an eight CPU system, and the data plane CPU affinity is set to CPUs 1 through 3, then the control and system threads use CPUs 0, and 4 through 7.

The vRouter always allows control threads to run on CPU 0.
To display the number of CPUs available for the data plane, use show hardware cpu.

Configuring CPU affinity on the default data plane

By default, the default dataplane uses all CPUs. The following example provides the configuration for CPU affinity on the default dataplane by using system default dataplane cpu-affinity <cpu-list>. For example:

vyatta@vyatta# set system default dataplane cpu-affinity 1-3,4

The CPU ID does not have to exist in the system where the data plane is running. For example, if you configure cpu-affinity with a range of 0-3 and the data plane is running on a two CPU system, then the data plane only uses CPUs 0 and 1 and silently ignores the other CPUs in the affinity.

If cpu-affinity is out of the range of the available CPUs in the dataplane environment, for example, if you configure cpu-affinity with a range of 4-7 on a two CPU system, the data plane is not started.