VFS cache and Swappiness

sudo micro /etc/sysctl.d/99-sysctl-performance-tweaks.conf

In this config file, the vm.swappiness and vm.vfs_cache_pressure behave as follows.
Reducing vfs pressure reduces amount of caching that is reclaimed when more memory is used that is it reclaims the memory used for cache for whatever application you are using.
If you increase swappiness, less ram and more swap storage will be used. it is recommended to use less swappiness for HDDs since they significantly slow down the system when used as swap.

Recommended values:

For under 16gb ram and SSD:
swappiness:20-30
vfs pressure: 80-90(lower ram higher value)

For 16 gb and more and SSD:
swappiness: 20-30
vfs pressure: 65-75

you get the gist. more ram less swappiness. faster ssd more swappiness. more ram less vfs pressure, high cpu usage due to decompression=increase in vfs pressure.
default values garuda sets are usually good for most use cases but in case you get out of memory or high cpu usage due to vfs decompression and want to tweak them this is the guide.

Sources:
https://wiki.archlinux.org/index.php/Swap
https://www.kernel.org/doc/html/latest/admin-guide/sysctl/vm.html

5 Likes

Any suggestions for HDD?

I have old machine, with 4 GB RAM and HDD.

I have swappiness set to 15. Haven't changed anything else. Working fine so far, but would welcome any suggestions. :grinning:

How is this affected by Garuda using ZRAM by default?

What evidence or guidance are you basing these changes on?

2 Likes

I learnt some from archwiki and linux kernel docs.please do correct me if I made any mistake in the interpretation.

I think that's a good value for your machine. You have to increase zfs pressure (not necessary)

Links to the related information is always good to include in a tutorial post.

3 Likes

Your wish is my command senpai.

2 Likes

I think adding this to the wiki is a good idea. it will help newbies learn how to handle their particular amount of RAM and swap. Will help avoid OOM problems which seem to be ubiquitous.

1 Like

I use different computers with from 4 to 32 GB of RAM. I have always set my swapiness factor to 10 long before I started using Garuda.

If feel that is a good default for many different machines. I'm not saying that tweaking that number isn't a good thing. I simply feel that 10 is a good default value, and that changing that number is not required.

3 Likes

it helped me, so I agree, this will help newcomers to garuda linux.

1 Like