User Tools

Site Tools


clear_memory

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
clear_memory [2023/07/22 21:35] wigumsclear_memory [2024/07/23 16:19] (current) – external edit 127.0.0.1
Line 21: Line 21:
 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 the third option above “...echo 3 >” in production until you know what you are doing, as it will clear pagecache, dentries, and inodes. 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 the 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? Is it a good idea to free Buffer and Cache in Linux that might be used by Linux Kernel?
 +
 +
 Free Buffer and Cache in Linux Free Buffer and Cache in Linux
  
Line 54: Line 56:
 <code>crontab -e</code> <code>crontab -e</code>
  
-Append the below line, save and exit to run it at 2 am daily.+Append the below line, save and exit to run it at the top of the hour every hour. 
 + 
 +<code> *  *  *  *  /path/to/clearcache.sh</code> 
 + 
  
-<code> 2  *  *  *  /path/to/clearcache.sh</code>+Think of a situation when you have scheduled the script to clear ram cache every day at 2 am. Every day at 2 am the script is executed and it flushes your RAM cache. One day for whatsoever reason may be more than expected users are online on your website and seeking resources from your server.
  
-For more details on how to cron a jobyou may like to check our article on 11 Cron Scheduling Jobs. +At the same time, the scheduled script runs and clears everything in the cache. Now all the users are fetching data from the disk. It will result in a server crash and corrupt the database. So clear ram-cache only when required, and known your footsteps,
-Is it a good idea to auto clear the RAM cache on the production server+
-Clear RAM Cache on Linux Production Server?+
  
-No! it is not. Think of a situation when you have scheduled the script to clear ram cache every day at 2 am. Every day at 2 am the script is executed and it flushes your RAM cache. One day for whatsoever reason may be more than expected users are online on your website and seeking resources from your server. 
  
-At the same time, the scheduled script runs and clears everything in the cache. Now all the users are fetching data from the disk. It will result in a server crash and corrupt the database. So clear ram-cache only when required, and known your footsteps, else you are a Cargo Cult System Administrator. 
 How to Clear Swap Space in Linux? How to Clear Swap Space in Linux?
  
clear_memory.1690061707.txt.gz · Last modified: 2024/07/23 16:19 (external edit)