Clear / Flush cached memory [duplicate]
Solution 1:
Dropping your caches will likely impact your server's performance as it has to reread frequently accessed data back into the caches after every cache drop.
There is no real reason to drop your caches. To the Linux kernel memory being used for cache is essentially free and will be passed on to applications whenever they need it. Take a look at this website for more information.
Regarding the data stored in memcached - this safe from the effects of dropping the page/dentries/inodes caches.
Solution 2:
As said, there is little point in dropping caches unless you have a very compelling reason to do so. If you are not seeing any performance problem, leave it as it is.
If you are of the curious type, then you can tweak the parameter vm.vfs_cache_pressure. The default value is 100 which means that kernel will try to reclaim cache at a fair rate compared to reclaiming swap. Increasing the value would lead cached memory to be reclaimed faster and reducing it would lead to reclaiming swap faster, but remember this is just how kernel's aggressiveness to clear cache or swap is. Actual results vary from environment to environment.
In stead of echoing 3, you can also echo 1 or 2. If I remember correctly, echoing 1 will clear page cache and 2 will clear dentry and inode cache. 3 will clear pagecache, dentry and inode caches.
Solution 3:
There's no real harm to having that level of cached RAM. It's what Linux does.
Are you seeing any performance gain following dropping the caches? If not, then it's not worth scheduling it.
As a side, you can control what's in the cache with a little more granularity using the vmtouch
utility.