The ZFS file system uses the adaptive replacement cache (ARC) to cache data in the kernel. Measuring ARC utilization is pretty straight forward, since ZFS populates a number of kstat values with usage data. Neelakanth Nadgir wrote a cool Perl script to summarize the ARC kstats, and a sample run is included below:
$ arcstat.pl
Time read miss miss% dmis dm% pmis pm% mmis mm% arcsz c
12:31:28 0 0 0 0 0 0 0 0 0 283M 283M
12:31:30 0 0 0 0 0 0 0 0 0 283M 283M
12:31:32 3 1 42 1 42 0 0 1 42 283M 283M
12:31:34 0 0 0 0 0 0 0 0 0 283M 283M
12:31:36 4 1 25 1 25 0 0 1 33 283M 283M
12:31:38 0 0 0 0 0 0 0 0 0 283M 283M
12:31:40 24 23 95 23 95 0 0 23 95 284M 283M
12:31:42 35 33 95 33 95 0 0 33 95 202K 283M
12:31:44 0 0 0 0 0 0 0 0 0 202K 283M
12:31:46 0 0 0 0 0 0 0 0 0 202K 283M
12:31:48 0 0 0 0 0 0 0 0 0 202K 283M
12:31:50 0 0 0 0 0 0 0 0 0 202K 283M
Since numerous discussions have come up on zfs-discuss regarding ARC sizing (the size of the ARC is controlled by the zfs:zfs_arc_max tunable), folks will find the “arcsz” column extremely useful. Nice!