{"id":2528,"date":"2016-05-17T14:46:52","date_gmt":"2016-05-17T14:46:52","guid":{"rendered":"http:\/\/blog.designed79.co.uk\/?p=2528"},"modified":"2016-05-17T14:46:52","modified_gmt":"2016-05-17T14:46:52","slug":"clear-linux-memory-buffer-cache","status":"publish","type":"post","link":"https:\/\/blog.designed79.co.uk\/?p=2528","title":{"rendered":"CLEAR LINUX MEMORY BUFFER CACHE"},"content":{"rendered":"<p class=\"heading1\">There are three options available to flush cache of Linux memory. Use one of below as per your requirements.<\/p>\n<ul>\n<li>Free pagecache, dentries and inodes in cache memory\n<pre># sync; echo 3 &gt; \/proc\/sys\/vm\/drop_caches\r\n<\/pre>\n<\/li>\n<li>Free dentries and inodes use following command\n<pre># sync; echo 2 &gt; \/proc\/sys\/vm\/drop_caches\r\n<\/pre>\n<\/li>\n<li>Free pagecache only use following command\n<pre># sync; echo 1 &gt; \/proc\/sys\/vm\/drop_caches\r\n<\/pre>\n<\/li>\n<\/ul>\n<h2 class=\"heading1\">Schedule Cron to Flush Cache Regularly<\/h2>\n<p>Its a good idea to schedule following in crontab to automatically flush cache on regular interval.<\/p>\n<pre># crontab -l\r\n\r\n0 * * *  * sync; echo 3 &gt; \/proc\/sys\/vm\/drop_caches\r\n<\/pre>\n<p>The above cron will execute on every hour and flushes the cached memory on system.<\/p>\n<h2 class=\"heading1\">Find Cache Memory uses in Linux<\/h2>\n<p>Use <em>free<\/em> command to find out cache memory uses by Linux system. Output of free command is like below<\/p>\n<pre># free -m -h\r\n<\/pre>\n<p><strong>Sample Output<\/strong><\/p>\n<pre>             total       used       free     shared    buffers     cached\r\nMem:         16050      15908        142          0        120      14953\r\n-\/+ buffers\/cache:        834      15216\r\nSwap:            0          0          0\r\n<\/pre>\n<p><em>Last column is showing cached memory ( 14953 MB) by system. <strong>-m<\/strong> option is used for showing memory details in MB\u2019s and -h is human readable<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are three options available to flush cache of Linux memory. Use one of below as per your requirements. Free pagecache, dentries [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2528","post","type-post","status-publish","format-standard","hentry","category-info-on-tech"],"_links":{"self":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/2528","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2528"}],"version-history":[{"count":0,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/2528\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2528"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2528"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2528"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}