Recently I saw a box (actually, web server VM) that has exact 0 (zero) bytes unused in its swap, while available RAM (which is not free, but the sum of free+buffers+cache) is at 60% of total VM RAM. Never seen that before, so wondered if this is good config (for the box and applications).
The admin of the VM told me he treat that as perfectly normal and that’s his ordinary way of tuning boxes up.
His idea was that if box has a lot of cold RAM pages the kernel will swap it out to free up “real” ram pages so it can used to cache data.
As for me, I used to know the swap is the last thing to use if we like to have a fast box. So, I used to set swappiness to lower values (so kernel won’t like to swap pages out), but this person's approach was to say it is good to swap out as much data as we have swap space, thus having more cache. And yes, he said, the kernel can cache swapped pages, too, so there is no good in keeping the swap free.
Please easy my mind on that: should the VM swap be used at its best, and RAM be freed this way so kernel disk cache can be used more effectively?
To be exact, there was at the moment: 1 GB of swap space (used at 100%), VM has 32 GB of RAM, and available RAM was 13 GB.