User Tools

Site Tools


clear_ram_cache_centos

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
clear_ram_cache_centos [2021/05/04 14:17] – created walkeradminclear_ram_cache_centos [2023/03/09 22:35] (current) – external edit 127.0.0.1
Line 6: Line 6:
 ==== Introduction ==== ==== Introduction ====
 \\  \\ 
-This has been listed under IPHEnot because it is specific to IPHE (because it is not) but because it was on an IPHE system that I first observed this phenomenon.+Every Linux System has three options to clear cache without interrupting any processes or services. 
 +\\  
 +\\  
 +1. Clear PageCache only. 
 +    sync; echo 1 > /proc/sys/vm/drop_caches 
 + 
 +2. Clear dentries and inodes 
 +    sync; echo 2 > /proc/sys/vm/drop_caches 
 + 
 +3. Clear PageCachedentries and inodes. 
 +    sync; echo 3 > /proc/sys/vm/drop_cache 
 +\\  
 +sync will flush the file system buffer. Command Separated by “;” run sequentially. The shell wait for each command to terminate before executing the next command in the sequence. As mentioned in kernel documentation, writing to drop_cache will clean cache without killing any application/service, command echo is doing the job of writing to file. 
 +\\  
 +\\  
 +If you have to clear the disk cache, the first command is safest in enterprise and production as “...echo 1 > ….” will clear the PageCache only. It is not recommended to use third option above “...echo 3 >” in production until you know what you are doing, as it will clear PageCache, dentries and inodes. 
 +\\  
 +\\  
 +Is it a good idea to free Buffer and Cache in Linux that might be used by Linux Kernel? 
 +\\  
 +\\  
 +I have found that on IPHE systems you only need to do the second option <color #ed1c24>sync; echo 2 > /proc/sys/vm/drop_caches</color>. Bear in mind that this is (a) service affecting and (b) can take sometime (maybe a couple of minutes) per node. 
 +\\  
 +\\  
 +Taken from [[https://www.tecmint.com/clear-ram-memory-cache-buffer-and-swap-space-on-linux/]]
 \\  \\ 
 \\  \\ 
clear_ram_cache_centos.1620134253.txt.gz · Last modified: 2023/03/09 22:35 (external edit)