Previous page

Next page

Locate page in Contents

Print this page

Configuring the Memory Allocation Limit

When an application starts in a Container, it allocates a certain amount of memory for its needs. Usually, the allocated memory is much more than the application actually requires for its execution. This may lead to a situation when you cannot run an application in the Container even if it has enough free RAM. To deal with such situations, the VSwap memory management scheme introduces a new parameter— VM_Overcommit . Using this parameter, you can configure the amount of memory applications in a Container may allocate, irrespective of the amount of RAM and swap space assigned to the Container.

The amount of memory that can be allocated by applications of a Container is the sum of RAM and swap space set for this Container multiplied by a memory overcommit factor. In the default (basic) Container configuration file, this factor is set to 1.5. For example, if a Container is based on the default configuration file and assigned 1 GB of RAM and 512 MB, the memory allocation limit for the Container will be 2304 MB. You can configure this limit and set it, for example, to 3 GB by running this command:

# vzctl set 101 --vm_overcommit 2 --save

Saved parameters for Container 101

This command uses the factor of 2 to increase the memory allocation limit to 3 GB:

(1 GB of RAM + 512 MB of swap) * 2 = 3 GB

Now applications in Container 101 can allocate up to 3 GB of memory, if necessary.

Note: For more information on Container configuration files, see Managing Container Resources Configurations .