Recommendations on KSM threshold with ballooning enabled

nett_hier

Member
Mar 27, 2023
29
3
8
Hello,

under load, my PVE nodes reach exactly 80% RAM before starting to balloon VM memory, while KSM-shared memory remains relatively minimal.
After searching through the configs, I found that ksmtuned only starts working at above 80% RAM usage, the same value as ballooning.
After decreasing the threshold to 70% (=30 in the config file), ksmtuned managed to pull my nodes below 70% RAM usage and the ballooned VMs got most if not all of their RAM back.
Before committing to the new config though, I wonder why the default is the way it is? If a VM is being affected by ballooning that's more directly observable by me than potentially slower I/O on shared pages, so from my admittedly rather uninformed perspective I'd prioritize KSM over ballooning.
Is there any reason to prefer the opposite and leave the config as-is?
 
Last edited:
  • Like
Reactions: Johannes S
I think it's just a historic accident that they are both the same. Each technology might find 80% a logical default. On recent PVE versions, you can also change the ballooning threshold. When using ZFS where the cache memory counts as used (instead of free-able), it make sense to increase both. I do find it logical to do KSM (slightly) before ballooning when enabling both.