High memory usage can be observed inside of a container, however there are no processes that are consuming this amount of memory:
[root@container ~]# free -m total used free shared buffers cached Mem: 4096 4088 7 0 0 110 -/+ buffers/cache: 3977 118 Swap: 0 0 0
Container is stable, processes are not generating "Out of Memory" events.
/proc/user_beancounters inside of container shows that container is using high amount of dcachesize resource:
[root@container ~]# egrep 'dcachesize|resource' /proc/user_beancounters uid resource held maxheld barrier limit failcnt dcachesize 3987513652 3987653040 9223372036854775807 9223372036854775807 0
/proc/meminfo shows that most of consumed memory is accounted under
[root@container ~]# cat /proc/meminfo | egrep 'MemTotal|MemFree|Slab|SReclaimable' MemTotal: 4194304 kB MemFree: 7824 kB Slab: 3907088 kB SReclaimable: 3894060 kB
Memory accounted in
Slab and in
SReclaimable is considered as cached, and it will be freed upon request. Big amount of cache in slabs is generated by nginx web server running inside of a container.
This memoery is reclaimable, thus there is nothing to worry about, it will be freed upon request and it will not cause stability issues for the container. It can be considered a cosmetic issue caused by nginx.
If it is necessary to avoid this behavior, it is possible to limit
dcachesize to a smaller amount, e.g. 256 Mb, using following command:
# vzctl set <CTID> --dcachesize 268435456:295279001 --save
Note!: If container's memory management schema is
SLM you won't be able to control
dcachesize parameter. Set it to
all to control
# vzctl set <CTID> --save --slmmode ubc
Container must be restarted after changing memory management scheme.
You may learn more about
dcachesize and other UBC resources in the following KB article: