<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      Linux服務(wù)器Cache占用過多內(nèi)存導(dǎo)致系統(tǒng)內(nèi)存不足問題的排查解決

      作者: 大圓那些事 | 文章可以轉(zhuǎn)載,請以超鏈接形式標(biāo)明文章原始出處和作者信息

      網(wǎng)址: http://www.rzrgm.cn/panfeng412/archive/2013/12/10/drop-caches-under-linux-system.html

      問題描述

      Linux服務(wù)器內(nèi)存使用量超過閾值,觸發(fā)報警。

      問題排查

      首先,通過free命令觀察系統(tǒng)的內(nèi)存使用情況,顯示如下:

                   total       used       free     shared    buffers     cached
      Mem:      24675796   24587144      88652          0     357012    1612488
      -/+ buffers/cache:   22617644    2058152
      Swap:      2096472     108224    1988248

      其中,可以看出內(nèi)存總量為24675796KB,已使用22617644KB,只剩余2058152KB。

      然后,接著通過top命令,shift + M按內(nèi)存排序后,觀察系統(tǒng)中使用內(nèi)存最大的進(jìn)程情況,發(fā)現(xiàn)只占用了18GB內(nèi)存,其他進(jìn)程均很小,可忽略。

      因此,還有將近4GB內(nèi)存(22617644KB-18GB,約4GB)用到什么地方了呢?

      進(jìn)一步,通過cat /proc/meminfo發(fā)現(xiàn),其中有將近4GB(3688732 KB)的Slab內(nèi)存:

      ......
      Mapped:          25212 kB
      Slab:          3688732 kB
      PageTables:      43524 kB
      ......

      Slab是用于存放內(nèi)核數(shù)據(jù)結(jié)構(gòu)緩存,再通過slabtop命令查看這部分內(nèi)存的使用情況:

        OBJS ACTIVE  USE OBJ SIZE  SLABS OBJ/SLAB CACHE SIZE NAME                   
      13926348 13926348 100%    0.21K 773686       18   3494744K dentry_cache
      334040 262056  78%    0.09K   8351       40     33404K buffer_head
      151040 150537  99%    0.74K  30208        5    120832K ext3_inode_cache

      發(fā)現(xiàn)其中大部分(大約3.5GB)都是用于了dentry_cache

      問題解決

      1. 修改/proc/sys/vm/drop_caches,釋放Slab占用的cache內(nèi)存空間(參考drop_caches的官方文檔):

      Writing to this will cause the kernel to drop clean caches, dentries and inodes from memory, causing that memory to become free.
      To free pagecache:
      * echo 1 > /proc/sys/vm/drop_caches
      To free dentries and inodes:
      * echo 2 > /proc/sys/vm/drop_caches
      To free pagecache, dentries and inodes:
      * echo 3 > /proc/sys/vm/drop_caches
      As this is a non-destructive operation, and dirty objects are notfreeable, the user should run "sync" first in order to make sure allcached objects are freed.
      This tunable was added in 2.6.16.

      2. 方法1需要用戶具有root權(quán)限,如果不是root,但有sudo權(quán)限,可以通過sysctl命令進(jìn)行設(shè)置:

      $sync
      $sudo sysctl -w vm.drop_caches=3
      $sudo sysctl -w vm.drop_caches=0 #recovery drop_caches

      操作后可以通過sudo sysctl -a | grep drop_caches查看是否生效。

      3. 修改/proc/sys/vm/vfs_cache_pressure,調(diào)整清理inode/dentry caches的優(yōu)先級(默認(rèn)為100),LinuxInsight中有相關(guān)的解釋:

      At the default value of vfs_cache_pressure = 100 the kernel will attempt to reclaim dentries and inodes at a “fair” rate with respect to pagecache and swapcache reclaim. Decreasing vfs_cache_pressure causes the kernel to prefer to retain dentry and inode caches. Increasing vfs_cache_pressure beyond 100 causes the kernel to prefer to reclaim dentries and inodes.

      具體的設(shè)置方法,可以參考方法1或者方法2均可。

      參考資料

      https://www.kernel.org/doc/Documentation/sysctl/vm.txt

      http://major.io/2008/12/03/reducing-inode-and-dentry-caches-to-keep-oom-killer-at-bay/

      http://linux-mm.org/Drop_Caches

       

      posted on 2013-12-10 15:38  大圓那些事  閱讀(74695)  評論(13)    收藏  舉報

      導(dǎo)航

      主站蜘蛛池模板: 国产亚洲999精品aa片在线爽| 亚洲人成网7777777国产| 国产精品一区二区 尿失禁| 在线精品国产中文字幕| 粉嫩蜜臀av一区二区三区| 亚洲色欲色欲天天天www| 久久午夜无码免费| 国产精品一区二区在线蜜芽tv| 国产精品剧情亚洲二区| 日本三级香港三级三级人妇久| 公天天吃我奶躁我的在线观看| 久久久久久99av无码免费网站| 无码人妻精品一区二区三区下载| 国产精品无码一区二区桃花视频| 久久99日韩国产精品久久99| 国产成人一区二区免av| 婷婷开心深爱五月天播播| 平泉县| 精品久久久bbbb人妻| 人妻丝袜无码专区视频网站| 国产高清精品在线91| 麻豆精品在线| 丁香五月婷激情综合第九色| 国产精品毛片在线完整版| 成人一区二区人妻不卡视频 | 少妇私密会所按摩到高潮呻吟 | 久久精品国产亚洲av麻豆长发| 亚洲人成亚洲人成在线观看| 亚洲av综合久久成人网| 92国产精品午夜福利免费| 久久久久综合一本久道| 欧美videos粗暴| 盐源县| 中文字幕在线日韩| 国产乱码精品一区二区三区四川人 | 亚洲精品综合网中文字幕| 久久天天躁狠狠躁夜夜2020老熟妇| 阳曲县| 亚洲aⅴ无码专区在线观看q| 中文字幕v亚洲日本在线电影| 亚洲精品久久久久国色天香|