How to check the size of the ZFS ARC and L2ARC

 

ZFS Fun Fact

The ZFS ARC is the Adaptive Replacement Cache. There is a simply way check the size of the cache on any OpenIndiana, Solaris, OpenSolaris, or Nexenta system.

Simply run the following command as root or equivalent

 

root@caprica:~# echo ::memstat |mdb -k
Page Summary Pages MB %Tot
------------ ---------------- ---------------- ----
Kernel 696132 2719 33%
ZFS File Data 579365 2263 28%
Anon 179254 700 9%
Exec and libs 2473 9 0%
Page cache 11316 44 1%
Free (cachelist) 7529 29 0%
Free (freelist) 618755 2417 30%

Total 2094824 8182
Physical 2094823 8182

To see the utilization on your L2ARC devices simply use zpool iostat with the -v switch

root@caprica:/# zpool iostat -v backup
capacity operations bandwidth
pool alloc free read write read write
----------- ----- ----- ----- ----- ----- -----
backup 9.33T 5.17T 539 885 5.35M 8.74M
raidz1 4.67T 2.58T 269 442 2.68M 4.37M
c8t0d0 - - 197 31 1.20M 1.49M
c8t1d0 - - 195 29 1.20M 1.49M
c8t2d0 - - 196 31 1.20M 1.49M
c8t3d0 - - 195 29 1.20M 1.49M
raidz1 4.67T 2.58T 269 442 2.68M 4.37M
c8t16d0 - - 196 30 1.20M 1.49M
c8t17d0 - - 195 29 1.20M 1.49M
c8t18d0 - - 196 31 1.20M 1.49M
c8t19d0 - - 195 29 1.20M 1.49M
cache - - - - - -
c6t1d0 59.6G 8M 4 1 58.0K 117K
c6t2d0 37.3G 8M 0 0 13.5K 54.8K
----------- ----- ----- ----- ----- ----- -----


You can see my backup pool consumes nearly 100GB of metadata. Amazing.

As a follow up, to check the type of data held in your cache you can use the following zfs get command


root@caprica:/# zfs get secondarycache backup
NAME PROPERTY VALUE SOURCE
backup secondarycache metadata local

Here you see that the backup pool only holds meta data while the data pool outlined below caches whole blocks.


root@caprica:/# zfs get secondarycache data
NAME PROPERTY VALUE SOURCE
data secondarycache all default

This entry was posted in ZFS Fun Fact and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>