centos中釋放緩存的方法


釋放緩存區內存的方法
a)清理pagecache(頁面緩存)
# echo 1 > /proc/sys/vm/drop_caches     或者 # sysctl -w vm.drop_caches=1

b)清理dentries(目錄緩存)和inodes
# echo 2 > /proc/sys/vm/drop_caches     或者 # sysctl -w vm.drop_caches=2

c)清理pagecache、dentries和inodes
# echo 3 > /proc/sys/vm/drop_caches     或者 # sysctl -w vm.drop_caches=3


[root@test4_haili_dev hadoop-2.7.3]# free -m
             total       used       free     shared    buffers     cached
Mem:          7809       7159        650          0        324       2444
-/+ buffers/cache:       4390       3419 
Swap:          511         89        422 
[root@test4_haili_dev hadoop-2.7.3]# cat /proc/sys/vm/drop_caches
1
[root@test4_haili_dev hadoop-2.7.3]# echo 1 > /proc/sys/vm/drop_caches  
[root@test4_haili_dev hadoop-2.7.3]# free -m
             total       used       free     shared    buffers     cached
Mem:          7809       4345       3464          0          0         36
-/+ buffers/cache:       4308       3500 
Swap:          511         89        422 
[root@test4_haili_dev hadoop-2.7.3]# cat /proc/sys/vm/drop_caches 
1
[root@test4_haili_dev hadoop-2.7.3]# echo 2 > /proc/sys/vm/drop_caches
[root@test4_haili_dev hadoop-2.7.3]# cat /proc/sys/vm/drop_caches 
2
[root@test4_haili_dev hadoop-2.7.3]# free -m
             total       used       free     shared    buffers     cached
Mem:          7809       4303       3506          0          2         36
-/+ buffers/cache:       4265       3544 
Swap:          511         89        422 
[root@test4_haili_dev hadoop-2.7.3]# cat /proc/sys/vm/drop_caches
2
[root@test4_haili_dev hadoop-2.7.3]# echo 3 > /proc/sys/vm/drop_caches
[root@test4_haili_dev hadoop-2.7.3]# free -m
             total       used       free     shared    buffers     cached
Mem:          7809       4301       3508          0          0         36
-/+ buffers/cache:       4264       3544 
Swap:          511         89        422 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM