next up previous
Next: Filling in Partially Cached Up: Read Caching Implementation Previous: Read Caching Implementation

Mount Parameters for Caching

Our NFS client permits flexible control over the cache parameters. We provide several new configurable arguments which can be specified in the usual way in the /etc/fstab file and our enhanced mount utility exposes those parameters to our NFS client via the nfs_server structure. Each remote filesystem specifies these parameters independently.

The parameters that we have added to configure our caching scheme are:

mount syntax Internal name Description
[no]dc_enable NFS_MOUNT_DC_ENABLED Enables caching
[no]dc_read NFS_MOUNT_DC_READS Enables reading from the cache (but not updating)
dc_root=<dir> disk_cache_root Location of disk cache
dc_min_free=# disk_cache_min_free Min free space for that cache partition
dc_max_size=# disk_cache_max_size Maximum cached data for this partition (kb)

The first option, dc_enable, controls whether files read from the remote partition are to be cached. By selectively enabling caching for remote partitions, a system administrator can choose not to cache certain partitions which may be written to frequently. Such partitions are not likely to benefit from a local cache. The second option is related: dc_read, permits a partition to have files already cached locally be used, but not update the cache when remote files changes, or a new remote file is accessed. This option is especially useful during debugging.

The next two options, disk_cache_root and disk_cache_min_free, specify the directory where the cache files should live and how much space must minimally remain free on the local disk partition where that directory resides. Different remote partitions may be cached in different directories, but do not need to be. The local cache location is just an ordinary directory that is dedicated to holding cache files and information. For example, if a host has a large /tmp partition, a system administrator could create /tmp/.nfs-cache and use that for the NFS cache--no special partitioning or reformatting is required.

Finally, the disk_cache_max_size option permits specifying the maximum amount of local disk space to use for caching a given remote partition. Using this parameter, a system administrator can allocate more local disk space for heavily caching an important remote partition, or limit the amount of local disk space a rarely-needed partition is allowed to consume.

The flexibility of our caching scheme permits the caching NFS client to be introduced into a production system with minimal hassle and effort.

next up previous
Next: Filling in Partially Cached Up: Read Caching Implementation Previous: Read Caching Implementation
Greg Badros