User`s guide

Managing Resources 60
The union of RAM and swap space is the main computer resource determining the amount of
memory available to applications. If the total size of memory used by applications exceeds the
RAM size, the Linux kernel moves some data to swap and loads it back when the application
needs it. More frequently used data tends to stay in RAM, less frequently used data spends more
time in swap. Swap-in and swap-out activity reduces the system performance to some extent.
However, if this activity is not excessive, the performance decrease is not very noticeable. On
the other hand, the benefits of using swap space are quite big, allowing to increase the number
of Virtual Private Servers in the system by 2 times. Swap space is essential for handling system
load bursts. A system with enough swap space just slows down at high load bursts, whereas a
system without swap space reacts to high load bursts by refusing memory allocations (causing
applications to refuse to accept clients or terminate) and directly killing some applications.
Additionally, the presence of swap space helps the system better balance memory and move
data between the low memory area and the rest of the RAM.
Allocated memory is a more “virtual” system resource than the RAM or RAM plus swap space.
Applications may allocate memory but start to use it only later, and only then will the amount of
free physical memory really decrease. The sum of the sizes of memory allocated in all Virtual
Private Servers is only the estimation of how much physical memory will be used if all
applications claim the allocated memory. The memory available for allocation can be not only
used (the
Alloc util column) or promised (the Alloc commit column), but also limited
(applications will not be able to allocate more resources than is indicated in the
Alloc limit
column).
Managing VPS Resources
Configuration
Any VPS is configured by means of its own configuration file. You can manage your VPS
configurations in a number of ways:
1 Using configuration sample files shipped with OpenVZ. These files are used when a new
Virtual Private Server is being created (for details, see the
Creating and Configuring New
Virtual Private Server
section on page 31). They are stored in the same directory as VPS
configuration files (
/etc/sysconfig/vz-scripts/) and have the
ve-name.conf-sample mask. Currently, the following configuration sample files are
provided:
light – to be used for creating “light” VPSs having restrictions on the upper limit of
quality of service parameters;
vps.basic – to be used for common VPSs.
Note: Configuration sample files cannot contain spaces in their names.
Any sample configuration file may also be applied to a Virtual Private Server after it has
been created. You would do this if, for example, you want to upgrade or downgrade the
overall resources configuration of a particular VPS:
# vzctl set 101 --applyconfig light --save
This command applies all the parameters from the ve-light.conf-sample file to the
given VPS, except for the
OSTEMPLATE, VE_ROOT, and VE_PRIVATE parameters,
should they exist in the sample configuration file.