Configuring memory policy for the storage services

You can configure memory limits and guarantees for the storage services at runtime by using the vinfra memory-policy vstorage-services commands. You can do this for the entire cluster or a specific node.

The following memory parameters can be configured manually:

  • Memory guarantee
  • Swap size
  • Page cache (which, in turn, is set using cache ratio, minimum, and maximum)

Page cache is calculated according to the following formula:

$PAGE_CACHE = minimum <= ratio * $TOTAL_MEMORY <= maximum

The minimum and maximum values are hard limits that are applied if the ratio * $TOTAL_MEMORY value is outside these limits.

To better understand how page cache size is calculated, consider the following examples:

Page cache examples

Example 1

(cache size is within limits)

Example 2

(cache size equals minimum)

Example 3

(cache size equals maximum)

Total memory 4 GiB 4 GiB 4 GiB
Cache ratio 0.5 0.1 0.9
Cache minimum 1 GiB 2 GiB 1 GiB
Cache maximum 3 GiB 3 GiB 3 GiB
Cache size 2 GiB 2 GiB 3 GiB

If memory parameters are set both per node and per cluster, the per-node ones are applied. If no memory parameters are configured manually, the memory management is performed automatically by the vcmmd daemon as follows:

  • Each CS (for example, storage disk) requires 512 MiB of RAM for page cache.
  • The page cache minimum is 1 GiB.
  • If the total memory is less than 48 GiB, the page cache maximum is calculated as two-thirds of it.
  • If the total memory is greater than 48 GiB, the page cache maximum is 32 GiB.

To check the current memory parameters for the storage services set by vcmmd, run:

# vcmmdctl list
name                                 type active guarantee    limit swap   cache
vstorage.slice/… SRVC    yes   1310720 24522132    0 1048576