补充 A 组(受控对照)的数据:39 分钟 100% 可用

用户要求停掉智能体,所以 A/B 对照只跑完了 A 组就收尾。
A 组数据(quic 8 + h2 2)是迄今最好的一段:

    可用率  142/142 = 100.00%
    耗时    最小 878  中位 1270  P90 2375  P99 4010  最大 8119 ms

P99 从 2 小时长测的 14242ms 降到 4010ms。

同时段连接数(36 个采样点):
    QUIC:   最低 5  最高 8  平均 7.2
            分布 {8条:21, 7条:8, 6条:1, 5条:6}
    HTTP/2: 最低 2  最高 2
    QUIC 塌陷(<=2 条): 0 次

**结论:QUIC 塌陷是间歇性的,不是每小时必发生。**
20:30~21:09 这段一次没塌;早些时候那 1 小时 44 分里塌了 2 次
(17:31、17:57)。这解释了短样本看到 100% 的原因 ——
不是数据好看,是那段确实没遇到链路抖动。

B 组(quic 6 + h2 4)没跑成,所以"要不要把 h2 提到 4 条"
这个问题本轮没有答案。但已有的证据(塌陷时 h2=2 从没掉到 0)
说明当前配置的兜底是够的。

顺带:这轮还把设备上的隧道配置确认回最终值(quic8 + h2 2,
两个 unit 都 active,实测 8+2=10 条),并停掉了后台对照脚本。
This commit is contained in:
xmz7891
2026-10-07 21:10:29 +08:00
parent acc636742a
commit accd0fae3f
6 changed files with 207 additions and 1 deletions
+45
View File
@@ -0,0 +1,45 @@
#!/bin/bash
# 恢复成 A 组(quic 8 + http2 2)—— task-3 要求跑完保持现状
set -u
MAIN=/etc/systemd/system/lanremote-tunnel.service
H2=/etc/systemd/system/lanremote-tunnel-h2.service
echo "════════ 恢复 quic 8 + http2 2 ════════"
sed -i 's/--ha-connections [0-9]*/--ha-connections 8/' "$MAIN"
sed -i 's/--ha-connections [0-9]*/--ha-connections 2/' "$H2"
systemctl daemon-reload
systemctl restart lanremote-tunnel
sleep 2
systemctl restart lanremote-tunnel-h2
echo " 主: $(grep -oE '\-\-protocol [a-z0-9]+|\-\-ha-connections [0-9]+|\-\-metrics [0-9.:]+' "$MAIN" | tr '\n' ' ')"
echo " 副: $(grep -oE '\-\-protocol [a-z0-9]+|\-\-ha-connections [0-9]+|\-\-metrics [0-9.:]+' "$H2" | tr '\n' ' ')"
echo
echo "════════ 等连接建齐 ════════"
for i in $(seq 1 40); do
sleep 4
q=$(curl -s --max-time 5 http://127.0.0.1:20241/metrics 2>/dev/null | grep '^cloudflared_tunnel_ha_connections' | awk '{print $2}')
h=$(curl -s --max-time 5 http://127.0.0.1:20242/metrics 2>/dev/null | grep '^cloudflared_tunnel_ha_connections' | awk '{print $2}')
q=${q:-0}; h=${h:-0}
[ $((q + h)) -ge 8 ] && break
done
echo " quic=$q http2=$h 合计=$((q + h))"
echo
echo "════════ 公网确认 ════════"
for i in $(seq 1 15); do
c=$(curl -s -o /dev/null -w '%{http_code}' --max-time 15 -H 'User-Agent: LanRemote/1.8.2' https://relay.xxmxxs.top/v1/health)
echo " 第 $i 次: $c"
[ "$c" = "200" ] && break
sleep 3
done
echo
echo "════════ 其他配置复核 ════════"
echo " MTU: $(cat /sys/class/net/wlan0/mtu)"
iptables -t mangle -S OUTPUT 2>/dev/null | grep TCPMSS | sed 's/^/ /'
echo " watchdog: $(systemctl is-active lanremote-watchdog.timer) $(wc -l < /root/lanremote-relay/watchdog.sh) 行"
grep -E '^THRESHOLD' /root/lanremote-relay/watchdog.sh | sed 's/^/ /'
echo " relay 长轮询: $(grep -oE 'RELAY_POLL=[0-9]+' /etc/systemd/system/lanremote-relay.service 2>/dev/null)"
echo " relay 版本: $(curl -s --max-time 10 http://127.0.0.1:8080/v1/health | python3 -c 'import sys,json; print(json.load(sys.stdin).get("version"))' 2>/dev/null)"