Skip to content

Commit

Permalink
Added metadata/dnode cache info to arc_summary
Browse files Browse the repository at this point in the history
Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Closes openzfs#7815
  • Loading branch information
rincebrain authored and behlendorf committed Aug 22, 2018
1 parent 2711b1d commit e8a8208
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 3 deletions.
40 changes: 40 additions & 0 deletions cmd/arc_summary/arc_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ def get_arc_summary(Kstat):
arc_size = Kstat["kstat.zfs.misc.arcstats.size"]
mru_size = Kstat["kstat.zfs.misc.arcstats.mru_size"]
mfu_size = Kstat["kstat.zfs.misc.arcstats.mfu_size"]
meta_limit = Kstat["kstat.zfs.misc.arcstats.arc_meta_limit"]
meta_size = Kstat["kstat.zfs.misc.arcstats.arc_meta_used"]
dnode_limit = Kstat["kstat.zfs.misc.arcstats.arc_dnode_limit"]
dnode_size = Kstat["kstat.zfs.misc.arcstats.dnode_size"]
target_max_size = Kstat["kstat.zfs.misc.arcstats.c_max"]
target_min_size = Kstat["kstat.zfs.misc.arcstats.c_min"]
target_size = Kstat["kstat.zfs.misc.arcstats.c"]
Expand All @@ -228,6 +232,22 @@ def get_arc_summary(Kstat):
'per': fPerc(target_size, target_max_size),
'num': fBytes(target_size),
}
output['arc_sizing']['meta_limit'] = {
'per': fPerc(meta_limit, target_max_size),
'num': fBytes(meta_limit),
}
output['arc_sizing']['meta_size'] = {
'per': fPerc(meta_size, meta_limit),
'num': fBytes(meta_size),
}
output['arc_sizing']['dnode_limit'] = {
'per': fPerc(dnode_limit, meta_limit),
'num': fBytes(dnode_limit),
}
output['arc_sizing']['dnode_size'] = {
'per': fPerc(dnode_size, dnode_limit),
'num': fBytes(dnode_size),
}

# ARC Hash Breakdown
output['arc_hash_break'] = {}
Expand Down Expand Up @@ -333,6 +353,26 @@ def _arc_summary(Kstat):
arc['arc_size_break']['frequently_used_cache_size']['num'],
)
)
sys.stdout.write("\tMetadata Size (Hard Limit):\t%s\t%s\n" % (
arc['arc_sizing']['meta_limit']['per'],
arc['arc_sizing']['meta_limit']['num'],
)
)
sys.stdout.write("\tMetadata Size:\t\t\t%s\t%s\n" % (
arc['arc_sizing']['meta_size']['per'],
arc['arc_sizing']['meta_size']['num'],
)
)
sys.stdout.write("\tDnode Size (Hard Limit):\t%s\t%s\n" % (
arc['arc_sizing']['dnode_limit']['per'],
arc['arc_sizing']['dnode_limit']['num'],
)
)
sys.stdout.write("\tDnode Size:\t\t\t%s\t%s\n" % (
arc['arc_sizing']['dnode_size']['per'],
arc['arc_sizing']['dnode_size']['num'],
)
)

sys.stdout.write("\n")

Expand Down
23 changes: 20 additions & 3 deletions cmd/arc_summary/arc_summary3.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,14 @@ def draw_graph(kstats_dict):
arc_perc = f_perc(arc_stats['size'], arc_stats['c_max'])
mfu_size = f_bytes(arc_stats['mfu_size'])
mru_size = f_bytes(arc_stats['mru_size'])

info_form = 'ARC: {0} ({1}) MFU: {2} MRU: {3}'
info_line = info_form.format(arc_size, arc_perc, mfu_size, mru_size)
meta_limit = f_bytes(arc_stats['arc_meta_limit'])
meta_size = f_bytes(arc_stats['arc_meta_used'])
dnode_limit = f_bytes(arc_stats['arc_dnode_limit'])
dnode_size = f_bytes(arc_stats['dnode_size'])

info_form = 'ARC: {0} ({1}) MFU: {2} MRU: {3} META: {4} ({5}) DNODE {6} ({7})'
info_line = info_form.format(arc_size, arc_perc, mfu_size, mru_size,
meta_size, meta_limit, dnode_size, dnode_limit)
info_spc = ' '*int((GRAPH_WIDTH-len(info_line))/2)
info_line = GRAPH_INDENT+info_spc+info_line

Expand Down Expand Up @@ -483,6 +488,10 @@ def section_arc(kstats_dict):
arc_min = arc_stats['c_min']
mfu_size = arc_stats['mfu_size']
mru_size = arc_stats['mru_size']
meta_limit = arc_stats['arc_meta_limit']
meta_size = arc_stats['arc_meta_used']
dnode_limit = arc_stats['arc_dnode_limit']
dnode_size = arc_stats['dnode_size']
target_size_ratio = '{0}:1'.format(int(arc_max) // int(arc_min))

prt_2('ARC size (current):',
Expand All @@ -498,6 +507,14 @@ def section_arc(kstats_dict):
f_perc(mfu_size, caches_size), f_bytes(mfu_size))
prt_i2('Most Recently Used (MRU) cache size:',
f_perc(mru_size, caches_size), f_bytes(mru_size))
prt_i2('Metadata cache size (hard limit):',
f_perc(meta_limit, arc_max), f_bytes(meta_limit))
prt_i2('Metadata cache size (current):',
f_perc(meta_size, meta_limit), f_bytes(meta_size))
prt_i2('Dnode cache size (hard limit):',
f_perc(dnode_limit, meta_limit), f_bytes(dnode_limit))
prt_i2('Dnode cache size (current):',
f_perc(dnode_size, dnode_limit), f_bytes(dnode_size))
print()

print('ARC hash breakdown:')
Expand Down

0 comments on commit e8a8208

Please sign in to comment.