R-1338 memory figure + Plex fixtures + Wanderer entry re-measure
This commit is contained in:
1 parent
0baf8f9485
commit
3671802c29
7 files changed
+390
-14
No files matched your search
+24
-8
@@ -23,6 +23,7 @@ The walk, per `09` §6.4 and the update-night brief §4:
|
||||
`inconclusive` is a first-class verdict and is NEVER collapsed into `failed`.
|
||||
"""
|
||||
import argparse, json, os, re, subprocess, sys, time
|
||||
from memfigure import anon_live # R-1338: the soak's memory figure, shared with upgrade-test.py
|
||||
from datetime import datetime, timezone
|
||||
|
||||
SC = os.environ.get('SC', os.path.expanduser('~/.felhom-retest'))
|
||||
@@ -733,13 +734,16 @@ while :; do
|
||||
rc=$(docker inspect -f '{{{{.RestartCount}}}}' $id); run=$(docker inspect -f '{{{{.State.Running}}}}' $id)
|
||||
start=$(docker inspect -f '{{{{.State.StartedAt}}}}' $id); oomk=$(docker inspect -f '{{{{.State.OOMKilled}}}}' $id)
|
||||
cg=""; for c in /sys/fs/cgroup/system.slice/docker-$full.scope /sys/fs/cgroup/docker/$full; do [ -d "$c" ] && cg=$c; done
|
||||
anon=0; mx=max; pk=0; ok=0
|
||||
anon=0; fl=0; af=0; inf=0; aa=0; ia=0; sh=0; mx=max; pk=0; ok=0
|
||||
if [ -n "$cg" ]; then
|
||||
anon=$(awk '$1=="anon"{{print $2}}' $cg/memory.stat); mx=$(cat $cg/memory.max)
|
||||
fl=$(awk '$1=="file"{{print $2}}' $cg/memory.stat); af=$(awk '$1=="active_file"{{print $2}}' $cg/memory.stat)
|
||||
inf=$(awk '$1=="inactive_file"{{print $2}}' $cg/memory.stat); aa=$(awk '$1=="active_anon"{{print $2}}' $cg/memory.stat)
|
||||
ia=$(awk '$1=="inactive_anon"{{print $2}}' $cg/memory.stat); sh=$(awk '$1=="shmem"{{print $2}}' $cg/memory.stat)
|
||||
pk=$(cat $cg/memory.peak 2>/dev/null || echo 0); ok=$(awk '$1=="oom_kill"{{print $2}}' $cg/memory.events)
|
||||
fi
|
||||
printf '{{"t":%s,"c":"%s","anon":%s,"max":"%s","peak":%s,"oom_kill":%s,"restarts":%s,"running":"%s","started":"%s","oomkilled":"%s","cg":"%s"}}\\n' \\
|
||||
"$(date +%s)" "$nm" "${{anon:-0}}" "$mx" "${{pk:-0}}" "${{ok:-0}}" "$rc" "$run" "$start" "$oomk" "$cg"
|
||||
printf '{{"t":%s,"c":"%s","anon":%s,"file":%s,"active_file":%s,"inactive_file":%s,"active_anon":%s,"inactive_anon":%s,"shmem":%s,"max":"%s","peak":%s,"oom_kill":%s,"restarts":%s,"running":"%s","started":"%s","oomkilled":"%s","cg":"%s"}}\\n' \\
|
||||
"$(date +%s)" "$nm" "${{anon:-0}}" "${{fl:-0}}" "${{af:-0}}" "${{inf:-0}}" "${{aa:-0}}" "${{ia:-0}}" "${{sh:-0}}" "$mx" "${{pk:-0}}" "${{ok:-0}}" "$rc" "$run" "$start" "$oomk" "$cg"
|
||||
done
|
||||
[ "$(date +%s)" -ge "$end" ] && break
|
||||
sleep {int(interval)}
|
||||
@@ -752,12 +756,21 @@ done
|
||||
samples.append(json.loads(line))
|
||||
except ValueError:
|
||||
continue
|
||||
return soak_summary(samples, seconds, interval)
|
||||
|
||||
|
||||
def soak_summary(samples, seconds, interval):
|
||||
"""The soak's samples → the per-container record. The mark's figure (peak_pct) is the LIVE anon (R-1338,
|
||||
memfigure.anon_live: `anon` without the pages the app already gave back); `anon_peak_pct` stays beside it.
|
||||
Pinned by test_memory_live.py."""
|
||||
per = {}
|
||||
for s in samples:
|
||||
c = per.setdefault(s["c"], {"samples": 0, "anon_peak": 0, "cg_peak": 0, "limit": None, "oom_kill": [],
|
||||
c = per.setdefault(s["c"], {"samples": 0, "anon_peak": 0, "live_peak": 0, "cg_peak": 0, "limit": None, "oom_kill": [],
|
||||
"restarts": [], "running": [], "started": set(), "oomkilled": False, "cgroup": s["cg"]})
|
||||
c["samples"] += 1
|
||||
c["anon_peak"] = max(c["anon_peak"], int(s["anon"]))
|
||||
live = anon_live(s)
|
||||
c["live_peak"] = max(c["live_peak"], int(live if live is not None else s["anon"]))
|
||||
c["cg_peak"] = max(c["cg_peak"], int(s["peak"]))
|
||||
c["limit"] = int(s["max"]) if str(s["max"]).isdigit() else None
|
||||
c["oom_kill"].append(int(s["oom_kill"]))
|
||||
@@ -774,15 +787,18 @@ done
|
||||
kills += k + (1 if c["oomkilled"] else 0)
|
||||
restarts += r
|
||||
pct = round(100.0 * c["anon_peak"] / c["limit"], 1) if c["limit"] else None
|
||||
live_pct = round(100.0 * c["live_peak"] / c["limit"], 1) if c["limit"] else None
|
||||
cgp = round(100.0 * c["cg_peak"] / c["limit"], 1) if c["limit"] else None
|
||||
if pct is not None:
|
||||
peaks.append(pct)
|
||||
if live_pct is not None:
|
||||
peaks.append(live_pct)
|
||||
res["containers"][nm] = {"samples": c["samples"], "anon_peak_bytes": c["anon_peak"], "limit_bytes": c["limit"],
|
||||
"anon_peak_pct": pct, "cgroup_peak_pct": cgp, "oom_kill_delta": k,
|
||||
"anon_peak_pct": pct, "anon_live_peak_bytes": c["live_peak"], "anon_live_peak_pct": live_pct,
|
||||
"cgroup_peak_pct": cgp, "oom_kill_delta": k,
|
||||
"oom_killed_flag": c["oomkilled"], "restarts_delta": r,
|
||||
"running_all_samples": all(c["running"]), "cgroup": c["cgroup"]}
|
||||
res["oom_kills"], res["restarts"] = kills, restarts
|
||||
res["peak_pct"] = max(peaks) if peaks else None
|
||||
res["peak_pct"] = max(peaks) if peaks else None # the live anon figure (R-1338)
|
||||
res["peak_basis"] = "anon_live"
|
||||
return res
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user