- Joined
- Jun 14, 2016
- Messages
- 1,494
- Points
- 63
I want to free up memory by clear RAM on my VPS Linux but seem this needs a reboot. Can I clear RAM without rebooting?
sync; echo 3 > /proc/sys/vm/drop_caches
sync; echo 1 > /proc/sys/vm/drop_caches
Just add to crontab:I want to free up memory by clear RAM on my VPS Linux but seem this needs a reboot. Can I clear RAM without rebooting?
I tried to run this command on a small VPS and seem it workedWith root account:
Clear PageCache, dentries and inodesCode:sync; echo 3 > /proc/sys/vm/drop_caches
But not recommend production server's, just Clear PageCache:
Code:sync; echo 1 > /proc/sys/vm/drop_caches
[root@server1 ~]# free -m
total used free shared buffers cached
Mem: 971 794 177 0 237 432
-/+ buffers/cache: 124 847
Swap: 0 0 0
[root@server1 ~]# sync; echo 3 > /proc/sys/vm/drop_caches
[root@server1 ~]# free -m
total used free shared buffers cached
Mem: 971 96 875 0 0 14
-/+ buffers/cache: 80 891
Swap: 0 0 0
cached 432 -> cached 14
Sometime server high load then it is time to clear RAM?I am just wondering what advantage do you see after clearing the cached contents from RAM?
So when should we clear RAM?So its not recommended to do it regularly.
I am caring about this and I should ignore purging RAM and caches on servers?Clearing cache will free RAM, but it causes the kernel to look for files on the disk rather than in the cache which can cause performance issues.
# Do less swapping
vm.swappiness = 30
vm.dirty_ratio = 30
vm.dirty_background_ratio = 5
# specifies the minimum virtual address that a process is allowed to mmap
vm.mmap_min_addr = 4096
# 50% overcommitment of available memory
vm.overcommit_ratio = 50
vm.overcommit_memory = 0
# Set maximum amount of memory allocated to shm to 256MB
kernel.shmmax = 268435456
kernel.shmall = 268435456
# Keep at least 64MB of free RAM space available
vm.min_free_kbytes = 65535
ForumWeb.Hosting is a web hosting forum where you’ll find in-depth discussions and resources to help you find the best hosting providers for your websites or how to manage your hosting whether you are new or experienced. You’ll find it all here. With topics ranging from web hosting, internet marketing, search engine optimization, social networking, make money online, affiliate marketing as well as hands-on technical support for web design, programming and more. We are a growing community of like-minded people that is keen to help and support each other with ambitions and online endeavors. Learn and grow, make friends and contacts for life.
The world's smartest hosting providers come here to discuss & share what's trending in the web hosting world!