When Is a CPU Not a CPU Be Wary of Some Hosting Providers You May Not Be Getting What You Paid For

  • Twitter
  • LinkedIn

When Is a CPU Not a CPU Be Wary of Some Hosting Providers You May Not Be Getting What You Paid For

The other day one of my bosses asked me the question, What is a CPU on a Virtual Machine ? I inherently knew the answer, but putting that knowledge into non technical English turned out to be harder than I thought. As a result of the ensuing conversations, I thought I d do a little write-up

The root of the question came from a situation where a client had requested a bump in CPU resources for one of their virtual machines. Correction, the client had actually asked for another CPU. The language is important and speaks to the root of the question. The client then looked at their laptop as a basis for evaluating that additional CPU. What they had on their laptop was a dual-core CPU running in Hyper-threaded mode. So even though the client had only one CPU , they were seeing 4 panes for activity tracking in Windows Performance Monitor. Now, in my mind, that laptop has 4 CPUs. In the client s mind, that laptop had only one CPU. So where does the difference in opinion come from?

History

One CPU Per PC

Let s start off with some basic computer architecture. We ll also need a bit of history. To begin with CPU stands for Central Processing Unit . Historically, a computer had one, and only one CPU, hence the term Central . What the heck is a Central Processing Unit you ask? Good question. What that means is that the CPU is a pipeline for processing instructions. Code gets compiled down to machine executable instructions. These instructions are fed into the CPU. The CPU then executes those instructions more or less in a sequential manner. Trivia: The first PC was the Simon, developed by Edmund Berkely in before 1950. It was a 2 bit processor that could do 4 operations.

**Figure 1 Picture of First Personal Computer (The Simon, by Edmund Berkely). Image courtesy of history-computer.com
**

In Personal Computers, the CPU is (was) typically built on a single silicon based chip, called a Microprocessor Chip. So from a high level, historical view the CPU has become synonymous for that little square chip made by AMD or Intel. Going forward, I ll refer to these silicon based units of processing power as processors, or just chips.

**Figure 2 Image courtesy of www.maximintegrated.com
**

Symmetric Multiprocessing

In the early 60 s, some smart folks decided to put two processors into a single computer to boost processing power, and the world of Symmetric Multiprocessing (SMP) and Parallel Computing was born. With SMP we now have the possibility to have two or more single pipelines of processing power. These pipelines of processing power have come to be called threads (or that is one generic name that can be applied anyway). So for a system implementing SMP, we can now have multi-threaded applications. Our PC can now have X number of CPUs, each contained on a single processor chip. At this point in time we still have a 1-1 relationship between processor chips, and the number of CPUs that the OS sees. Things are still simple.

**Figure 3 Image courtesy of www.nwfusion.com
**

Multicore Processing

In 2001 IBM came out with the first dual-core processor. What this means is that even though we have a single silicon based chip, that chip actually has 2 self-contained CPUs. So we have 2 distinct units of instruction processing capabilities on a single chip cast from a single die. This is where things start to break down for the lay person. We no longer have a direct 1-1 relationship between the number of CPUs the Operating System (OS) sees and what the consumer can see with their eyeballs (and wallet). The non-technical consumer sees a single chip, and because of historical association, that single chip, to them, signifies a single CPU. Such is not the case. Here is a great write-up on the difference between single-core and multi-core processors. It s not terribly technical.

Hyper-threading

In 2002, to compete with the multi-core chips from IBM (even though they weren t in the PC market), Intel came out with the Hyper-threading (HT) architecture. HT is sort of a hybrid between multicore and single core chip design. In HT, there are two separate threads of execution going on, but they are using the same set of silicon transistors. The HT implementation will attempt to parallelize when possible, but isn t guaranteed to do it. In many instances, this will give us some noticeable performance gains. Additionally, since each thread of instruction processing runs from the same set of transistors, there is the possibility for resource contention. There are numerous applications that recommend turning of HT due to problems that have been seen. According to this article, the metrics of HT usage may not be inherently obvious. So the use of HT technology should be approached on a case by case basis.

Tying It All Together

Now, here is where the confusion comes in. In a PC with a HT based Intel chip, the Windows OS will actually show the user that they have two processors. This is because in Windows Performance Monitor, it s not actually showing your CPUs, its showing threads of processing execution. Some OS s aren t even built to handle Hyper-threading. These OS s would show just one CPU for each actual processor installed.

Here is a little table to show what different combinations of CPU will show up as CPU count in Windows Performance Monitor.

The Present

Virtual Computing

Virtual Computing is when an OS runs on a Virtual Machine. A virtual machine is a software based environment that can behave as a single computer, but that runs in the memory space of an actual hardware computer. The memory space is an emulator for the actual hardware that the OS would originally run on. It basically allows us to turn a single computer into many computers. So for instance, if we have a huge 32 processor server sitting down in the basement, we could start up 10 different virtual machines on it, and that single computer could host 10 different OS s. In reality, we could also have a single computer with a single CPU and start up 10 different virtual machines on it. Each OS would show as having a single CPU. We haven t just magically increased the power of our single CPU machine though. Each of these 10 different virtual machines would be dog slow, as each of them would be in severe resource contention with the other 9.

Since a virtual machine is software based, the host machine (which may or may not be hardware based) can tell the hosted VM anything it wants. The hosted VM has no access to the actual physical hardware it s being hosted on to validate anything.

Cloud Computing

Cloud Computing is relatively new on the scene. Cloud computing is where huge hosting providers will make their hardware and software infrastructure available to the public, on demand in a sort of pay-as-you-go market. There are 3 main flavors of Cloud Computing: Infrastructure as a Service (IAAS), Platform as a Service (PAAS), Software as a Service (SAAS), and different combinations of these three. For the Infrastructure as a Service flavor, these hosting providers utilize virtual computing to provision instances of OSes, usually on demand, from the hardware resources of their huge data centers. The National Institute of Standards and Technology has defined Cloud Computing as well.

In the Software as a Service area, hosting companies will control the OS for you, and just give you some application space to run your goods in. An example of this model is the way some web hosting companies like HostGator and iWeb work. You buy a web server for $10.00 a month, and they give you some space out of their huge hardware/software infrastructure.

There are a number of very unscrupulous hosting providers out there that can and do utilize virtualization to sell servers to clients. They will overload their hardware servers with VMs thereby saving hardware costs for themselves at the expense of their customers performance. I m not going to name any names. They will get a big hardware server and load it up with lots of VMs so that the end user thinks they are getting a full complement of CPUs and Memory, when in fact they are sharing their CPU/Memory resources with a host of other unlucky souls.

In the IAAS area, there are some hosting companies that are still ripping their clients off, but not as blatantly. These guys will utilize large Intel based servers that have HT enabled on their chips. They may in fact limit the number of Virtual CPUs on a single hardware box to the number of actual processor threads, but they are still stiffing their customers because with HT, you aren t getting a full CPU s worth of processing. It s shared with the other virtual CPU. Unless your hosting provider is being careful not to over allocate VMs on their physical hardware, they should probably not be using HT mode, or should at least disclose that they are running that way.

I m a huge fan of cloud computing, especially the services from Amazon. The Amazon folks are smart. When they provision a VM (this is called an EC2 Instance, which stands for Elastic Compute Cloud), they don t bill you by how many CPU s you get. They bill you by ECU, or Elastic Compute Unit. They also provision their VMs by ECU. The reason for this is so that we can avoid the entire bit of hubbub outlined above. They have a write-up of the what s and why s of ECUs if you are interested.

Wrap Up

This brings us back to the original question. What is a CPU in a VM ? From a developer and technical standpoint the answer is simple. It s a single thread of instruction processing capability. From a manager s viewpoint or an accountant s viewpoint, the question should be less about what a CPU is and more about how much bank you are getting for you CPU buck. VMWare has a really great tool that can be used to benchmark your VM. Well, it s actually used to benchmark application performance in a VM, but that s what we really care about anyway, right? It s called VMMark 2. If you are really concerned about your VM performance, check this out. If you need to know some benchmarks to compare you numbers to, the industry standard is spec.org

Related Blogs

Latest Blogs