[Linux] 困った時のおまじない ... free よ蘇れ
シータ「えーん、えんえん・・・(泣いている)Linux の free (free+buffer+cache) が足りない...」
おばあさん「それは困ったねえ、そうだ、シータ、いいことを教えてあげる。used_memory が増えて free が足りなくなった時のおまじない。」
シータ 「おまじない?」
おばあさん「そう。カーネルにお願いする秘密の言葉。sysctl -w vm.drop_caches=3」
シータ 「sysctl ... ぇ?」
おばあさん「『我を助けよ、free よ甦れ』という意味なの。ぶっちゃけ 1だとイオ、2だとイオラ、3だとイオナズン的に効くって感じ」
[kyagi@sakura ~]$ cat /proc/sys/vm/drop_caches 0 [kyagi@sakura ~]$ free total used free shared buffers cached Mem: 1026876 533172 493704 0 191920 268016 -/+ buffers/cache: 73236 953640 Swap: 2048276 0 2048276 [kyagi@sakura ~]$ sync [kyagi@sakura ~]$ sudo /sbin/sysctl -w vm.drop_caches=3 vm.drop_caches = 3 [kyagi@sakura ~]$ cat /proc/sys/vm/drop_caches 3 [kyagi@sakura ~]$ free total used free shared buffers cached Mem: 1026876 37964 988912 0 292 6472 -/+ buffers/cache: 31200 995676 Swap: 2048276 0 2048276
- buffer と cache についての説明はここがわかりやすい。今は bdflush じゃなくて pdflush だけど。。。
http://www.faqs.org/docs/linux_admin/buffer-cache.html
- ここもわかりやすい(日本語)