Files
ykxmz/_build/chk_poll30.sh
T
xmz7891 4cc368431c 新增 docs/优化实测数据.md:本轮所有优化的实测数字汇总
每一项都写清楚「改之前是多少、改之后是多少、怎么测的、受什么限制」,
以后有人问「这个改动到底有没有用」能直接翻数字,不用靠感觉。

内容包括:
  * 测量方法上的两个坑(从哪台机器测差很多、curl -I 验证 GET 是错的)
  * 下载吞吐 41 倍(含改之前/之后对照)
  * 隧道稳定性:配比对照表、QUIC 72% 拨号率的真因、
    MTU 1400 的效果、长时可用率
  * 长轮询 30 次数据(中位 61439ms)
  * 端到端延迟:局域网 0ms vs 本地中转 15ms
  * 局域网优化的四个真问题
  * 「按一下没反应」的完整证据链和根因
  * 独立验证发现的 9 个问题
  * 测试工具自己骗人的两次
  * 服务端部署脚本的三套测试
  * **没做到的部分**(98.5% 可用率的物理限制,如实记录)

这份是内部工程文档,已加进对外清洁度检查的允许清单
(和 docs/项目规矩.md、docs/双平台发布.md 同类)。
2026-10-07 19:02:57 +08:00

64 lines
2.0 KiB
Bash

#!/bin/bash
# 看 relay-stability 的 30 次长轮询结果(目标 2)
set -u
echo " ── 汇总文件 ──"
[ -f /root/rp_poll30_summary.txt ] && cat /root/rp_poll30_summary.txt | sed 's/^/ /'
echo
echo " ── 明细(前 5 行看格式)──"
[ -f /root/rp_poll30.tsv ] && head -5 /root/rp_poll30.tsv | sed 's/^/ /'
echo
echo " ── 自己再算一遍 ──"
python3 - <<'PYEOF'
from pathlib import Path
p = Path("/root/rp_poll30.tsv")
if not p.is_file():
print(" 没有文件")
raise SystemExit(0)
rows = []
for line in p.read_text(encoding="utf-8", errors="replace").splitlines():
line = line.strip()
if not line:
continue
parts = [x.strip() for x in line.replace(",", "\t").split("\t") if x.strip()]
if not parts:
continue
# 找出状态码和耗时
code = None
ms = None
for x in parts:
if x in ("200", "502", "530", "000", "401", "504"):
code = x
elif x.replace(".", "").isdigit() and "." not in x and len(x) >= 4:
try:
v = int(x)
if 500 <= v <= 300000 and ms is None:
ms = v
except ValueError:
pass
if code:
rows.append((code, ms))
if not rows:
print(" 解析不出样本,原始内容:")
print(p.read_text(encoding="utf-8", errors="replace")[:400])
raise SystemExit(0)
total = len(rows)
ok = sum(1 for c, _m in rows if c == "200")
print(" 样本 %d,成功 %d,可用率 %.1f%%" % (total, ok, ok * 100.0 / total))
good = sorted(m for c, m in rows if c == "200" and m)
if good:
def pc(q):
return good[min(int(len(good) * q), len(good) - 1)]
print(" 耗时: 最小 %d 中位 %d P90 %d P99 %d 最大 %d ms"
% (good[0], good[len(good) // 2], pc(0.9), pc(0.99), good[-1]))
print(" (理想值 = 60000 + 隧道开销;>90000 的算异常长尾)")
outliers = [m for m in good if m > 90000]
print(" 异常长尾(>90 秒): %d 次 %s" % (len(outliers), outliers))
PYEOF