What is a vCPU, or virtual processor, and how does it compare to a CPU? It’s the number one question that we receive from customers interested in purchasing 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 mathematics behind vCPUs and how to calculate the number of vCPUs and cores. Quick hint, it’s not as easy as one core equals one vCPU.
What is a vCPU?
Before we get started, what is a vCPU? vCPU is the abbreviation for virtual centralized processing unit. As for a definition, a vCPU represents a portion or share of the underlying, physical CPU that is assigned to a particular virtual machine (VM).
Related Terms You Should Know
Next, let’s review a few more terms and definitions relating to virtual servers. They include hypervisor, socket, thread, physical core, and logical core. Feel free to skip ahead to How Does a vCPU Work? or How Do You Calculate vCPU?
What is a hypervisor? Think of a hypervisor as a controller. It’s sometimes referred to as a virtual machine monitor (VMM). Simply put, a hypervisor is software used to create and run virtual machines (VMs). It allows one host computer to support multiple guest VMs by virtually sharing its resources such as memory and processing. Hypervisors are smart enough to allocate resources whether a single vCPU or numerous vCPUs.
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 in a motherboard. A socket is an array of pins that hold a processor in place and connect the motherboard to the available processing power. The number of sockets is determined by the capacity of the motherboard.
There are differences in sockets depending on which generation CPU is supported.
What is a thread? A thread is a path of execution within a process. A process contains one or more threads. What’s the difference between a thread and a process? The primary difference is that threads within the same process run in shared memory space, while processes run in separate memory spaces.
A thread is also known as a lightweight process. The concept of parallelism is to divide a process into multiple threads. As an example, having multiple tabs open in a browser represents different threads. For word processing, there can be multiple threads such as one for formatting text and another thread for processing inputs.
What is a physical core? A physical core, also referred to as processing units, within the CPU. A single physical core may correspond to one or more logical cores. We will get to what a logical core is in the next paragraph.
What is a logical core? A logical core makes it possible for a single physical core to perform two or more actions simultaneously. Logical cores came from the early days of Intel Xeon server processors and Pentium 4 desktop processors which 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 parallelization of computations performed on x86 microprocessors.
Why is hyper-threading important to virtualization? Before HTT, the sub-components of the core were not to be being used for certain types of instructions and could have been used for long-running instruction. HTT made it possible for the CPU to work on two tasks simultaneously.
Newer cores are more like full-fledged CPUs so they’re capable of working on multiple tasks simultaneously. However, they’re not true CPUs as the physical cores are. There are limitations to hyper-threading versus the physical capabilities of the core.
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 physical CPU computing resources and allocates it to a vCPU which is assigned to a specific VM. Some IT experts consider the concept behind vCPUs as a share of the time spent on the processor’s core. System administrators can use hypervisors to setup different resource allocations where specific VMs are configured with specific vCPU capabilities.
How Do You Calculate vCPU?
How do you calculate vCPU? How many vCPU are in a CPU? What are cores? These questions can be somewhat unclear for those unfamiliar with virtualized servers. Don’t worry. We’ll go into detail on the mathematics and you’ll have a clear idea of how to calculate the number of vCPUs that you require for your cloud servers. A lot of this will depend on your specific requirements and the manufacturer.
The Math Behind Calculating vCPU
In the past, there was a rule of thumb that there were eight vCPUs per core. Today, vCPU count is largely determined by the manufacturer. It’s calculated by taking the number of processing threads that a chipset offers per core and multiplying the number of occupied sockets. Here’s how it looks:
(Threads x Cores) x Physical CPU = Number vCPU
Example Calculation of vCPU & Cores
The best way to learn how to calculate vCPU and cores is to demonstrate through an example.
First, we need to select a virtual server and CPU. For this example, we’ll select Intel Xeon E-2288G as the underlying CPU. Key stats for the Intel Xeon E-2288G include 8 cores / 16 threads with a 3.7GHz base clock and 5.0GHz turbo boost. There is 16MB of onboard cache.
(16 Threads x 8 Cores) x 1 CPU = 128 vCPU
Determine Your Workload & 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.
A few questions to consider before you get started? Do your apps run at 100% CPU utilization all of the time? Do they have periods where utilization bursts? Do they have maintenance windows? By knowing your requirements, you can make an informed decision on the underlying hardware.
Theoretically, if you have small VMs that barely use any CPU time, you could easily get 20-30 VMs from an 8-core server. However, if you have larger workloads such as a database server, you will have far fewer VMs from that same 8 core server. It’s all about resource utilization and allocation.
Next, let’s look at some different configuration options. We are doing this just as an example and your vCPU allocation to each VM will depend on your specific workload.
4 vCPUs per VM
128 vCPUs/4 vCPUs per VM = 32 VMs
2 vCPUs per VM
128 vCPUs/2 vCPUs per VM = 64 VMs
1 vCPUs per VM
128 vCPUs/1 vCPUs per VM = 128 VMs
CPU Exhaustion & Poor Performance
There is such as a thing as CPU exhaustion which can cause poor performance for your virtual machines. The number of virtual cores assigned to a VM is limited.
For example, Windows Server 2008 R2 limits the number of vCPUs as 4 per VM which is extended to 64 in Windows server 2012.
Need Help Selecting and Configuring Your Virtual Machines?
We hope that you enjoyed this article on what vCPUs are and how to calculate your vCPU requirements. Need help or have questions about determining your requirements? We can help you select the right servers and providers for your cloud environment.
Contact me to learn more about accessing the largest selection of cloud service providers – public and private cloud, bare-metal servers, and more.