高级测试策略
多维度测试方法
传统的ping测试只能反映基本的连通性,进阶优化需要考虑更多维度:
1. HTTP响应时间测试
#!/bin/bash
# 高级HTTP测试脚本
test_http_response() {
local ip=$1
local domain=$2
curl -w "@curl-format.txt" \
-o /dev/null \
-s \
--resolve $domain:443:$ip \
https://$domain/ \
--connect-timeout 10 \
--max-time 30
}
# curl-format.txt 内容
echo "time_namelookup: %{time_namelookup}s
time_connect: %{time_connect}s
time_appconnect: %{time_appconnect}s
time_pretransfer: %{time_pretransfer}s
time_redirect: %{time_redirect}s
time_starttransfer: %{time_starttransfer}s
time_total: %{time_total}s
speed_download: %{speed_download} bytes/s" > curl-format.txt
2025年1月15日...大约 5 分钟