User file cache
The user file cache is used to cache all regular
files. It caches any file, no matter what
its size, and performs write-behind and asynchronous read-ahead for files.
The user file cache is allocated in memory regions in the primary zFS address space. The default size of user_cache_size is calculated. For more information, see IOEFSPRM. However, you can tailor this size to meet your performance needs, based on your overall system memory. The maximum size for user_cache_size is 65,536 MB (64 GB). The general rule for any cache is to ensure a good hit ratio. Additionally, it is good to have a user file cache that is large enough for write-behind activity to occur. If the cache is too small, you need to recycle buffers more frequently and that might degrade write-behind performance.
The MODIFY ZFS,QUERY,VM command output shows the cache “fault ratio” and the cache
“Read wait ratio”. The sum of these fields should be subtracted from 100% to achieve the cache hit
ratio. In general, it is desirable to achieve a cache hit ratio of at least 80% or more, preferably
over 90%. However, the hit ratio is very much workload-dependent. The cache performance depends on
the size of the cache and the following factors: - The size of the files being read and written by applications,
- The access pattern to those files (sequential or random),
- and the number of bytes transferred, on average, by each read and write request that is made to zFS from applications. Smaller transfer sizes will achieve a higher cache hit ratio but at the expense of increased CPU due to increased calls to zFS to read or write the file.
