@KGIII
Another interesting fact I didn't know about is the orange bar in htop, example:
The orange bar in memory bar is cache (files from disk loaded into memory and read from it, instead of from disk or SSD),
This file cache does not constitute consumed memory but rather free to use one, hence why it says 3.41G used memory in the screenshot instead of cca 60%
As soon as the memory bar fills up the orange bar will be swapped out to disk to make more memory space for actual memory needs, ex. used (green) shared (purple) or buffers (blue).
Swappiness of 10 should make cache (orange bar) fill up entire memory and release it as needed, but I haven't done extensive tests yet for higher values than 10.
This in addition to swap partition saves a lot of disk I\O for file read\writes other than swap only.
What about your file cache and memory bar (orange portion)?
You know it won't be shown in htop because it will be read from disk which is almost the same as using swap.
without swap you're forcing cache to be read\write to disk.
Swappiness of 10 should make cache (orange bar) fill up entire memory and release it as needed, but I haven't done extensive tests yet for higher values than 10.
I have swap enabled but leave the configuration as the default. It works. I figure if it uses swap when swap is available, I should make swap available. I am not smarter than the kernel.
all depends what do you want to use: RAM or swap
if RAM to use (and has 32GB):
vm.dirty_ratio = 10
vm.dirty_background_ratio = 2
user.max_user_namespaces = 0
vm.stat_interval = 10
vm.swappiness = 100 -> make it 100 for nice balance
vm.vfs_cache_pressure = 50
# for RT kernel only
vm.overcommit_memory = 2
vm.max_map_count = 16777216
I would check what these ^ do of course. Safe for laptop (battery) of UPS. if not much RAM forget other parameters as they push everything to RAM.