I have a server running an erlang application, something like riak ..
Before the problem is the use of memory, for example,

but after a long time, caching becomes clear, and the system starts using swap. 
I now have two questions.
Why does the system release caching? This makes the IO system higher than before.
Why the system still has enough memory, but swap is still in use.
Below is the top information: 
Update : this problem will come again.
Since I sudo swapoff -a so the system does not use swap, the system works well.
Now the problem is why the system release page is cached ..?
And what is the situation when the system releases a cache page?
Update : I fixed this problem.
I got a response from Understanding Linux Kernel
The book says that if there is enough free memory, the page is stored in the cache for an indefinite period of time and then can be reused by other processes without access to the disk.
I think this means that the system will issue a cache if the cache page remains in the system for a long time.
After I read the linux source, I will update it. Why will the system unload the page, even if it has enough memory?
thanks
Update
- Is the reason linux replaces memory with swap space, even if the system has enough memory?
if we swap memory when a process detects that there is not enough memory, then it will take a long time for the process to get enough memory. It will have to cause page page recovery.
- the reason we set vm.swappiness = 0 will still be a swap.
There is a global_reaction in the backend. who do not check the value of swappiness
source share