量化 DNS 环节
量化 DNS 环节
curl -s -o /dev/null -w 'DNS %{time_namelookup}s 连接 %{time_connect}s\n' https://www.example.com
time getent hosts www.example.com
# 逐台 DNS 测响应:
for s in $(grep -E '^nameserver' /etc/resolv.conf | awk '{print $2}'); do echo "== $s"; dig +time=3 +tries=1 @$s +noall +stats www.example.com | grep 'Query time'; done典型症状:curl 输出里 time_connect 远大于 RTT×3(说明握手前卡在解析/连接排队);应用日志显示随机 5 秒级超时(glibc 每台 DNS 5 秒超时)。