Linux disk cache
Linux has a supposedly good memory management feature that will use up any “extra” RAM you have to cache stuff.
Accessed file’s content gets cached in RAM for fast access eventhough we might not need it later in RAM.
$ free -m
total used free shared buffers cached
Mem: 1504 1490 14 0 24 809
-/+ buffers/cache: 656 848
Swap: 0 0 0
In Linux, you can clear the cache of the memory by using
$ sync; echo 3 > /proc/sys/vm/drop_caches; echo 0 > /proc/sys/vm/drop_caches
or
$ sync; sysctl -w vm.drop_caches=3; sysctl -w vm.drop_caches=0
$ free -m
total used free shared buffers cached
Mem: 1504 650 854 0 1 67
-/+ buffers/cache: 581 923
Swap: 0 0 0
sync should be run because this is a non-destructive operation, and dirty objects are not freeable. So you run sync in order to make sure all cached objects are freed.
Doing echo 3 is clearing pagecache, dentries and inodes but you could choose echo 1 to free pagecache only or echo 2 to free dentries and inodes.
No comments yet.
Leave a Reply
-
Recent
- KDE remove autostart programs
- GPS on Linux
- Debian Squeeze change root password
- Download YouTube Videos on Linux
- Pidgin + The certificate for omega.contacts.msn.com could not be validated
- Tata Phonone / Reliance Netconnect (wvdial)
- mp3 on fedora-13
- Linux disk cache
- redhat/centos build kernel rpm
- KVM on centos5
- File Password Protection
- Building modules for rhel5 kernel
-
Links
-
Archives
- November 2011 (1)
- July 2011 (1)
- April 2011 (1)
- January 2011 (1)
- November 2010 (1)
- September 2010 (2)
- July 2010 (3)
- March 2010 (1)
- January 2010 (5)
- December 2009 (1)
- April 2009 (1)
- January 2009 (1)
-
Categories
-
RSS
Entries RSS
Comments RSS