I have a server run an erlang application, something like riak..
Before the problem, the memory usage like this
but after a long time, the cached is clear and system begin use swap.
now I have two question..
Why the system release the cached? This cause the problem that the system's IO is higher than before
Why the system still has enough memory, but swap is still used..
Below is the top information:
Update: this problem come again..
Since I have run command
sudo swapoff -a
so the system don't use swap, the system runs well.
Now the problem is why system release page cached..?
And what the situation is that the system will release pgae cache?
Update: I have fixed this problem..
I got answer from the book Understanding Linux Kernel
The book say that if there is enough free memory, the page is kept in the cache for an indefinite period of time and can then be reused by other processes without accessing the disk.
I think this means that the system will release the cache if the page cache has stay in the system for a long time.
After I read the linux source, I will update it. Why the system will release page cached even it has enough memory?
Thanks
update
if we swap the memory when a process find there is not enough memory, then it will need a long time for the process to get enough memory. It will need to call page frame reclaim.
There is a global_reclaim in the backend. which don't check the swappiness value
Have a look to your processes running (ex: mysql, java etc...)
If you set a memory limit too low for theses processes and sometimes they need more, the memory missing is not taken onto the buffers but on swap.
I think this could explain your problem.
i.e. debian is swapping really seldom used data. I think this behavior is considered as an optimization. This question directly corresponds to this one. You can set the swappiness factor:
sudo sysctl vm.swappiness=10
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With