I am attempting to confirm swap usage on an OpenVZ vps. (I have had issues with badly configured swap files before)
To do so I am slowly filling the memory using code from this question How to test swap partition.
Then while running the code, monitoring memory and swap usage using top.
Whilst running, the swap usage does not change, instead the usage of the memeater code approaches real memory limits then stops.
Is this normal behaviour for the swap file in an OpenVZ setup?
Other useful info- - - -
swappiness = 60
# uname -a
Linux vps.server.com 5.4.0 #1 SMP Mon Mar 16 15:39:59 MSK 2020 x86_64 x86_64 x86_64 GNU/Linux
# cat /proc/user_beancounters
Version: 2.5
uid resource held maxheld barrier limit failcnt
21423: kmemsize 48521216 101617664 9223372036854775807 9223372036854775807 0
lockedpages 93 149 9223372036854775807 9223372036854775807 0
privvmpages 175203 477143 9223372036854775807 9223372036854775807 0
shmpages 366 368 9223372036854775807 9223372036854775807 0
dummy 0 0 9223372036854775807 9223372036854775807 0
numproc 71 71 4194304 4194304 0
physpages 133247 262148 262144 262144 381
vmguarpages 0 0 9223372036854775807 9223372036854775807 0
oomguarpages 139011 276392 0 0 14
numtcpsock 0 0 9223372036854775807 9223372036854775807 0
numflock 6 104 9223372036854775807 9223372036854775807 0
numpty 1 4 9223372036854775807 9223372036854775807 0
numsiginfo 0 87 9223372036854775807 9223372036854775807 0
tcpsndbuf 0 0 9223372036854775807 9223372036854775807 0
tcprcvbuf 0 0 9223372036854775807 9223372036854775807 0
othersockbuf 0 0 9223372036854775807 9223372036854775807 0
dgramrcvbuf 0 0 9223372036854775807 9223372036854775807 0
numothersock 0 0 9223372036854775807 9223372036854775807 0
dcachesize 20279296 24981504 9223372036854775807 9223372036854775807 0
numfile 860 5590 9223372036854775807 9223372036854775807 0
dummy 0 0 9223372036854775807 9223372036854775807 0
dummy 0 0 9223372036854775807 9223372036854775807 0
dummy 0 0 9223372036854775807 9223372036854775807 0
numiptent 44 44 9223372036854775807 9223372036854775807 0
uname -a
in your VPS? Also, the output ofcat /proc/user_beancounters
could be useful. In the current version of OpenVZ, it is stated that if there is available memory on the host then swap within the VPS is not used (from the wiki).free
command is showing swap space, then your VPS should be able to use it. If you do not have access to the host, you may not be able to see swap space usage within your VPS unless the host is also out of memory. It is also possible for the host to configure your total available memory as RAM + swap space, or misconfigure your VPS so that it cannot make use of the swap space that is configured.