Dedicated servers · Question & answer

How should I allocate vCPUs and NUMA resources to virtual machines?

A vCPU is a schedulable virtual processor, not a guarantee of an exclusive physical core. Guest performance depends on host contention, memory locality and the application’s ability to use parallelism. Start with measured demand and host headroom; excessive vCPU allocation or rigid pinning can increase contention or worsen latency.

AdvancedDedicated NUMA-capable hosts; command examples use Linux and libvirt
Go to the answer

Before you start

  • Host topology access and the exact libvirt guest identity.

Instructions

1. Inspect host CPU and memory topology

Check the host’s NUMA capacity before deciding whether a large guest fits within one locality domain or needs a deliberate multi-node layout.

Remote Linux shell
numactl --hardware
lscpu -e=CPU,NODE,SOCKET,CORE

Logical CPUs can share a physical core. Compare node memory capacity and workload working set rather than counting threads alone.

2. Inspect the guest’s current CPU allocation

For a libvirt-managed VM, replace example-vm with the verified guest name and read its current vCPU information.

Remote Linux shell
virsh --connect qemu:///system vcpuinfo example-vm

Review vCPU count and any affinity information. Changing topology, pinning or memory placement requires a guest-specific plan and may need downtime.

3. Measure the result under representative demand

Compare application latency, throughput, host CPU contention and memory pressure before and after an approved adjustment. Preserve capacity for the host and other guests.

Check the result

  • The guest meets its workload target without excessive host contention, and its CPU and memory placement are consistent with the physical topology.

Troubleshooting

Adding vCPUs makes the application slower
Check scheduling contention, application parallelism and cross-node memory access.
One NUMA node is full while another is free
Inspect binding rules and guest placement before applying broader affinity restrictions.

Official references

Use the documentation for your installed version when a flag, service name or platform feature differs.