11.4. Setting Cache Cull Limits
The cachefilesd
daemon works by caching remote data from shared file systems to free space on the disk. This could potentially consume all available free space, which could be bad if the disk also housed the root partition. To control this, cachefilesd
tries to maintain a certain amount of free space by discarding old objects (i.e. accessed less recently) from the cache. This behavior is known as cache culling.
When dealing with file system size, the CacheFiles culling behavior is controlled by three settings in /etc/cachefilesd.conf
:
- brun
N
%
If the amount of free space rises above N
% of total disk capacity, cachefilesd
disables culling.
- bcull
N
%
If the amount of free space falls below N
% of total disk capacity, cachefilesd
starts culling.
- bstop
N
%
If the amount of free space falls below N
%, cachefilesd
will no longer allocate disk space until until culling raises the amount of free space above N
%.
Some file systems have a limit on the number of files they can actually support (for example, ext3 can only support up to 32,000 files). This makes it possible for CacheFiles to reach the file system's maximum number of supported files without triggering bcull
or bstop
. To address this, cachefilesd
also tries to keep the number of files below a file system's limit. This behavior is controlled by the following settings:
- frun
N
%
If the number of files the file system can further accommodate falls below N
% of its maximum file limit, cachefilesd
disables culling. For example, with frun 5%
, cachefilesd
will disable culling on an ext3 file system if it can accommodate more than 1,600 files, or if the number of files falls below 95% of its limit, i.e. 30,400 files.
- fcull
N
%
If the number of files the file system can further accommodate rises above N
% of its maximum file limit, cachefilesd
starts culling. For example, with fcull 5%
, cachefilesd
will start culling on an ext3 file system if it can only accommodate 1,600 more files, or if the number of files exceeds 95% of its limit, i.e. 30,400 files.
- fstop
N
%
If the number of files the file system can further accommodate rises above N
% of its maximum file limit, cachefilesd
will no longer allocate disk space until culling drops the number of files to below N
% of the limit. For example, with fstop 5%
, cachefilesd
will no longer accommodate disk space until culling drops the number of files below 95% of its limit, i.e. 30,400 files.
The default value of N
for each setting is as follows:
brun
/frun
— 10%
bcull
/fcull
— 7%
bstop
/fstop
— 3%
When configuring these settings, the following must hold true:
0 <= bstop
< bcull
< brun
< 100
0 <= fstop
< fcull
< frun
< 100