solaris 11 zfs ARC

1. The Adaptive Replacement Cache
An ordered list of recently used resource entries; most recently
used at the top and least recently used at the bottom. Entries used
for a second time are placed at the top of the list and the bottom
entries will be evicted first. It used to be called LRU(Least Recenctly
Used) (LRU is evicted first).
ARC is an improvement because it keeps two lists T1 T2.
T1 for recent cache entries
T2 for frequent entries, referenced at least twice

2. Solaris 11 allows for locked pages by ZFS that cannot be vacated.
This may cause a problem for other programs in need of memory, or
if another filesystem than ZFS is used as well.

3. ZFS claims all memory except for 1 GB, or it claims at least 3/4

4. How much memory do we have?
prtconf | grep Mem
Memory size: 3072 Megabytes

5. See ARC statistics:
mdb -k
>::arc
(output skipped)
c_max = 2291 MB

6. How much memory is in use by ZFS?
mdb -k
>::memstat
Page Summary______Pages______MB____%Tot
Kernel____________136490_____533____17%
ZFS File Data_____94773______370____12%


7. Is the tunable parameter to limit ARC for ZFS set?
0 means no, 1 means yes.
mdb -k
> zfs_arc_max/E
zfs_arc_max:
zfs_arc_max: 0

8. What is the target max size for ARC?
kstat -p zfs::arcstats:c_max
zfs:0:arcstats:c_max 2402985984

(2402985984 bytes is 2291 MB)

9. How much does ZFS use at the moment?
kstat -p zfs::arcstats:size 5 (show results every 5 seconds)
zfs:0:arcstats:size 539604016
zfs:0:arcstats:size 539604016

(now start reading files and see the number increase)

for i in `seq 1 100`; do cat /var/adm/messages >>/test/data;
cat /test/data > /test/data$i; done

kstat -p zfs::arcstats:size 5 (show results every 5 seconds)
zfs:0:arcstats:size 539604016
zfs:0:arcstats:size 1036895816
zfs:0:arcstats:size 1036996288
zfs:0:arcstats:size 1037086728

10. How much memory is in use by ZFS now?
mdb -k
> ::memstat
Page Summary___Pages___MB___%Tot
------------ ---------------- ---------------- ----
Kernel_________140147__547___18%
ZFS File Data__236377__923___30%

11. To set the target tunable parameter, modify /etc/system and reboot.
vi /etc/system and add:
set zfs:zfs_arc_max= 1073741824
(after the reboot it will be 1 GB instead of 2.2 GB.

-----

brendan gregg's archits script.
# cat -n archits.sh
1 #!/usr/bin/sh
2
3 interval=${1:-5} # 5 secs by default
4
5 kstat -p zfs:0:arcstats:hits zfs:0:arcstats:misses $interval | awk '
6 BEGIN {
7 printf "%12s %12s %9s\n", "HITS", "MISSES", "HITRATE"
8 }
9 /hits/ {
10 hits = $2 - hitslast
11 hitslast = $2
12 }
13 /misses/ {
14 misses = $2 - misslast
15 misslast = $2
16 rate = 0
17 total = hits + misses
18 if (total)
19 rate = (hits * 100) / total
20 printf "%12d %12d %8.2f%%\n", hits, misses, rate
21 }
22 '
---------------------------

This entry was posted in Uncategorized. Bookmark the permalink.

Comments are closed.