Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to clear cache in OpenVZ?

Tags:

centos

openvz

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

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

How may be this cache clear?

like image 333
shilovk Avatar asked Mar 07 '15 15:03

shilovk


2 Answers

This was reported on the OpenVZ bug tracker. It has been resolved as RESOLVED WONTFIX

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

All containers share the same page cache (although there is per-container accounting), so to drop caches of one single container we have to check each page:

1 Whether it belongs to the container or not -- supposing we do have that information, which I am not sure of

2 Whether this page is used by other containers.

So, while this is trivial on the host system, it is much less trivial for a container. And this is not a critical piece of functionality -- drop_caches is only useful for running various sorts of benchmarks.

Since your don't get your own kernel instance with OpenVZ you are prevented from running the command.

like image 96
Andy Avatar answered Oct 18 '22 11:10

Andy


As a result, in order to clear the cache -> must restart VPS.

like image 28
shilovk Avatar answered Oct 18 '22 09:10

shilovk