Книга: Mastering VMware® Infrastructure3

Allocating Virtual Machine Memory

One of the most significant advantages of server virtualization is the ability to allocate resources to a virtual machine based on the machine's actual performance needs. In the traditional physical server environment, a server is often provided with more resources than it really needs because it was purchased with a specific budget in mind and the server specifications were maximized for the budget provided. For example, does a DHCP server really need dual processors, 4GB of RAM, and 146GB mirrored hard drives? In most situations, the DHCP server will most certainly under-utilize those resources. In the virtual world, we can create a virtual machine better suited for the DHCP services provided by the virtual machine. For this DHCP server, then, we would assemble a virtual machine with a more suitable 1GB of RAM, access to a single CPU, and 20GB of disk space, all of which are provided by the ESX host that the virtual machine is running on. Then, we can create additional virtual machines with the resources they need to operate effectively without wasting valuable memory, CPU cycles, and disk storage. As we add more virtual machines, each machine places additional demand on the ESX Server, and the host's resources are consumed to support the virtual machines. At a certain point, either the host will run out of resources or we will need to find an alternate way to share access to a limited resource.

The Game Plan for Growth

One of the most challenging aspects of managing a virtual infrastructure is managing growth without jeopardizing performance and without overestimating. From small business to large enterprise, it is critical to establish a plan for managing virtual machine and ESX Server growth.

The easiest approach is to construct a resource consumption document that details the following:

? What is the standard configuration for a new virtual machine to be added to the inventory? What is the size of the operating system drive? What is the size of the data drive? How much RAM will it be allocated?

? What are the decision points for creating a virtual machine with specifications beyond the standard configuration?

? How much of a server's resources can be consumed before availability and performance levels are jeopardized?

? At the point where the resources for an ESX Server (or an entire cluster) are consumed, do we add a single host or multiple hosts at one time?

? What is the maximum size of a cluster for our environment? When does adding another host (or set of hosts) constitute building a new cluster?

Let's start with how memory is allocated to a virtual machine. Then, we'll discuss the mechanisms ESX will use to arbitrate access to the memory under contention and what you as administrator can do to change how virtual machines access memory. 

When you create a new virtual machine through the VI Client, the wizard will ask you how much memory the virtual machine should have, as shown in Figure 9.1.

The amount of memory you allocate on this screen is the amount the guest operating system will see — in this example, it is 1024MB. This is the same as when you build a system and put two 512MB memory sticks into the system board. If we install Windows 2003 in this virtual machine, Windows will report 1024MB of RAM installed. Ultimately this is the amount of memory the virtual machine "thinks" that it has.

Let's assume we have an ESX Server with 4GB of physical RAM available to run virtual machines (in other words, the Service Console and VMkernel are using some RAM and there's 4GB left over for the virtual machines). In the case of our new virtual machine, it will comfortably run, leaving approximately 3GB for other virtual machines (there is some additional overhead that we will discuss later, but for now let's assume that the 3GB is available to other virtual machines).

What happens when we run three more virtual machines each configured with 1GB of RAM? Each of the additional virtual machines will request 1GB of RAM from the ESX host. At this point, four virtual machines will be accessing the physical memory.

What happens when you launch a fifth virtual machine? Will it run? The short answer is yes, but the key to understanding why this is so is the mechanism that ESX Server employs — and it is based on some default settings in the virtual machines' configuration that administrators have control over.


Figure 9.1 Initial Memory settings for a virtual machine indicate the amount of RAM the virtual machine "thinks" that it has.

In the advanced settings for a virtual machine, as shown in Figure 9.2, we can see there is a setting for a reservation, a limit, and shares. In this discussion, we will examine the limit and reservation settings and then come back later to deal with the shares.


Figure 9.2 Each virtual machine can be configured with a shares value, a reservation, and a limit.

To edit the reservation, limit, or shares of a virtual machine:

1. Use the VI Client to connect to a VirtualCenter Server or directly to an ESX Server host.

2. Drill down through the inventory to find the virtual machine to be edited.

3. Right-click the virtual machine and select the Edit Settings option.

4. Click the Resources tab.

5. On the Resources tab, select the CPU or Memory options from the Settings list on the left.

6. Adjust the Shares, Reservation, and Limit values as desired.

The following sections will detail the ramifications of setting custom Reservation, Limit, and Shares values.

Оглавление книги

Оглавление статьи/книги

Генерация: 1.127. Запросов К БД/Cache: 3 / 1
поделиться
Вверх Вниз