OpenVZ Forum

Home » General » Discussions » How to clear cache memory on openvz container ? (How to clear cache memory on openvz container ?)
How to clear cache memory on openvz container ? [message #53229] Thu, 05 April 2018 17:26 Go to next message
chaitanya is currently offline  chaitanya
Messages: 1
Registered: April 2018
Location: India
Junior Member
From: 113.30.243*
We have OpenVZ container.
We are unable to clear cache memory on container.
Below are the outputs of respective commands

Scenario : High memory is consumed by buff/cache so that free memory becomes 0 and it affects applications to get freeze . Our single container contains cassandra(16GB) , elasticsearch(24GB) , apache and activemq(8GB).

I have 2 questions :
1) How to clear cache memory on openvz container ?
2) How to restrict buff/cache memory from consuming high memory on openvz container.
3) How to protect free memory on container to go down to 0 ?

root@unmanaged:~# free -m
total used free shared buff/cache available
Mem: 65536 **** 0 ***** 35164 *****
Swap: 0 0 0
root@unmanaged:~# sync; echo 3 > /proc/sys/vm/drop_caches && sync; echo 2 > /proc/sys/vm/drop_caches && sync; echo 1 > /proc/sys/vm/drop_caches
-su: /proc/sys/vm/drop_caches: Permission denied
-su: /proc/sys/vm/drop_caches: Permission denied
-su: /proc/sys/vm/drop_caches: Permission denied
root@unmanaged:~# uname -r
root@unmanaged:~# systemd-detect-virt

Please provide us the solution ASAP.
Re: How to clear cache memory on openvz container ? [message #53260 is a reply to message #53229] Mon, 30 July 2018 16:16 Go to previous message
paulocoghi is currently offline  paulocoghi
Messages: 13
Registered: July 2018
Junior Member
From: *
Every configuration related to virtual memory, including the one that lives under "/proc/sys/vm", can only be modified by the host as it is a kernel configuration, and all OpenVZ containers share the host's kernel and its configuration.

For example, as you use ElasticSearch, it recommend that your "vm.max_map_count" is set to 262144 instead of the default 65530. To do it, you need to change it on the host system, and it will be immediately available to all OpenVZ containers (without rebooting the host), including the one with ES installed.

It is important to note that cached memory is free to be used by programs when/if needed, as explained here. And if you are still facing memory consumption issues, it is very likely that you need to allocate more memory for your container.

To finalize, since this is a forum made and maintained by volunteers, it is not wise to ask for support "ASAP", since this may even discourage someone from helping you. If you have production environments that demands fast support, I really recommend you to subscribe for a paid license of OpenVZ, called Virtuzzo, that includes support by default and you will get almost-instant responses to issues, like this one.

I have subscribed to Virtuozzo and it was one of the best choices that I've made after using open source version of OpenVZ for many years. I certainly do not regret it and will not go back.
Previous Topic: Is OVZ 7 ready?
Next Topic: Introduction to TIBCO Spotfire Statistical Engines
Goto Forum:

Current Time: Tue Aug 14 23:49:47 GMT 2018