If you echo various values to it, various kernel cache data structures are dropped. This is a non-destructive operation, so if you still see stuff hanging out after it, it's likely that it was dirty cache. Anyhow, on to the values:
1 - drop the pagecache
2 - drop the dentry and inode caches
3 - drop both the dentry and inode caches, as well as the pagecache.
Here's an example of the impact on the pagecache by doing this:
[root@rugrat ~]# free
total used free shared buffers cached
Mem: 2060656 1448748 611908 0 239620 649220
-/+ buffers/cache: 559908 1500748
Swap: 4194296 41056 4153240
[root@rugrat ~]# echo 3 > /proc/sys/vm/drop_caches
[root@rugrat ~]# free
total used free shared buffers cached
Mem: 2060656 615108 1445548 0 244 89128
-/+ buffers/cache: 525736 1534920
Swap: 4194296 41056 4153240
Note how the pagecache went from ~650MB to around ~89MB after dropping it. In practicality, you would likely never want to do this. However, if you are performing testing on the machine in question, you likely want to test the efficiency of the hardware ,and not the kernel's caching mechanisms.
Labels: linux, performance, tuning


Leave a comment