What is a vCPU and How Do You Calculate vCPU to CPU?

What is a vCPU, or virtual processor, and how does it compare to a CPU? It’s the number one question we get from customers interested in buying cloud servers or bare metal.

In this article, we’ll examine what a vCPU is, as well as the differences between vCPUs and traditional CPUs. We’ll also look at the math behind vCPUs and how to calculate the number of vCPUs and cores. Quick tip, it’s not as easy as a kernel equals a vCPU.

What is a vCPU?

Before we begin, what is a vCPU? vCPU is short for virtual centralized processing unit. As for a definition, a vCPU represents a part or part of the underlying physical CPU that is allocated to a given virtual machine (VM).

Related Terms You Should Know

Below, let’s review some more terms and definitions related to virtual servers. They include hypervisor, socket, thread, physical core, and logical core. Feel free to jump to How does a vCPU work? o How is the vCPU calculated?

Hypervisor

What is a hypervisor? Think of a hypervisor as a controller. It is sometimes referred to as a virtual machine monitor (VMM). Simply put, a hypervisor is software used to create and run virtual machines (VMs). Allows a host computer to support multiple guest virtual machines by virtually sharing their resources, such as memory and processing. Hypervisors are smart enough to allocate resources, either a single vCPU or multiple vCPUs.

Socket

What is a socket? When you see the term socket, I want you to think of hardware. I want you to imagine the number of sockets on a motherboard. A socket is an array of pins that hold a processor in place and connect the motherboard to available processing power. The number of sockets is determined by the capacity of the motherboard.

There are differences in sockets depending on which CPU generation is supported.

Thread

What is a thread? A thread is an execution path within a process. A process contains one or more threads. What is the difference between a thread and a process? The main difference is that threads within the same process run in the shared memory space, while the processes run in separate memory spaces.

A thread is also known as a lightweight process. The concept of parallelism is dividing a process into multiple threads. For example, having multiple tabs open in a browser represents different threads. For word processing, there can be multiple threads, such as one thread for formatting text and another thread for processing input.

Physical

core

What is a physical core? A physical core, also known as processing units, within the CPU. A single physical core can correspond to one or more logical cores. We will get to what is a logical core in the next paragraph.

Logical

core

What is a logical core? A logical core makes it possible for a single physical core to perform two or more actions simultaneously. The logical cores come from the early days of Intel Xeon server processors and Pentium 4 desktop processors that were released in 2002.

Logical cores made the concept of hyper-threading (HTT) possible. Hyper-threading is Intel’s proprietary simultaneous multithreading implementation and was used to improve the parallelization of calculations performed on x86 microprocessors.

Why is hyper-threading important for virtualization? Prior to HTT, core subcomponents were not to be used for certain types of instructions and could have been used for long-lived instructions. HTT made it possible for the CPU to work on two tasks simultaneously.

Newer cores look more like full CPUs, so they’re capable of working on multiple tasks simultaneously. However, they are not true CPUs as physical cores are. There are limitations to hyper-threading versus the physical capabilities of the kernel.

How does a vCPU work?

How does a vCPU work? Virtual servers and their resource allocation are controlled by what is known as a hypervisor. We defined hypervisor in more detail above.

The hypervisor uses a portion of the CPU’s physical computing resources and allocates it to a vCPU assigned to a specific virtual machine. Some IT experts consider the concept behind vCPUs as a part of the time spent on the processor core. System administrators can use hypervisors to configure different resource allocations where specific virtual machines with specific vCPU capabilities are configured.

How is the vCPU calculated?

How

is the vCPU calculated? How many vCPUs are in a CPU? What are cores? These questions may be unclear to those who are not familiar with virtualized servers. Do not worry. We’ll go into detail about the math and have a clear idea of how to calculate how much vCPUs you need for your cloud servers. Much of this will depend on your specific requirements and the manufacturer.

The math behind

vCPU calculation

In the past, there was a rule of thumb that there were eight vCPUs per core. Today, the vCPU count is largely determined by the manufacturer. It is calculated by taking the number of processing threads offered by a chipset per core and multiplying the number of sockets occupied. Here’s what it looks like:

(Threads x cores) x Physical CPU = Number

of vCPUs vCPU and

core

calculation example

The best way to learn how to calculate vCPUs and cores is to demonstrate through

an example.

First, we need to select a virtual server and a CPU. For this example, we will select Intel Xeon E-2288G as the underlying CPU. Key statistics for the Intel Xeon E-2288G include 8 cores/16 threads with a base clock of 3.7GHz and a turbo boost of 5.0GHz. There is 16 MB of built-in cache.

(16 threads x 8 cores) x 1 CPU = 128 vCPUs

Determine your workload and utilization

That’s not all. How do you know where to start? First, you need to know your workload and application profiles. We can help you analyze this. Click here to contact us.

Any questions to consider before you begin? Are your applications running at 100% CPU usage all the time? Do you have periods where utilization explodes? Do you have maintenance windows? By knowing your requirements, you can make an informed decision about the underlying hardware.

Theoretically, if you have small virtual machines that barely use CPU time, you could easily get 20 to 30 virtual machines from an 8-core server. However, if you have larger workloads, such as a database server, you will have far fewer virtual machines from that same 8-core server. It is about the use and allocation of resources.

Next, let’s look at some different configuration options. We are doing this only as an example and your vCPU assignment to each virtual machine will depend on your specific workload.

4 vCPUs per virtual machine 128 vCPUs/4 vCPUs per virtual machine = 32 virtual machines 2 vCPUs per virtual machine 128 vCPUs/2 vCPUs per virtual machine = 64 virtual machines 1 vCPU per virtual machine 128

vCPUs / 1 vCPU pervirtual machine = 128 virtual machines

CPU exhaustion and poor performance There is something like

CPU exhaustion

that can cause poor performance for your

virtual machines

. The number of virtual cores assigned to a virtual machine is limited.

For example, Windows Server

2008 R2 limits the number of vCPUs to 4 per virtual machine, which is expanded to 64 in Windows Server 2012.

Need help selecting and configuring your virtual machines?

We hope you enjoyed this article about what vCPUs are and how to calculate vCPU requirements. Need help or have questions about how to determine your requirements? We can help you select the right servers and providers for your cloud environment with a free consultation.

Contact me to learn more about how to access the largest selection of cloud service providers: public and private cloud, bare-metal servers, and more.