Sandeep B. Posted July 6, 2023 Share Posted July 6, 2023 IN this tutorial I’ll show you how you can easily clear ram cache and swap memory to speed up the Linux server. You all are familiar with word CACHE which usually represents performance benefits like cache can improve website’s loading speed and similarly cache will improve Linux server performance too in some places. Normally cache are managed by Linux Kernel efficiently and will be cleaned overtime when not in use. Cache cleaning is necessary to refresh and free up the system memory so a new version of cache can be built by eliminating old cache. In result it will help your Server to run even faster with fresh cache. Let’s get started with the tutorial : Please note it is not recommended running Level 3 cache on regular basis, use it when you need to free up memory and cache. It is recommend to use level 1 cache clearing only. Here there are 3 levels of RAM cache clearing commands : vm.drop_caches=1 : This is will clear pagecache – recommended sync; echo 1 > /proc/sys/vm/drop_caches vm.drop_caches=2 : This is will clear dentries and inodes sync; echo 2 > /proc/sys/vm/drop_caches vm.drop_caches=3 : This is will clear pagecache, dentries and inodes i.e. all cache are cleared sync; echo 3 > /proc/sys/vm/drop_caches Clear Swap Memory : Clearing swap memory can take time depending disk speed and the size of the swap memory usage, to clear it simply run this command : swapoff -a && swapon -a ** also don’t use cache clearing command under cron jobs, this commands should be run manually and automation is not recommended. Link to comment Share on other sites More sharing options...
leisegang Posted February 16 Share Posted February 16 this is a solution, but normally a server will clear cache memory when needed., mysql uses the caches very much, also APC/memcached if you use that. It should just be used as a temporary solution and not make a cronjob out of it as sandeep is mentioning. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now