Most people are aware CPU stands for Central Processing Unit, but not that many fully understand its function. The reason why it might be important to know what a CPU does is if your business operates in the public cloud, where virtual CPUs (vCPUs) share the resources of a physical CPU.
In a physical environment, a Central Processing Unit is the operations center of a computer. It receives instructions from programs and applications, executes whatever parts of the instructions it can, and delegates what it can’t do to other hardware components, before sending the completed task to the memory and directing the memory what to do with the completed task.
The speed at which a CPU operates is dependent on its clock speed (how many instructions it can handle per second), its connections with the memory and other hardware components, and how many cores it has. Modern CPUs have multiple cores that allow it to perform multiple tasks simultaneously, with some cores capable of supporting multiple threads for better CPU efficiency.
CPU in the cloud is a little different
CPU in the cloud is a little different because, when you provision a Virtual Machine, the CPU capacity you provision is a share of the physical host’s CPU. If the physical host has multiple vCPUs to run, it schedules your vCPU a time slot to receive instructions, execute tasks, and communicate with other virtual components. Effectively, each vCPU is a thread of the physical host’s CPU sharing its CPU cycle.
Problems can occur, however, when businesses provision Virtual Machines with more vCPUs than they need. For example, if you—and everybody else—were to provision a vCPU with four cores when only two were necessary, the host CPU would have double the work to do scheduling and starting/stopping time slots, and communicating with each of the cores, leaving less processing time for your vCPU.
Establishing the appropriate number of vCPUs
Cloud Service Providers allow businesses to customize the number of vCPUs per Virtual Machine at the point of launch rather than accept the default. You can also disable multithreading by specifying a single thread per vCPU, which will benefit workloads such as high performance computing. Thereafter, if the Virtual Machine is incorrectly provisioned, you’ll need to shut it down and launch a new one.
The best way to ascertain whether a Virtual Machine is provisioned with the appropriate number of vCPUs for its workload is to review its performance metrics. These give you insight into factors such as:
- How much time each vCPU is working on applications.
- How much time is “stolen” by other vCPUs on the physical host.
- How much time is used by the physical host itself.
- How much time the vCPUs spend idle because they have no tasks to perform.
“CPU steal time” is the amount of time your vCPUs spend waiting for the physical host while it’s servicing another vCPU. Although each vCPU should be scheduled its fair share of the physical host’s CPU cycle, the time isn’t necessarily apportioned equally. In most cases, CPU steal time “lost” and CPU steal time “gained” will balance out, but if the percentage remains high, it can cause problems with web applications.
How much time is used by the physical host corresponds to how appropriately each Virtual Machine is provisioned. With too many over-provisioned Virtual Machines, the host CPU will not only spend more time scheduling and starting/stopping time slots, but it’ll also have more hardware and software interrupts to deal with, and there’ll be more waiting time while I/O operations complete.
Monitoring the metrics of existing vCPUs in the cloud
If your business has been launching Virtual Machines with the default vCPU allocation, or has been using an inappropriately provisioned template, you can monitor the metrics of existing vCPUs in the cloud with a cloud management platform such as CloudHealth. The advantage of using CloudHealth is that it gives you total visibility of all the business’s assets in the cloud so that none fly under the radar.
With a single pane vision of the business’s assets, you can set up reports to inform you of underperforming and overprovisioned vCPUs, and Virtual Machines that would benefit from being exchanged for a different or customized configuration. In many circumstances, it’ll be possible to both save money and improve performance from the results of a single report.
Thereafter, you can take advantage of CloudHealth’s policy driven automation capabilities to be notified each time a Virtual Machine is launched with an inaccurate number of vCPUs or suffers performance issues. This process ensures your business’s Virtual Machines are always optimized for cost and performance, and that you’re only paying for the processing power you have provisioned.
If you have any questions about how you can optimize the performance of vCPUs, don't hesitate to contact us.