Configuring Additional Memory Parameters
Parallels Server Bare Metal 5.0 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 Parallels server 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 Parallels server. 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 Parallels server:
-
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
Set memory limit: 14336Mb
The Server has been successfully configured.
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 Parallels server 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 Parallels server 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 Parallels server 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
pctl 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:
# pctl set MyVM --memquota 512:2048:70:50
Disable the memquota auto calculation.
Set the memquota_min parameter to 512Mb.
Set the memquota_max parameter to 1024Mb.
Set the memquota_prio parameter to 70.
Set the memquota_maxballoon parameter to 50.
The VM has been successfully configured.
To check that all parameters have been successfully set, use this command:
# pctl 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:
# pctl set MyVM --memquota auto
Enable the memquota auto calculation.
The VM has been successfully configured.
Possible Usage Scenarios
Below you can find three examples that demonstrate how the new management scheme can help service providers optimize their business.
"Ghetto" (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 the resources usage, you decide to migrate all underutilized virtual machines to one "Ghetto" server. You then set (a) the guarantee for the migrated virtual machines to the minimum values recommended for the operating systems running in these VMs plus the VM overhead and (b) the memory limit to their RAM values. In this scenario:
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 the VM overhead. You also set the memory limit equal to the guarantee. In this scenario:
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.
|