I’ve upgraded my system recently and most of my ram remains unused on my daily workload. Is there a way to tell my system to cache more aggressively or do I need to configure this on each application ?
Are there any other ways to take advantage of this extra ram ?
Sure, but there isn’t really much to it. I have 16GB of RAM but I don’t really get more than 35% usage normally, unless I’m gaming or doing something very uncommon.
I have 32 G ram and am running some very cpu intensive processes (~95% loaded with 6 cores/12 threads) with only 8 G of ram (25%) and 750M swap (ZRAM in memory) occupied.
I am not sure what you are looking for in tweaking use of memory, but the system does a pretty good job of managing it.
You can reduce your “swappiness”.
This is a kernel parameter that affects on which point the data is loaded into swap.
The default value is 60. That means that if your RAM usage reaches 40 %, it starts using your swap file.
100% - 60% = 40%
In order to switch your swap off, set the value to 0. (Depends on the Kernel, for me it switches it off.)
If you want to start using your swap late, set it to 10.
But even if you set it to 100, it won’t always start swapping, just earlier, might be at 75% of RAM-Usage, for example.
Just to be clear, reducing the swappiness actually does significantly reduce the amount of hard drive memory is being used. If you fully consumed your RAM, the swap may still be useful. So it generally is not a good idea to switch it off.
You’ll have to try a bit. Using SSDs you won’t feel much difference while swapping.
A swap there can even fastening things, cause more of fast free RAM might be available.
How to do it: sudo sysctl -w vm.swappiness=10
→ This just changes the setting in memory and does not survive a reboot.
To change it permanently: sudo echo "vm.swappiness = 10" > /etc/sysctl.d/98-swappiness.conf
(For example. The precedence is in alphabetic order. The file name needs to end with .conf)
And load all your configured kernel parameter: sudo sysctl --system