From bed30228e4e8fa4286ae386facc785c3f63b46cd Mon Sep 17 00:00:00 2001 From: "Theera K." Date: Thu, 5 Sep 2024 16:11:34 +0700 Subject: [PATCH] arcstat: add structural, types, states breakdown add ARC structural breakdown, ARC types breakdown, ARC states breakdown similar to arc_summary Signed-off-by: Theera K. rename column names to fit 5 chars Signed-off-by: Theera K. rename column names to fit 5 chars Signed-off-by: Theera K. add data target, metadata target Signed-off-by: Theera K. add data target, metadata target Signed-off-by: Theera K. fix abd typo Signed-off-by: Theera K. fix abd typo Signed-off-by: Theera K. make column name a bit shorter Signed-off-by: Theera K. make column name a bit shorter Signed-off-by: Theera K. fix structural typo Signed-off-by: Theera K. Delete cmd/arc_summary.py incorrect file extension Signed-off-by: Theera K. fix structural typo Signed-off-by: Theera K. arcstat: add structural, types, states breakdown add ARC structural breakdown, ARC types breakdown, ARC states breakdown similar to arc_summary Signed-off-by: Theera K. Update arcstat: add Anonymous, MFU, MRU, Uncached Signed-off-by: Theera K. Update arcstat: add Anonymous, MFU, MRU, Uncached Signed-off-by: Theera K. Update arcstat: add Anonymous, MFU, MRU, Uncached Signed-off-by: Theera K. Update arcstat.1 : add mfusz, mrusz, l2wbytes Signed-off-by: Theera K. Update arcstat: add mfusz, mrusz, l2wbytes mfusz: MFU size mrusz: MRU size l2wbytes: Bytes write per second to the L2ARC Signed-off-by: Theera K. remove extra spaces Signed-off-by: Theera K. arcstat: add target size of data, meta, MFU, MRU arcstat: add target size of ARC data, ARC metadata, MFU, MRU Signed-off-by: Theera K. arcstat: add target size of data, meta, MFU, MRU arcstat: add target size of ARC data, ARC metadata, MFU, MRU Signed-off-by: Theera K. --- cmd/arc_summary | 2 +- cmd/arcstat.in | 119 ++++++++++++++++++++++++++++++++ man/man1/arcstat.1 | 166 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 286 insertions(+), 1 deletion(-) diff --git a/cmd/arc_summary b/cmd/arc_summary index 2d0bfddd93..c24d400fa3 100755 --- a/cmd/arc_summary +++ b/cmd/arc_summary @@ -566,7 +566,7 @@ def section_arc(kstats_dict): l2_hdr_size = arc_stats['l2_hdr_size'] abd_chunk_waste_size = arc_stats['abd_chunk_waste_size'] - prt_1('ARC structal breakdown (current size):', f_bytes(arc_size)) + prt_1('ARC structural breakdown (current size):', f_bytes(arc_size)) prt_i2('Compressed size:', f_perc(compressed_size, arc_size), f_bytes(compressed_size)) prt_i2('Overhead size:', diff --git a/cmd/arcstat.in b/cmd/arcstat.in index c4f10a1d6d..e66545b40f 100755 --- a/cmd/arcstat.in +++ b/cmd/arcstat.in @@ -152,6 +152,7 @@ cols = { "l2asize": [7, 1024, "Actual (compressed) size of the L2ARC"], "l2size": [6, 1024, "Size of the L2ARC"], "l2bytes": [7, 1024, "Bytes read per second from the L2ARC"], + "l2wbytes": [8, 1024, "Bytes written per second to the L2ARC"], "grow": [4, 1000, "ARC grow disabled"], "need": [5, 1024, "ARC reclaim need"], "free": [5, 1024, "ARC free memory"], @@ -169,6 +170,83 @@ cols = { "zactive": [7, 1000, "zfetch prefetches active per second"], } +# ARC structural breakdown from arc_summary +structfields = { + "cmp": ["compressed", "Compressed"], + "ovh": ["overhead", "Overhead"], + "bon": ["bonus", "Bonus"], + "dno": ["dnode", "Dnode"], + "dbu": ["dbuf", "Dbuf"], + "hdr": ["hdr", "Header"], + "l2h": ["l2_hdr", "L2 header"], + "abd": ["abd_chunk_waste", "ABD chunk waste"], +} +structstats = { # size stats + "percent": "size", # percentage of this value + "sz": ["_size", "size"], +} + +# ARC types breakdown from arc_summary +typefields = { + "data": ["data", "ARC data"], + "meta": ["metadata", "ARC metadata"], +} +typestats = { # size stats + "percent": "cachessz", # percentage of this value + "tg": ["_target", "target"], + "sz": ["_size", "size"], +} + +# ARC states breakdown from arc_summary +statefields = { + "ano": ["anon", "Anonymous"], + "mfu": ["mfu", "MFU"], + "mru": ["mru", "MRU"], + "unc": ["uncached", "Uncached"], +} +targetstats = { + "percent": "cachessz", # percentage of this value + "fields": ["mfu", "mru"], # only applicable to these fields + "tg": ["_target", "target"], + "dat": ["_data_target", "data target"], + "met": ["_metadata_target", "metadata target"], +} +statestats = { # size stats + "percent": "cachessz", # percentage of this value + "sz": ["_size", "size"], + "data": ["_data", "data size"], + "meta": ["_metadata", "metadata size"], + "eda": ["_evictable_data", "evictable data size"], + "eme": ["_evictable_metadata", "evictable metadata size"], +} +ghoststats = { + "fields": ["mfu", "mru"], # only applicable to these fields + "gsz": ["_ghost_size", "ghost size"], + "gda": ["_ghost_data", "ghost data size"], + "gme": ["_ghost_metadata", "ghost metadata size"], +} + +# fields and stats +fieldstats = [ + [structfields, structstats], + [typefields, typestats], + [statefields, targetstats, statestats, ghoststats], +] +for fs in fieldstats: + fields, stats = fs[0], fs[1:] + for field, fieldval in fields.items(): + for group in stats: + for stat, statval in group.items(): + if stat in ["fields", "percent"] or \ + ("fields" in group and field not in group["fields"]): + continue + colname = field + stat + coldesc = fieldval[1] + " " + statval[1] + cols[colname] = [len(colname), 1024, coldesc] + if "percent" in group: + cols[colname + "%"] = [len(colname) + 1, 100, \ + coldesc + " percentage"] + v = {} hdr = ["time", "read", "ddread", "ddh%", "dmread", "dmh%", "pread", "ph%", "size", "c", "avail"] @@ -286,6 +364,29 @@ def snap_stats(): kstat_update() cur = kstat + + # fill in additional values from arc_summary + cur["caches_size"] = caches_size = cur["anon_data"]+cur["anon_metadata"]+\ + cur["mfu_data"]+cur["mfu_metadata"]+cur["mru_data"]+cur["mru_metadata"]+\ + cur["uncached_data"]+cur["uncached_metadata"] + s = 4294967296 + pd = cur["pd"] + pm = cur["pm"] + meta = cur["meta"] + v = (s-int(pd))*(s-int(meta))/s + cur["mfu_data_target"] = v / 65536 * caches_size / 65536 + v = (s-int(pm))*int(meta)/s + cur["mfu_metadata_target"] = v / 65536 * caches_size / 65536 + v = int(pd)*(s-int(meta))/s + cur["mru_data_target"] = v / 65536 * caches_size / 65536 + v = int(pm)*int(meta)/s + cur["mru_metadata_target"] = v / 65536 * caches_size / 65536 + + cur["data_target"] = cur["mfu_data_target"] + cur["mru_data_target"] + cur["metadata_target"] = cur["mfu_metadata_target"] + cur["mru_metadata_target"] + cur["mfu_target"] = cur["mfu_data_target"] + cur["mfu_metadata_target"] + cur["mru_target"] = cur["mru_data_target"] + cur["mru_metadata_target"] + for key in cur: if re.match(key, "class"): continue @@ -506,6 +607,7 @@ def calculate(): global d global v global l2exist + global fieldstats v = dict() v["time"] = time.strftime("%H:%M:%S", time.localtime()) @@ -613,6 +715,22 @@ def calculate(): v["zissued"] = d["zfetch_io_issued"] // sint v["zactive"] = d["zfetch_io_active"] // sint + # ARC structural breakdown, ARC types breakdown, ARC states breakdown + v["cachessz"] = cur["caches_size"] + for fs in fieldstats: + fields, stats = fs[0], fs[1:] + for field, fieldval in fields.items(): + for group in stats: + for stat, statval in group.items(): + if stat in ["fields", "percent"] or \ + ("fields" in group and field not in group["fields"]): + continue + colname = field + stat + v[colname] = cur[fieldval[0] + statval[0]] + if "percent" in group: + v[colname + "%"] = 100 * v[colname] // \ + v[group["percent"]] if v[group["percent"]] > 0 else 0 + if l2exist: v["l2hits"] = d["l2_hits"] // sint v["l2miss"] = d["l2_misses"] // sint @@ -623,6 +741,7 @@ def calculate(): v["l2asize"] = cur["l2_asize"] v["l2size"] = cur["l2_size"] v["l2bytes"] = d["l2_read_bytes"] // sint + v["l2wbytes"] = d["l2_write_bytes"] // sint v["l2pref"] = cur["l2_prefetch_asize"] v["l2mfu"] = cur["l2_mfu_asize"] diff --git a/man/man1/arcstat.1 b/man/man1/arcstat.1 index 82358fa686..1c8958e3a5 100644 --- a/man/man1/arcstat.1 +++ b/man/man1/arcstat.1 @@ -199,10 +199,176 @@ Size of the L2ARC mutex_miss per second .It Sy l2bytes Bytes read per second from the L2ARC +.It Sy l2wbytes +Bytes written per second to the L2ARC .It Sy l2miss% L2ARC access miss percentage .It Sy l2asize Actual (compressed) size of the L2ARC +.It Sy cmpsz +Compressed size +.It Sy cmpsz% +Compressed size percentage +.It Sy ovhsz +Overhead size +.It Sy ovhsz% +Overhead size percentage +.It Sy bonsz +Bonus size +.It Sy bonsz% +Bonus size percentage +.It Sy dnosz +Dnode size +.It Sy dnosz% +Dnode size percentage +.It Sy dbusz +Dbuf size +.It Sy dbusz% +Dbuf size percentage +.It Sy hdrsz +Header size +.It Sy hdrsz% +Header size percentage +.It Sy l2hsz +L2 header size +.It Sy l2hsz% +L2 header size percentage +.It Sy abdsz +ABD chunk waste size +.It Sy abdsz% +ABD chunk waste size percentage +.It Sy datatg +ARC data target +.It Sy datatg% +ARC data target percentage +.It Sy datasz +ARC data size +.It Sy datasz% +ARC data size percentage +.It Sy metatg +ARC metadata target +.It Sy metatg% +ARC metadata target percentage +.It Sy metasz +ARC metadata size +.It Sy metasz% +ARC metadata size percentage +.It Sy anosz +Anonymous size +.It Sy anosz% +Anonymous size percentage +.It Sy anodata +Anonymous data size +.It Sy anodata% +Anonymous data size percentage +.It Sy anometa +Anonymous metadata size +.It Sy anometa% +Anonymous metadata size percentage +.It Sy anoeda +Anonymous evictable data size +.It Sy anoeda% +Anonymous evictable data size percentage +.It Sy anoeme +Anonymous evictable metadata size +.It Sy anoeme% +Anonymous evictable metadata size percentage +.It Sy mfutg +MFU target +.It Sy mfutg% +MFU target percentage +.It Sy mfudat +MFU data target +.It Sy mfudat% +MFU data target percentage +.It Sy mfumet +MFU metadata target +.It Sy mfumet% +MFU metadata target percentage +.It Sy mfusz +MFU size +.It Sy mfusz% +MFU size percentage +.It Sy mfudata +MFU data size +.It Sy mfudata% +MFU data size percentage +.It Sy mfumeta +MFU metadata size +.It Sy mfumeta% +MFU metadata size percentage +.It Sy mfueda +MFU evictable data size +.It Sy mfueda% +MFU evictable data size percentage +.It Sy mfueme +MFU evictable metadata size +.It Sy mfueme% +MFU evictable metadata size percentage +.It Sy mfugsz +MFU ghost size +.It Sy mfugda +MFU ghost data size +.It Sy mfugme +MFU ghost metadata size +.It Sy mrutg +MRU target +.It Sy mrutg% +MRU target percentage +.It Sy mrudat +MRU data target +.It Sy mrudat% +MRU data target percentage +.It Sy mrumet +MRU metadata target +.It Sy mrumet% +MRU metadata target percentage +.It Sy mrusz +MRU size +.It Sy mrusz% +MRU size percentage +.It Sy mrudata +MRU data size +.It Sy mrudata% +MRU data size percentage +.It Sy mrumeta +MRU metadata size +.It Sy mrumeta% +MRU metadata size percentage +.It Sy mrueda +MRU evictable data size +.It Sy mrueda% +MRU evictable data size percentage +.It Sy mrueme +MRU evictable metadata size +.It Sy mrueme% +MRU evictable metadata size percentage +.It Sy mrugsz +MRU ghost size +.It Sy mrugda +MRU ghost data size +.It Sy mrugme +MRU ghost metadata size +.It Sy uncsz +Uncached size +.It Sy uncsz% +Uncached size percentage +.It Sy uncdata +Uncached data size +.It Sy uncdata% +Uncached data size percentage +.It Sy uncmeta +Uncached metadata size +.It Sy uncmeta% +Uncached metadata size percentage +.It Sy unceda +Uncached evictable data size +.It Sy unceda% +Uncached evictable data size percentage +.It Sy unceme +Uncached evictable metadata size +.It Sy unceme% +Uncached evictable metadata size percentage .It Sy grow ARC grow disabled .It Sy need