Container shows high memory usage even though processes are not consuming it

Refers to:

  • Plesk 12.5 for Linux
  • Plesk 11.5 for Linux

Created:

2016-11-16 13:26:06 UTC

Modified:

2017-01-04 15:39:59 UTC

1

Was this article helpful?


Have more questions?

Submit a request

Container shows high memory usage even though processes are not consuming it

Symptom

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.

Checking /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 Slab and SReclaimable :

[root@container ~]# cat /proc/meminfo | egrep 'MemTotal|MemFree|Slab|SReclaimable'
MemTotal: 4194304 kB
MemFree: 7824 kB
Slab: 3907088 kB
SReclaimable: 3894060 kB

Cause

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.

Resolution

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 ubc or all to control dcachesize consumption.

# 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:

112807 - UBC resources in Parallels Virtuozzo Containers for Linux

Have more questions? Submit a request
Please sign in to leave a comment.