| 场景 | 接口/页面性能瓶颈定位 |
|---|---|
| 组合 | curl -w 分段计时 + 结果汇总 |
单次分解
单次分解
curl -sS -o /dev/null -w 'dns=%{time_namelookup} conn=%{time_connect} tls=%{time_appconnect} ttfb=%{time_starttransfer} total=%{time_total} size=%{size_download}\n' https://example.com/批量对比
批量对比
while read -r url; do
curl -sS -o /dev/null --max-time 10 -w '%{time_total} %{time_starttransfer} %{time_connect} %{http_code} ' "$url"
echo "$url"
done < urls.txt | sort -rn | head各段含义:namelookup=DNS;connect=TCP 握手(含 DNS);appconnect=TLS;starttransfer=首字节;total=整体。