Add an NS1-host NATS study: run, charts, methodology, and tuning notes.
Some checks are pending
offline / test (push) Waiting to run
Some checks are pending
offline / test (push) Waiting to run
Second ladder executed entirely on NS1.GEORGELAMBERT.ORG (70.88.205.138) against LXC 511–513; HTML and PDF built on that host.
This commit is contained in:
parent
de20a42109
commit
c5d286dc6b
54 changed files with 4665 additions and 13 deletions
91
packages/verae-nats-cluster/scripts/study-on-ns1.sh
Executable file
91
packages/verae-nats-cluster/scripts/study-on-ns1.sh
Executable file
|
|
@ -0,0 +1,91 @@
|
|||
#!/usr/bin/env bash
|
||||
# Full message-speed study. Must run ON NS1.GEORGELAMBERT.ORG (70.88.205.138).
|
||||
# Orchestration, nats bench (via pct into LXC 510), charts, HTML, and PDF all
|
||||
# happen on this host. The laptop is not in the measurement path.
|
||||
set -euo pipefail
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
export PATH="/usr/sbin:/usr/bin:/bin:/usr/local/bin:$PATH"
|
||||
|
||||
HOST="$(hostname -f 2>/dev/null || hostname)"
|
||||
case "$HOST" in
|
||||
NS1.GEORGELAMBERT.ORG|NS1|ns1.georgelambert.org|ns1) ;;
|
||||
*)
|
||||
echo "refusing: study-on-ns1.sh must run on NS1.GEORGELAMBERT.ORG (70.88.205.138), got '$HOST'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
. "$ROOT/client.env"
|
||||
CLIENT_VMID="${CLIENT_VMID:-510}"
|
||||
STAMP="$(date -u +%Y%m%dT%H%M%SZ)"
|
||||
OUT="${BENCH_OUT:-$ROOT/results/$STAMP}"
|
||||
mkdir -p "$OUT"
|
||||
|
||||
dump_env() {
|
||||
local tag="$1"
|
||||
local f="$OUT/host-$tag.txt"
|
||||
{
|
||||
echo "execution_host=NS1.GEORGELAMBERT.ORG"
|
||||
echo "execution_ip=70.88.205.138"
|
||||
echo "hostname=$(hostname)"
|
||||
echo "utc=$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
||||
echo "whoami=$(whoami)"
|
||||
echo "pwd=$(pwd)"
|
||||
echo "uname=$(uname -a)"
|
||||
echo "nproc=$(nproc)"
|
||||
echo "loadavg=$(cat /proc/loadavg)"
|
||||
echo "client_vmid=$CLIENT_VMID"
|
||||
echo "nats_url=$NATS_URL"
|
||||
echo "--- free ---"
|
||||
free -h
|
||||
echo "--- pct list ---"
|
||||
sudo pct list
|
||||
for v in 510 511 512 513; do
|
||||
echo "--- pct config $v ---"
|
||||
sudo pct config "$v" | grep -E '^(hostname|cores|memory|swap|rootfs|mp|net)' || true
|
||||
done
|
||||
} >"$f"
|
||||
python3 - "$OUT" "$tag" <<'PY'
|
||||
import json, sys, urllib.request
|
||||
from pathlib import Path
|
||||
out, tag = Path(sys.argv[1]), sys.argv[2]
|
||||
nodes = []
|
||||
for vmid, name in (("511", "nats-a"), ("512", "nats-b"), ("513", "nats-c")):
|
||||
raw = ""
|
||||
try:
|
||||
import subprocess
|
||||
raw = subprocess.check_output(
|
||||
["sudo", "pct", "exec", vmid, "--", "curl", "-fsS", "--max-time", "3", "http://127.0.0.1:8222/varz"],
|
||||
text=True,
|
||||
)
|
||||
d = json.loads(raw)
|
||||
nodes.append({
|
||||
"vmid": vmid,
|
||||
"name": name,
|
||||
"server_name": d.get("server_name"),
|
||||
"host": d.get("host"),
|
||||
"port": d.get("port"),
|
||||
"connections": d.get("connections"),
|
||||
"in_msgs": d.get("in_msgs"),
|
||||
"out_msgs": d.get("out_msgs"),
|
||||
"in_bytes": d.get("in_bytes"),
|
||||
"out_bytes": d.get("out_bytes"),
|
||||
"cpu": d.get("cpu"),
|
||||
"cores": d.get("cores"),
|
||||
"mem": d.get("mem"),
|
||||
"jetstream": bool(d.get("jetstream")),
|
||||
})
|
||||
except Exception as e:
|
||||
nodes.append({"vmid": vmid, "name": name, "error": str(e)})
|
||||
(out / f"varz-{tag}.json").write_text(json.dumps(nodes, indent=2) + "\n", encoding="utf-8")
|
||||
PY
|
||||
}
|
||||
|
||||
echo "NS1 study $STAMP out=$OUT"
|
||||
dump_env before
|
||||
BENCH_OUT="$OUT" CLIENT_VMID="$CLIENT_VMID" bash "$ROOT/scripts/bench.sh"
|
||||
dump_env after
|
||||
python3 "$ROOT/scripts/build-ns1-study-report.py" "$OUT"
|
||||
echo "NS1 study complete $OUT"
|
||||
ls -la "$OUT"/nats-cluster-bench-ns1.* "$OUT"/charts 2>/dev/null || ls -la "$OUT"
|
||||
Loading…
Add table
Add a link
Reference in a new issue