How to set memory limit for containers
Original Publishing Date:
2020-01-22
Question
How to set memory limit for containers?
For Virtuozzo (PVC\PSBM\PCS)
The new memory management model, which supersedes User beancounters is called vSwap
With VSwap, there are two required parameters: ram and swap (a.k.a. physpages and swappages). All the other beancounters become optional.
-
physpages
This parameter sets the amount of fast physical memory (RAM) available to processes inside a container, in memory pages. Currently (as of 042stab042 kernel) the user memory, the kernel memory and the page cache are accounted into physpages.
The barrier is ignored and should be set to 0, and the limit sets the limit.
-
ram
is an easy shortcut for physpages.limit, and is measured in bytes
-
swappages
This parameter sets the amount of "slower memory" (vSwap) available to processes inside a container, in memory pages.
The barrier is ignored and should be set to 0, and the limit sets the limit.
-
swap
is an easy shortcut for swappages.limit, and is measured in bytes
For example, the following command can be used to configure CT 777 with 512MB RAM and 1G swap:
# vzctl set 777 --ram 512M --swap 1G --save
Additional Information:
Memory limits in Parallels Virtuozzo Containers for Linux
For Containers for Windows
Use the vzctl set command with the --vprvmem option. For example, to configure CT 101 with 500MB of RAM, the following command should be executed:
C:\Users\Administrator>vzctl set 101 --vprvmem 500 --save
NOTE: By default, pagefile management process occurs at node level, and there is no pagefile limit for Windows containers, but it is possible to emulate existence of paging file inside a container.
Internal content