what are pagecache, dentries, inodes?

前端 未结 4 1798
没有蜡笔的小新
没有蜡笔的小新 2021-01-31 10:37

Just learned these 3 new techniques from https://unix.stackexchange.com/questions/87908/how-do-you-empty-the-buffers-and-cache-on-a-linux-system:


To free pagecache

4条回答
  •  青春惊慌失措
    2021-01-31 10:57

    Common misconception is that "Free Memory" is important. Memory is meant to be used.

    So let's clear that out :

    • There's used memory, which is where important data is stored, and if that reaches 100% you're dead
    • Then there's cache/buffer, which is used as long as there is space to do so. It's facultative memory to access disk files faster, mostly. If you run out of free memory, this will just free itself and let you access disk directly.

    Clearing cached memory as you suggest is most of the case useless and means you're deactivating an optimization, therefore you'll get a slow down.

    If you really run out of memory, that is if your "used memory" is high, and you begin to see swap usage, then you must do something.

    HOWEVER : there's a known bug running on AWS instances, with dentry cache eating memory with no apparent reason. It's clearly described and solved in this blog.

    My own experience with this bug is that "dentry" cache consumes both "used" and "cached" memory and does not seem to release it in time, eventually causing swap. The bug itself can consume resources anyway, so you need to look into it.

提交回复
热议问题