Question

How vSwap memory management scheme configures UBC parameters in POA?

Answer

Note: not UBC limits for existing VEs are changed during the OA upgrades. The changes are only applied to new VE provisioning.

OA 6.0

The limits are set in accordance with the service template configuration for each particular UBC limit and can be changed for each VE from Provider's CP. RAM and SWAP limits define the explicit values for RAM and SWAP in containers.

The default UBC limits in service templates are configured according to the limits template defined in class_resources table, and this is an advised configuration:

plesk=> select * from class_resources;
class_id  |   resource   | res_description | min_value | max_value  |  soft   |    hard
----------+--------------+-----------------+-----------+------------+---------+------------
    2     | avnumproc    | avnumproc       |         0 | 2147483647 |      40 |         40
    1     | avnumproc    | avnumproc       |         0 | 2147483647 |      15 |         15
    2     | numproc      | numproc         |         0 | 2147483647 |      65 |         65
    1     | numproc      | numproc         |        50 |         50 |      40 |         40
    2     | numtcpsock   | numtcpsock      |         0 | 2147483647 |      80 |         80
    1     | numtcpsock   | numtcpsock      |        40 |         40 |      40 |         40
    2     | numothersock | numothersock    |         0 | 2147483647 |      80 |         80
    1     | numothersock | numothersock    |        40 |         40 |      40 |         40
    2     | vmguarpages  | vmguarpages     |         0 | 2147483647 |    6144 | 2147483647
    1     | vmguarpages  | vmguarpages     |         0 | 2147483647 |    1725 | 2147483647
    2     | kmemsize     | kmemsize        |         0 | 2147483647 | 2457600 |    2621440
    1     | kmemsize     | kmemsize        |         0 | 2147483647 |  870400 |     923648

Here class_id 1 stands for VZ Linux and class_id 2 is for VZ Windows.

This table contains the default UBC configuration for a VE with 512 MB RAM. In case of more RAM assigned to a VE, it is advised that the limits are adjusted proportionally.

OA 5.5

vSwap limits the maximum amount of allocated memory by specifying the amount of physical memory and virtual swap space that can be used by a Container.

In VPS some UBC (User Beancounters) are necessary and the advantage of VSwap (vSwap model uses UBC parameters only) is, vSwap schema allows one to quickly configure a container's RAM and swap limits and set up memory overcommitment, while other parameters are calculated by Parallels Virtuozzo Containers for Linux on the fly. The UBC parameters in vSwap model is predefined as per the value specified for RAM and SWAP.

In POA, when you switch the VPS to the 'Combined SLM + UBC' memory management mode, "VPS RAM upper limit in MB" and "VPS SWAP upper limit in MB" resources are used as main vSwap parameters (RAM and swap) which overrides QoS values of RT/ST. This is the default behavior.

For example: The UBC parameters are calculated in the following way:

plesk=> SELECT vrc.def_id, sr.rt_instance_id, sr.sub_limit, rt.class_id, rt.restype_name, cfg.slm_mode, rc.name FROM ves v, vz_ve_configs cfg, vps_rc_definition vrc, subs_resources sr, resource_types rt, hosts h, resource_classes rc WHERE v.ve_host_id = 4093 AND cfg.cfg_id = v.cfg_id AND vrc.vz_ver_id = cfg.vz_ver_id AND sr.sub_id = h.subscription_id AND sr.rt_id = rt.rt_id AND rt.class_id = vrc.rc_class_id AND h.host_id = v.ve_host_id AND rc.class_id = rt.class_id ORDER BY sr.rt_instance_id;
 def_id | rt_instance_id | sub_limit | class_id |        restype_name        | slm_mode |       name
--------+----------------+-----------+----------+----------------------------+----------+-------------------
     12 |         757708 |       512 |      153 | VPS RAM upper limit in MB  | b        | rc.vps.ram.limit
     11 |         757709 |  20971520 |        5 | VPS-Diskspace              | b        | disc_space
     22 |         757710 |       512 |      202 | VPS SWAP upper limit in MB | b        | rc.vps.swap.limit
     20 |         757713 |         0 |      204 | VPS CPU units              | b        | rc.vps.cpu.units
     17 |         757714 |      2402 |      152 | VPS CPU upper limit in MHz | b        | rc.vps.cpu.limit
     21 |         757721 |         0 |      201 | VPS IOPS limit             | b        | rc.vps.iops.limit
(6 rows)

Here we have 4093 - VPS id, then on VPS RAM upper limit in MB is taken def_id = 12

plesk=> select * from vps_rc_limit_values where def_id = 12;
 def_id | value | ext_value | preset_id |   descr
--------+-------+-----------+-----------+-----------
     12 |  2048 |      1024 |        22 | 1024/2048
     12 |    -3 |        -3 |        25 | Unlimited
     12 |    -2 |        -2 |        26 | -2/-2
(3 rows)

Hence chosen guaranteed amount of memory for the UBC in the resource was 512 MB, so preset_id = 26, further parameters:

plesk=> SELECT vp.qos_id, vp.qos_soft_formula, vp.qos_hard_formula, q.name FROM vps_rc_preset_content vp, vz_ve_qos_dspts q WHERE vp.qos_id = q.qos_id AND vp.preset_id = 26;
 qos_id |   qos_soft_formula    |       qos_hard_formula       |     name
--------+-----------------------+------------------------------+--------------
    125 | 0.70313*${limit}      | 0.70313*${limit}             | avnumproc
    128 | 13320*${limit}        | 14160*${limit}               | dcachesize
    129 | 1024*${limit}         | 1024*${limit}                | dgramrcvbuf
    132 | 43187.19922*${limit}  | 44441.59896*${limit}+0.66667 | kmemsize
    133 | ${limit}              | ${limit}                     | lockedpages
    134 | 36.375*${limit}       | 36.375*${limit}              | numfile
    135 | 0.73438*${limit}      | 0.80469*${limit}             | numflock
    136 | 0.5*${limit}          | 0.5*${limit}                 | numiptent
    137 | 1.40625*${limit}      | 1.40625*${limit}             | numothersock
    138 | 0.9375*${limit}       | 0.9375*${limit}              | numproc
    139 | 0.0625*${limit}       | 0.0625*${limit}              | numpty
    140 | ${min(limit, '1024')} | ${min(limit, '1024')}        | numsiginfo
    141 | 1.40625*${limit}      | 1.40625*${limit}             | numtcpsock
    142 | 102*${limit}          | 2147483647                   | oomguarpages
    143 | 4398.75*${limit}      | 8192*${limit}                | othersockbuf
    144 | 0                     | 2147483647                   | physpages
    145 | 256*${limit}          | 272*${limit}                 | privvmpages
    148 | 84*${limit}           | 84*${limit}                  | shmpages
    150 | 6720*${limit}         | 10560*${limit}               | tcprcvbuf
    151 | 6720*${limit}         | 10560*${limit}               | tcpsndbuf
    152 | 264*${guaranteed}     | 2147483647                   | vmguarpages
(21 rows)

And the parameters are calculated as above formula. e.g avnumproc = 0.70313*${limit} = 0.70313*512 = 360

Similar for VPS SWAP upper limit in MB:

plesk=> select * from vps_rc_limit_values where def_id = 22;
 def_id | value | ext_value | preset_id | descr
--------+-------+-----------+-----------+-------
     22 |    -1 |           |        37 |
(1 row)

plesk=> SELECT vp.qos_id, vp.qos_soft_formula, vp.qos_hard_formula, q.name FROM vps_rc_preset_content vp, vz_ve_qos_dspts q WHERE vp.qos_id = q.qos_id AND vp.preset_id = 37;
 qos_id | qos_soft_formula | qos_hard_formula |   name
--------+------------------+------------------+-----------
    161 | ${limit}         | ${limit}         | swappages
(1 row)

And the parameter swappages is calculated as ${limit} = 512 MB = 524288 KB = 131072 (4KB)

By default when we create any VPS on PCS or Virtuozzo Node, the default values for other UBC parameters are unlimited.

Internal content