I have an OpenVZ VPS. However the shmpages
always increases to the limit in one or two days. My RAM usage is low (233M without cache). I only run nginx, php-fpm, and mariadb on the VPS. I've asked my VPS provider to increase the limit once (from 13000), but it's still a problem for me. What could be the reason and is there a possible way to fix it? The following is the output of cat /proc/user_beancounters
.
Version: 2.5
uid resource held maxheld barrier limit failcnt
39506: kmemsize 11328858 17010688 9223372036854775807 9223372036854775807 0
lockedpages 0 0 256 256 0
privvmpages 175735 226459 9223372036854775807 9223372036854775807 0
shmpages 19985 20000 20000 20000 1752
dummy 0 0 9223372036854775807 9223372036854775807 0
numproc 44 126 250 250 0
physpages 78891 101586 361984 361984 0
vmguarpages 0 0 260144 9223372036854775807 0
oomguarpages 37212 44403 260144 9223372036854775807 0
numtcpsock 8 31 800 800 0
numflock 5 28 600 800 0
numpty 1 1 47 47 0
numsiginfo 0 78 256 256 0
tcpsndbuf 139520 721088 9223372036854775807 9223372036854775807 0
tcprcvbuf 131072 4063928 9223372036854775807 9223372036854775807 0
othersockbuf 57800 325704 9223372036854775807 9223372036854775807 0
dgramrcvbuf 0 9248 575488 575488 0
numothersock 109 135 900 900 0
dcachesize 3614571 4086400 4086400 4086400 0
numfile 641 1275 9600 9600 0
dummy 0 0 9223372036854775807 9223372036854775807 0
dummy 0 0 9223372036854775807 9223372036854775807 0
dummy 0 0 9223372036854775807 9223372036854775807 0
numiptent 24 24 450 450 0
EDIT:
df -T
output:
Filesystem Type 1K-blocks Used Available Use% Mounted on
devtmpfs devtmpfs 723968 0 723968 0% /dev
tmpfs tmpfs 723968 0 723968 0% /dev/shm
tmpfs tmpfs 723968 13096 710872 2% /run
tmpfs tmpfs 723968 0 723968 0% /sys/fs/cgroup
Best Answer
A good provider should not be setting the limit for shmpages as low as 20000. Shmpages only affects the resource shortage reaction of applications in your container; it has zero effect on the stability or security of the node itself.
All of my OpenVZ VPS's (from BuyVM) have the shmpages limit set to 9223372036854775807 (basically, unlimited). It's obvious that you are not running out of memory -- your physpages limit is 361984, and the highest amount of memory you've used is less than one-third of that (101586). Same goes with oomguarpages -- your limit is 260144 pages but the maximum memory you have used is 44403 pages, only 17% of what is available to you.
Ask you provider to increase your shmpages limit and barrier to something more sane. If they refuse, I would advise looking elsewhere for your VPS needs. Their limit of 20000 is ridiculous.