Article ID: 124678, created on Mar 1, 2015, last review on Mar 1, 2015

  • Applies to:
  • Operations Automation 5.5

Question

How vSwap memory management scheme configures UBC parameters in POA?

Answer

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.

Search Words

vSwap

5b048d9bddf8048a00aba7e0bdadef37 caea8340e2d186a540518d08602aa065 e12cea1d47a3125d335d68e6d4e15e07 5356b422f65bdad1c3e9edca5d74a1ae 2554725ed606193dd9bbce21365bed4e

Email subscription for changes to this article
Save as PDF