Previous page

Next page

Locate page in Contents

Print this page

Configuring Main VSwap Parameters

Virtuozzo 6 introduces a new scheme for managing memory-related parameters in Containers—VSwap. Like many other memory management schemes used on standalone Linux computers, this scheme is based on two main parameters:

  • RAM. This parameter determines the total size of RAM that can be used by the processes of a Container.
  • swap. This parameter determines the total size of swap that can be used by a Container for swapping out memory once the RAM is exceeded.

Notes:

1. In Virtuozzo 6, the new VSwap memory management scheme has replaced the SLM scheme.

2. You can also set memory limits for and provide memory guarantees to Containers by configuring multiple UBC (User Beancounter) parameters (numproc, numtcpsock, vmguarpages, and so on). These parameters provide you with comprehensive facilities of customizing the memory resources in respect of your Containers. However, this way of managing system resources is more complex and requires more effort to be made on your part to adopt it to your system. For detailed information on UBC parameters, refer to the Administrator's Guide to Managing UBC Resources.

The new memory management scheme works as follows:

  1. You set for a Container a certain amount of RAM and swap space that can be used by the processes running in the Container.
  2. When the Container exceeds the RAM limit set for it, the swapping process starts.

    The swapping process for Containers slightly differs from that on a standalone computer. The Container swap file is virtual and, if possible, resides in the Node RAM. In other words, when the swap-out for a Container starts and the Node has enough RAM to keep the swap file, the swap file is stored in the Node RAM rather than on the hard drive.

  3. Once the Container exceeds its swap limit, the system invokes the OOM Killer for this Container.
  4. The OOM Killer chooses one or more processes running in the affected Container and forcibly kills them.

By default, any newly created Container starts using the new memory management scheme. To find out the amount of RAM and swap space set for a Container, you can check the values of the PHYSPAGES and SWAPPAGES parameters in the Container configuration file, for example:

# grep PHYSPAGES /etc/vz/conf/101.conf

PHYSPAGES="65536:65536"

# grep SWAPPAGES /etc/vz/conf/101.conf

SWAPPAGES="65536"

In this example, the value of the PHYSPAGES parameter for Container 101 is set to 65536. The PHYSPAGES parameter displays the amount of RAM in 4-KB pages, so the total amount of RAM set for Container 101 equals to 256 MB. The value of the SWAPPAGES parameter is also set to 256 MB.

To configure the amounts of RAM and swap space for Container 101, use the --memsize and --swappages options of the prlctl set command. For example, you can execute the following command to set the amount of RAM and SWAP in Container 101 to 1 GB and 512 MB, respectively:

# prlctl set 101 --memsize 1G --swappages 512M