Previous page

Next page

Locate page in Contents

Print this page

Configuring Additional Memory Parameters

Virtuozzo 6 comes with an improved memory management scheme. This scheme is driven by two parameters:

  • Reserved memory limit. The reserved memory limit defines the amount of memory on a host that can be used by all virtual machines hosted on this server.
  • Memory quota. The memory quota controls the memory consumption by a particular virtual machine. This parameter is composite and includes the guarantee, limit, priority, and ballooning settings.

The sections below describe how to configure both parameters.

Configuring the Reserved Memory Limit

The reserved memory limit defines the amount of memory that can be consumed by all virtual machines on a host. The remaining memory on the server is reserved for applications that run on the server itself.

By default, the reserved memory limit is calculated automatically and depends on the amount of memory installed on a host:

  • If the server has less than 3 GB of memory installed, this formula is used: "total RAM on the server" multiplied by 0.7. So if the server has 2 GB of memory, the reserved limit is set to 1.4 GB.
  • If the server has more than 3 GB of memory installed, this formula is used: "total RAM on the server" minus 1 GB. So if the server has 16 GB of memory, the reserved limit is set to 15 GB.

To configure the default reserved memory limit, you can use the --mem-limit option of the prlsrvctl set command. For example, the following command reserves 14 GB of memory for use by virtual machines:

# prlsrvctl set --mem-limit 14336

To revert to the default settings, use this command:

# prlsrvctl set --mem-limit auto

Set memory limit: auto

The Server has been successfully configured.

Configuring the Memory Quota

The memory quota allows you to control the memory consumption by a particular virtual machine. The quota control parameters include the following:

  • Guarantee. The amount of memory a virtual machine is guaranteed to get on demand. If the virtual machine requests more memory than is guaranteed, the memory allocation may fail (for example, if there is no free memory on the host at the moment). Moreover, if the guaranteed amount of memory of all virtual machines running on the server plus their overhead exceeds the reserved limit, you will not be able to start another virtual machine. By default, the guaranteed memory is calculated on the basis of RAM and video memory assigned to a virtual machine and is about a half of its total memory.

    Note: The overhead of a virtual machine depends on its configuration. For example, the overhead of a virtual machine that has 1024 MB of RAM, 2 CPUs, 256 MB of video memory, a network adapter, a sound card, and a USB controller and runs on modern hardware does not usually exceed 35-40 MB. To check the overhead of a running virtual machine, open the /proc/parallels/vm/VM_ID/meminfo file and look for the value of the Unreclaimable parameter. Keep in mind, however, that this value may change over time.

  • Limit. The maximum amount of memory a virtual machine is allowed to consume. The virtual machine cannot exceed this limit even if the host has a lot of free memory and the virtual machine requires this memory. By default, no limit is set for all newly created virtual machines, and any virtual machine may consume all free memory on the server.
  • Priority. The priority (from 1 to 100) that defines which virtual machine will get memory first. The higher the priority of a virtual machine, the more chances it has to get memory when the host has insufficient memory resources. By default, the priority is set to 50.
  • Ballooning. The maximum amount of memory the balloon driver in a virtual machine may allocate for its needs. Memory ballooning is a technique that allows your system to reclaim memory from virtual machines. To do this, a special balloon driver is loaded into each running virtual machine. When the system requires free memory but does not have any, it sends a command to the balloon driver in the virtual machine to increase its size. The balloon driver inflates by allocating the requested amount of memory in the virtual machine and then gives this memory to the system.

    By default, the balloon driver can allocate up to 60% of RAM set for a virtual machine. For example, if the amount of RAM for a virtual machine is set to 2 GB, the balloon driver can allocate the maximum of 1.2 GB of memory.

To configure these quota control parameters for a specific virtual machine, you can use the --memquota parameter of the prlctl set command. For example, the following command sets for the MyVM virtual machine the memory guarantee to 512 MB, the limit to 2 GB, the priority to 70, and the ballooning limit to 50% of RAM:

# prlctl set MyVM --memquota 512:2048:70:50

To check that all parameters have been successfully set, use this command:

# prlctl list -i MyVM | grep memory_quota

memory_quota min=512Mb max=2048Mb priority=70 maxballoon=50%

To revert to the default settings, run this command:

# prlctl set MyVM --memquota auto

Possible Usage Scenarios

Below you can find three examples that demonstrate how the new management scheme can help service providers optimize their business.

Payable RAM

You have a number of non-priority customers whose virtual machines use only a fraction of the RAM assigned to them. The virtual machines are stored on different physical servers. To optimize resource usage, you decide to migrate all underutilized virtual machines to one server. You then set (a) the guarantee for the migrated virtual machines to the minimum values recommended for the operating systems running in these virtual machines plus the virtual machine overhead and (b) the memory limit to their RAM values. In this scenario:

  • You host a large number of virtual machines on a single physical server.
  • You ensure that all virtual machines can get enough memory for non-intensive operations, but do not guarantee the optimal performance of memory-intensive operations (the limit is equal to the RAM).
  • You charge customers for the amount of RAM assigned to their virtual machines.

"What you pay is what you get" (payable guarantee and limit)

You have a number of customers whose virtual machines require a certain amount of memory all the time. For these customers, you configure their virtual machines by setting the memory guarantee to the requested amount plus virtual machine overhead. You also set the memory limit equal to the guarantee. In this scenario:

  • You charge customers for the set memory guarantee.
  • Customers can get only the memory they pay for (the guarantee is equal to the limit).
  • You ensure that every virtual machine can get the required amount of memory defined by its guarantee.
  • No virtual machine can affect the performance of the host and other virtual machines on this host. To meet this requirement, you need to make sure that all virtual machines on the host are configured for use in the "What you pay is what you get" scenario.

"Burstable memory" (payable guarantee)

You have a number of customers whose virtual machines consume small amounts of memory most of the time. Sometimes, memory-intensive operations may also run in the virtual machines. For these virtual machines, you set the memory guarantee to the values that are high enough to run non-intensive memory operations and the memory limit to "unlimited". In this scenario:

  • You charge customers for the set memory guarantee.
  • You ensure that all virtual machines can get enough memory for non-intensive operations, and such operations are running in the affected virtual machines most of the time.
  • When virtual machines require more memory than is defined by their guarantee, they get free memory available on the host (the limit is set to "unlimited"). If the host does not have enough memory, the virtual machines start competing for free memory.