How to clear cache in OpenVZ?

I have OpenVZ VPS and I have a problem with clearing the cache: enter image description here

OpenVZ does not work echo 3 > /proc/sys/vm/drop_caches enter image description here

How can this cache be transparent?

+5
source share
4 answers

As a result, to clear the cache β†’, you must restart VPS.

+1
source

OpenVZ does not support cash cleanup.

0
source

This was reported in the OpenVZ bug tracker. It was resolved as RESOLVED WONTFIX

From Kir Kolyshkin to the bug report (project leader OpenVZ):

All containers use the same page cache (although there is an account in each container), therefore, to reset the caches of one container, we must check each page:

1 If it belongs to the container or not - suppose that we have this information, which I am not sure

2 Whether this page is used by other containers.

So, although this is trivial for the host system, for the container it is much less trivial. And this is not critical functionality - drop_caches is only useful for running various kinds of tests.

Since you are not getting your own kernel instance with OpenVZ, you are unable to execute the command.

0
source

Could you try the steps below -

 sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches' sudo echo 3 > /proc/sys/vm/drop_caches echo 3 > /proc/sys/vm/drop_caches echo 3 | sudo tee /proc/sys/vm/drop_caches 

If these steps do not work -

Get a real machine without OpenVZ (KVM, Xen, etc.) and this will work fine. With OpenVZ, you do not get your own kernel instance and, as such, do not execute such commands.

0
source

Source: https://habr.com/ru/post/1214896/


All Articles