My Ubuntu Linux (virtual) servers run rdiff-backup daily, which looks at all file meta data to determine what needs to be backed up, slowing it down. It does this every day, even though most files don't change. I'd like to keep this data in cache. To this end, I've been experimenting with /proc/sys/vm/vfs_cache_pressure, currently set at 20.

As an example, one virtual server has 35% of its inodes in use:

enter image description here

This amounts to 1057350. Inode size is 256. Does that mean I need (1057350*256) = 258 MB? Edit: apparently not, see below.

And for dentries? This server has 225510 dirs, most of them 4k big. Does that mean I need 225510 * 4096 = 880 MB of cache?

Does this mean that when I set vfs_cache_pressure to 1 and have, say, 2 GB of free memory, it will retain all meta data in cache?

And how can I see how my current cache is used; what is meta data and what is data?

Edit: I just found the slabtop tool. The top lines are:

1656144 1655632  99%    0.19K  78864       21    315456K dentry                 
1207269 1207269 100%    0.76K  57489       21    919824K ext3_inode_cache       
246909 246909 100%    0.10K   6331       39     25324K buffer_head            
232640 232400  99%    0.06K   3635       64     14540K kmalloc-64             
 69776  60491  86%    0.55K   2492       28     39872K radix_tree_node        
 51896  49740  95%    0.61K   1996       26     31936K proc_inode_cache       
 37376  21915  58%    0.01K     73      512       292K kmalloc-8

So there's already 1 GB of inode cache. And directory cache is a lot smaller than I though.

I still can't really deduce how much page cache is used, though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.