I need your professional advice on using this script on my
linux debian server...
The server is used to hosting a website on Magento platform and I have noticed that each
2-3 days when I check the memory its showing like
5-7 GB free memory from total of 64 GB of used...
so I camed across this website :
Where the script is following:
!/bin/bash # Note, we are using "echo 3", but it is not recommended in production instead use "
echo 1" echo
echo 3 > /proc/sys/vm/drop_caches
now the question is this is this safe to do ? can some damage happen if i put this into
crontab that runs this daily ?
they have stated the following :
Is it a good idea to free Buffer and Cache in Linux that might be used by Linux Kernel? When you are applying various settings and want to check, if it is actually implemented specially on I/O-extensive benchmark, then you may need to clear buffer cache. You can drop cache as explained above without rebooting the System i.e., no downtime required.
Linux is designed in such a way that it looks into disk cache before looking onto the disk. If it finds the resource in the cache, then the request doesn’t reach the disk. If we clean the cache, the disk cache will be less useful as the OS will look for the resource on the disk.
Moreover it will also slow the system for a few seconds while the cache is cleaned and every resource required by OS is loaded again in the disk-cache.
I am also wondering i noticed on some other websites the command to load up the memory looks like this :
!/bin/bash sync; echo 3 > /proc/sys/vm/drop_caches
So which is better what does "
sync" before the echo do ?
Thanks for your explanation