How to improve file system caching with ext4 / inode cache?

As a spin-off of topic in test data, the problem now is that I have so much primary IO for uploading and downloading that nice processes like the filewalkers don’t seem to finish and finally are being killed.

So, I was wondering wheter there are options for this.

Especially notice to @elek , with thanks to @littleskunk in the topi:

The easiest option is to just add more RAM if you can. Linux automatically caches into RAM if it is just sitting there empty, and reclaims it back if needed by other programs.

2 Likes

I already have 16G RAM with zram caching (+20G unused SSD swap), on a total of 32GB of data.

You shouldn’t use swap on an SSD, it’s only a way to kill it faster.

If you can, add more sticks of RAM. If not, someone else may have a better idea (ie LVM cache, which I don’t use so can’t comment).

1 Like

I would recommend to take a look on this thread:

I am not fully sure that the Linux kernel will use swap for inode caching. I think it’s different story, but can be wrong.

Also: 16GB seems to be small. I have seen 66GB inode cache on my machine…

For sure it won’t, but using swap the real RAM use is lower, so there remains more space for the virtual file system.

How can i check this number?

That number, you actually can’t. Because it’s in the past and Elek’s system :wink:

But if you want to check for now on your own system:

cat /proc/meminfo
Then you find it in slab.

1 Like

sudo slabtop -o

And check ext4_inode_cache

(-o is just for executing once instead of referesh it multiple times. Easier to grep)

3 Likes