Collecting CacheFS statistics enable you to do the following:
Determine an appropriate cache size
Observe the performance of the cache
These statistics will help you determine the trade-off between your cache size and the desired performance of the cache.
The CacheFS statistics commands consist of the following:
Command |
Man Page |
Description |
---|---|---|
cachefslog |
Specifies the location of the log file. This command also displays where the statistics are currently being logged, and enables you to stop logging. |
|
cachefswssize |
Interprets the log file to give a recommended cache size. |
|
cachefsstat |
Displays statistical information about a specific file system or all CacheFS file systems. The information provided in the output of this command is taken directly from the cache. |
You can issue the CacheFS statistics commands from any directory. You must be superuser to issue the cachefswssize command.
The CacheFS statistics begin accumulating when you create the log file. When the work session is over, stop the logging by using the cachefslog -h command, as described in How to Stop CacheFS Logging.
Before using the CacheFS statistics commands, you must do the following:
Set up your cache by using the cfsadmin command.
Decide on an appropriate length of time to allow statistical information to collect in the log file you create. The length of time should equal a typical work session. For example, a day, a week, or a month.
Select a location or path for the log file. Make sure that there is enough space to allow for the growth of the log file. The longer you intend to allow statistical information to collect in the log file, the more space you need.
The following procedures are presented in a recommended order. The order is not required.
$ cachefslog -f log-file-path /mount-point |
-f |
Sets up logging. |
log-file-path |
Specifies the location of the log file. The log file is a standard file you create with an editor, such as vi. |
/mount-point |
Designates the mount point (CacheFS file system) for which statistics are being collected. |
Verify that you correctly set up the log file.
$ cachefslog /mount-point |
The following example shows how to set up the /var/tmp/samlog log file to collect statistics about the /home/sam directory.
$ cachefslog -f /var/tmp/samlog /home/sam /var/tmp/samlog: /home/sam |
You can also use the cachefslog command with no options to locate a log file for a particular mount point.
$ cachefslog /mount-point |
/mount-point specifies the CacheFS file system for which you want to view the statistics.
The following example shows what you would see if a log file has been set up. The location of the log file is /var/tmp/stufflog.
$ cachefslog /home/stuff /var/tmp/stufflog: /home/stuff |
The following example shows that no log file has been set up for the specified file system.
$ cachefslog /home/zap not logged: /home/zap |
Use the cachefslog -h option to stop logging.
$ cachefslog -h /mount-point |
The following example shows how to stop logging on /home/stuff.
$ cachefslog -h /home/stuff not logged: /home/stuff |
If you get a system response other than the one specified here, you did not successfully stop logging. Check to see if you are using the correct log file name and mount point.
You might want to check if you need to increase the size of the cache. Or, you might want to determine what the ideal cache size is based on your activity since you last used the cachefslog command for a particular mount point.
Become superuser on the client system.
View the current cache size and highest logged cache size.
# cachefswssize log-file-path |
For more information, see cachefswssize(1M).
In the following example, the end size is the size of the cache at the time you issued the cachefswssize command. The high water size is the largest size of the cache during the time frame in which logging occurred.
# cachefswssize /var/tmp/samlog /home/sam end size: 10688k high water size: 10704k / end size: 1736k high water size: 1736k /opt end size: 128k high water size: 128k /nfs/saturn.dist end size: 1472k high water size: 1472k /data/abc end size: 7168k high water size: 7168k /nfs/venus.svr4 end size: 4688k high water size: 5000k /data end size: 4992k high water size: 4992k total for cache initial size: 110960k end size: 30872k high water size: 30872k |
You might want to view certain information about a specific CacheFS file system. The following table explains the terminology that is displayed in the statistics output.
Table 40–2 CacheFS Statistics Terminology
Output Term |
Description |
---|---|
cache hit rate |
The rate of cache hits versus cache misses, followed by the actual number of hits and misses. A cache hit occurs when the user wants to perform an operation on a file or files, and the file or files are actually in the cache. A cache miss occurs when the file is not in the cache. The load on the server is the sum of cache misses, consistency checks, and modifications (modifies). |
consistency checks |
The number of consistency checks performed, followed by the number that passed, and the number that failed. |
modifies |
The number of modify operations. For example, writes or creates. |
View the statistics with the cachefsstat command. You can view the statistics at any time. For example, you do not have to set up logging in order to view the statistics.
$ cachefsstat /mount-point |
/mount-point specifies the CacheFS file system for which you want to view the statistics.
If you do not specify the mount point, statistics for all mounted CacheFS file systems will be displayed.
For more information, see cachefsstat(1M).
This example shows how to view statistics on the cached file system, /home/sam.
$ cachefsstat /home/sam cache hit rate: 73% (1234 hits, 450 misses) consistency checks: 700 (650 pass, 50 fail) modifies: 321 garbage collection: 0 |