vCPU

On this page 7

A vCPU, or virtual CPU, is a virtual processor that a hypervisor presents to a virtual machine, which the guest operating system sees and uses exactly like a physical processor core. In virtualization, a vCPU is not a fixed piece of silicon: it is a schedulable execution context that the hypervisor runs on whichever physical core or hardware thread is available at each moment.

In public cloud offerings, the vCPU is also the unit in which compute capacity is sold. On most x86 instance types, one vCPU corresponds to one hardware thread, meaning half of a physical core with simultaneous multithreading enabled. This convention varies between providers and processor families, so comparing instance sizes by vCPU count alone can be misleading.

How a vCPU runs on physical hardware

Each vCPU is represented in the hypervisor as a thread or schedulable entity. When the guest wants to execute code, the hypervisor’s scheduler places that vCPU on a free logical processor of the host, and hardware virtualization extensions such as Intel VT-x and AMD-V let the guest run its instructions directly on the processor at near-native speed. Only privileged operations cause a VM exit, in which control passes briefly to the hypervisor.

Because vCPUs are scheduled rather than permanently assigned, a host can run more vCPUs than it has logical processors. When all vCPUs want to run at the same time, some must wait. That waiting time is visible inside Linux guests as steal time, the share of time a vCPU was ready but the hypervisor was running something else.

LayerWhat it isTypical count on one server
SocketPhysical processor package1 to 2, sometimes 4
Physical coreIndependent execution unit8 to 128 per socket
Hardware threadLogical processor via simultaneous multithreadingUsually 2 per core
vCPUVirtual processor seen by a guestFrom one up to hundreds per host
Layers between a vCPU and the silicon

Overcommitment and the vCPU-to-core ratio

The vCPU-to-physical-core ratio describes how heavily a host is overcommitted. Most virtual machines are idle much of the time, so allocating more vCPUs than cores is normal and economical. The acceptable ratio depends on how busy and how latency-sensitive the workloads are.

Workload typeCommon ratioReason
Latency-critical databases1:1, often with pinningPredictable response times
General production servers2:1 to 4:1Moderate load with headroom
Virtual desktops4:1 to 10:1Interactive, mostly idle users
Development and testUp to 10:1 or moreLow utilization, cost matters most
Typical vCPU-to-core ratios by workload

These ratios are starting points. The deciding metric is CPU ready or steal time: values that stay above a few percent indicate that vCPUs are waiting too often and that the host is overcommitted for its actual load.

Different terms describe processing capacity at different layers, and confusing them leads to incorrect sizing. The table summarizes how a vCPU relates to its neighbors in virtualization.

TermDefinitionRelation to vCPU
Physical coreHardware execution unitHosts one or more vCPUs over time
Hardware threadLogical processor sharing a coreCommonly equal to one cloud vCPU
Virtual machineComplete virtual computerContains one or more vCPUs
HypervisorSoftware that runs virtual machinesSchedules vCPUs onto hardware
Burstable vCPUvCPU with a baseline share and creditsFull speed only for limited periods
Processor terms in virtualization

Two virtual machines with four vCPUs each can therefore perform very differently. One may run on dedicated cores of a modern processor, while the other shares hardware threads on an older or heavily loaded host, or uses a burstable instance that falls back to a low baseline when its credits run out.

Sizing virtual machines by vCPU

The common instinct is to give a virtual machine many vCPUs to be safe. With hypervisors that schedule all vCPUs of a machine in close coordination, this can backfire: a large virtual machine must wait for enough free logical processors, and idle vCPUs still consume scheduling overhead. Right-sizing usually means starting small and adding vCPUs when measurements justify it.

ObservationLikely meaningAction
Guest CPU constantly near 100%Too few vCPUs for the loadAdd vCPUs or optimize the code
Guest CPU low, high steal timeHost contentionMove the VM or reduce host overcommit
Many vCPUs, low average useOversized machineReduce vCPUs to improve scheduling
Licensing billed per coreEach vCPU may countSize to the minimum the workload needs
Practical vCPU sizing decisions
  • Keep large virtual machines within one NUMA node where possible, so memory access stays local.
  • Use CPU pinning only for workloads that truly need it, because it reduces scheduling flexibility.
  • Check whether an application scales across cores at all; a single-threaded process gains nothing from extra vCPUs.

Limitations and common misunderstandings

The most frequent misunderstanding is that a vCPU equals a core. On many platforms it equals a hardware thread, and two threads on one core share execution resources, so two vCPUs usually deliver less than twice the throughput of one full core for compute-heavy work.

Performance also depends on the processor generation, clock speed and cache of the host, which the vCPU count does not reveal. Security considerations matter too: side-channel vulnerabilities in shared cores have led some platforms to avoid placing vCPUs of different tenants on sibling threads of the same core.

Understanding it simply

A vCPU is like a seat at a shared desk in an office. The company rents a certain number of seats, and the building manager makes sure there is somewhere to sit whenever work needs doing.

Most people are not at their desks all the time, so the building can rent out more seats than it physically has. That works well until everyone shows up at once and some must wait. More seats do not always mean more work done, because the speed of each desk and how crowded the building is matter just as much.

Applied in practice

A company runs a virtualization cluster of hosts with 32 physical cores and 64 hardware threads each. Its application servers were given 16 vCPUs each “for safety”, yet monitoring showed they averaged only 15% CPU usage while the hosts reported steal time of 8 to 10% during business hours.

The administrators reduced the application servers to 6 vCPUs, kept the database virtual machines at 8 vCPUs on dedicated cores within one NUMA node, and limited the overall ratio to 3 vCPUs per physical core. Steal time dropped below 2%, response times of the application became more consistent, and the same hosts could accommodate several additional virtual machines. Fewer, well-sized vCPUs delivered better performance than many oversized ones.