By default, SmartIO caches the file data based on the workload. SmartIO loads portions of files into the cache based on I/O access. When the cache area fills, data may be evicted to make room for caching new data. SmartIO uses criteria such as frequency of access to evict data. While the data is in the cache, the subsequent I/Os to that file data are satisfied from the cache. If the data is evicted, any subsequent I/O request is served from the primary storage. SmartIO may then cache the data again.
To maximize the use of the cache, you can customize the caching behavior to control when files are loaded or evicted from the cache. You can customize the caching behavior, using the following operations:
The load operation preloads files into the cache before the I/O accesses the files. The files are already in the cache so that the I/Os return more quickly. By default, the files are loaded in the background. Use the -o sync operation to load the files synchronously, which specifies that the command does not return until all the files are loaded. The files that are loaded in this way are subject to the usual eviction criteria.
The pin operation prevents the files from being evicted from the cache. You can pin commonly used files so that SmartIO does not evict the files and later need to cache the files again. A pinned file is kept in the cache indefinitely, until it is deleted or explicitly unpinned. If you pin a file with the -o load option, the operation also caches the file contents synchronously. If you do not specify the -o load option, the file contents are cached based on I/O access.
The unpin operation removes files from the pinned state. The unpin operation does not cause the file to be immediately evicted. SmartIO considers the file for eviction in the same way as any other file, when space is required in the cache.
For each of these operations, you can specify files individually, or specify a directory name to affect all of the files in a directory. Use the -r option to make the selection recursive.
To load a file or directory
# sfcache load [-r] [-o sync] {file|dir}
Use the -r option to make the selection recursive.
Use the -o sync option to specify that the command does not return until all the files are loaded.