Search This Blog

Wednesday, September 28, 2011

Using vSphere Hot-Add to Dynamically Add CPU and RAM

Overview

There might be instances when an application running on a virtual machine starts consuming a lot of resources and, as a result, the VM starts running out of RAM and CPU. If the application is mission critical and has to be highly available, you can’t just shut it down to add more RAM and CPU. These are the kind of instances when a Hot-Add and Hot-Plug feature can come in handy.

A Hot-Add will allow you to improve the performance of a VM by enabling you to add RAM dynamically without requiring the virtual machine or the application to be shut down. The same holds true for a Hot-Plug, except that it technically refers to the adding of a CPU. In some texts, the terms Hot-Add and Hot-Plug are used interchangeably.

In this post, we’ll take a look at the basic concepts relevant to Hot-Adds and Hot-Plugs. We’ll then proceed to show you how to dynamically add CPU and RAM using vSphere’s Hot-Add/Hot-Plug feature.

What you need to know about adding, modifying and removing virtual hardware

In most cases, only very few types of hardware can be added “hot”, i.e., while the VM is running. For all other types of virtual hardware, the VM has to be powered off before they can be added or removed. In addition, your operating system and applications have to be configured to recognize the virtual hardware you want to add.

Let me show you a running virtual machine that hasn’t been enabled yet with Hot-Add/Hot-Plug features.

To view a virtual machine’s hardware properties, go to your vSphere client, select a virtual machine (for this example, we selected vMA), click Edit Settings under the Summary tab and when the Virtual Machine Properties window appears, go to the Hardware tab.

vsphere edit settings vm

Click on Memory and see if the Memory Configuration section is grayed out just like the one below.

Just to remind you, we’re assuming your VM is running while you’re doing this.

virtual machine memory configuration

If it is grayed, that means we can’t modify the amount of RAM. This is what you’ll see if your VM doesn’t have Hot-Add/Hot-Plug capabilities.

Now, click on CPUs to see if you can modify the number of virtual processors. If the area on the right is grayed out just like the Memory Configuration, again, that’s because you don’t have Hot-Add/Hot-Plug capabilities.

add virtual cpu grayed

Try clicking the Add button. That’s the button you’re supposed to click if you want to add a device to this virtual machine. Consistent with what we mentioned earlier, you’ll notice that a lot of the devices there are labeled (unavailable). Only Hard Disk and SCSI Device, can be added.

add hardware to vm

You’ll also notice that when you go back to the previous window and click all the devices found there, most of the devices cannot be removed. That is the Remove button is mostly grayed out. In our case, the only time it wasn’t grayed was when we selected the Hard Disk.

As you can see, you really have very limited options when it comes to adding, modifying, and removing hardware on a running virtual machine without the Hot-Add/Hot-Plug features.

Obstacles you may encounter when using vSphere Hot-Add/Hot-Plug

Before we proceed to show you how to use Hot-Add/Hot Plug, let’s first talk about some of the obstacles/limitations you may encounter when using these features.

Note that, while vSphere supports Hot-Add and thus allows you to add RAM dynamically, it does not support hot-remove RAM. More importantly, support for these “hot” features are largely dependent on your guest OS; not on vSphere.

Here’s a table from Jason Boche of blog.boche.net showing which Windows Server editions, when running as guest operating systems, support specific Hot-Add/Remove and Hot-Plug/Remove features:

windows servers supporting hot add hot plug

In addition to those operating systems, you might like to know that the following OSes support hot plug (CPU) without requiring a reboot:

● Windows 7 Enterprise and Ultimate 64-bit
● Windows Server 2008 64-bit Datacenter

Sad to say, both Hot-Add and Hot-Plug are NOT turned on by default on a virtual machine. Also, to activate these features, the virtual machine has to be powered off. This can be quite a hassle because, normally, you only realize that you need more CPU or RAM when everything is already running.

Therefore, if you think there is the slightest possibility that a VM will be needing more system resources during operation, e.g. if it is a mission critical VM, don’t forget to activate Hot-Add and Hot-Plug beforehand.

Finally, note that Hot-Add/Hot-Plug are not compatible with VMware Fault Tolerance. So if you’re already using VMware FT on a VM, then don’t activate Hot-Add/Hot-Plug there.

Now that you know what Hot-Add and Hot-Plug are, it’s time to show you how to put them into action.

Enabling Hot-Add and Hot-Plug

To enable these features, go to your vSphere Client and power off the VM you want to activate Hot-Plug/Hot-Add on. Make sure the guest OS on that VM supports Hot-Plug/Hot-Add (refer to the table shown earlier) before proceeding. If the guest OS supports it, then select the powered-off VM and, in the Summary tab, click Edit Settings.

edit settings of vm in vsphere

In the Virtual Machine Properties window, go to the Options tab, and select Memory/CPU Hotplug. Next, go to the Memory Hot Add section and select the “Enable memory...” option. In the same manner, go to the CPU Hot Plug section and select the “Enable CPU...” option. Then click OK.

enable hot plug hot add

At this point, you may now power on the VM. If you want to see how your CPU and memory resources look like from inside the guest OS itself before and after Hot-Add/Hot-Plug are put into action, open the console for that VM and log into the guest OS.

Once you’ve logged in, go to the Windows orb, right-click on Computer, and click Properties.

computer properties

There you’ll see your currently installed RAM. For example, we currently have only 1 GB of RAM.

RAM before hot add

To view the current number of CPUs, go to the panel on the left side of that screen and click the Device Manager. Inside the Device Manager, expand the Processors item to see the number of processors. In our example, we have only one processor.

CPU before hot plug

Later, if you want to verify whether Hot-Add/Hot-Plug really changed the amount of RAM and the number of CPUs, you already know where to look.

Let’s now add more RAM and CPU to your system.

How to Hot-Add RAM and Hot-Plug CPU to a Running VM

Go back to your vSphere Client and select the VM in question. Again, go to the Summary tab and click Edit Settings as shown earlier. Once you’re back inside that virtual machine’sProperties window, go to the Hardware tab and select Memory.

You’ll now see that the Memory Configuration section is no longer grayed and that you can already change the memory size. Go ahead and do so. Remember you’re doing this while the VM is running.

changing memory dynamically using hot add

After adding more RAM (e.g. we changed ours from 1 GB to 3 GB), you may also add more CPUs. Just click CPUs from the list of Hardware. Add CPUs by selecting a number from the drop-down list at the right (e.g. we changed ours from 1 CPU to 3 CPUs)

Changing CPUs dynamically using hot plug

Click OK to proceed.

You can easily see the results of the Hot-Add/Hot-Plug operation on the virtual machine’sSummary tab.

Results of hot add hot plug from summary page

If you’re not contented with that and want to see the results of this operation from right inside the guest OS, go back to that virtual machine’s console and into the guest OS. If you navigate back to the places we showed you earlier, you will now see that the changes have in fact taken place.

Here’s are the newly reinforced CPUs:

Hot plugged CPUs

And here’s the newly beefed up RAM:

Hot added ram

Summary

This shows that we’ve succeeded in adding CPUs and RAM on a running virtual machine by using Hot-Plug and Hot-Add.

1 comment:

Unknown said...

Link:
http://www.petri.co.il/vsphere-hot-add-memory-and-cpu.htm?utm_source=petri&utm_medium=email&utm_campaign=newsletter