Free memory by flushing pagecache and slabcache

Posted In System - By Tum. On Tuesday, May 5th, 2009 With 0 Comments

free memory
เราสามารถทำการ free memory ได้แบบ on demand โดยใช้คำสั่งง่ายๆ ซึ่งวิธีการนี้จะเป็นการ clear memory ในส่วนของ pagecache และ slabcache ในระบบ linux

วิธีการก็คือ ใส่ค่า 1 สำหรับ free pagecache, 2 สำหรับ free dentries และ inodes หรือ 3 สำหรับ free pagecache, dentries และ inodes เข้าไปยังไฟล์ /proc/sys/vm/drop_caches นั้นเอง

ตัวอย่างการ free momory หรือ clear momery

คำสั่งสำหรับ free pagecache:

คำสั่งสำหรับ free dentries และ inodes:

คำสั่งสำหรับ free pagecache, dentries และ inodes:

คำแนะนำ: ถ้าทำการ free memory ในขณะที่ server กำลังใช้งาน memory และ I/O อย่างหนักอาจจะทำให้เกิด deadlock ได้

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

*