如何做網際網路的效能測試
如何做跨區線路測試,分析兩區域網路傳輸的狀況。例如 ap-southeast-1 到 us-east-1 的網路效率。
解題方向
在進行跨區的網路線路測試時,不考慮服務運行時間的情況下,可能會關注以下指標:
- 延遲(Latency):延遲是從發送請求到收到響應所需的時間。你會測試不同地區之間的平均延遲、最大延遲和最小延遲,以評估網路的反應速度。可使用工具
ping
、traceroute
、mtr
來做測試。 - 丟包率(Packet Loss Rate):丟包率是指在網絡傳輸過程中丟失的數據包的比率。你會關注丟包率的高低,因為高丟包率可能導致數據傳輸的不完整和延遲增加。可使用工具
ping
、traceroute
、mtr
來做測試。 - 頻寬利用率(Bandwidth Utilization):帶寬利用率是指在一定時間內使用的網絡帶寬的比率。你會測試網絡的帶寬利用率,以確保帶寬資源充足並且沒有過度使用。可用工具
iperf
、speedtest-cli
做測試。 - 往返時間(Round-Trip Time,RTT):RTT 是從發送一個數據包到收到對應的響應所需的時間。你會關注不同地區之間的平均 RTT,以評估網路的往返時間。可使用工具
ping
、traceroute
、mtr
、iperf
來做測試。 - 連通性和穩定性(Connectivity and Stability):你會測試不同地區之間的連通性和穩定性,確保網路連接的可靠性和持久性。可使用工具
ping
、traceroute
、mtr
來做測試。 - DNS 解析時間(DNS Resolution Time):DNS 解析時間是指從域名解析請求開始到獲得對應 IP 地址的時間。你會測試 DNS 解析時間,以評估域名解析的效率和穩定性。可使用工具
dig
、nslookup
來做測試。
收集資訊
DNS Resloutiime Time
1# Google
2root@ip-172-31-41-190:~# dig @8.8.8.8 example.com | grep Query
3;; Query time: 220 msec
4
5# Cloudflare
6root@ip-172-31-41-190:~# dig @1.1.1.1 example.com | grep Query
7;; Query time: 152 msec
Bandwidth
1# Display a list of speedtest.net servers sorted by distance
2root@ip-172-31-41-190:~# speedtest-cli --list
3Retrieving speedtest.net configuration...
417336) ETISALAT-UAE (Dubai, United Arab Emirates) [19.67 km]
533712) ETISALAT-UAE (Sharjah, United Arab Emirates) [32.80 km]
634238) ETISALAT-UAE (Ajman, United Arab Emirates) [42.82 km]
711271) Ooredoo Oman (Seeb, Oman) [330.64 km]
8 6193) Ooredoo Qatar (Doha, Qatar) [379.79 km]
936046) stc Bahrain (Seef, Bahrain) [489.93 km]
1025379) Mobily (Khobar, Saudi Arabia) [526.86 km]
1116051) Saudi Telecom Company (STC) (Dammam, Saudi Arabia) [528.27 km]
1217373) Salam (Dammam, Saudi Arabia) [528.27 km]
1324200) Saudi Telecom Company (STC) (Al Hofuf, Saudi Arabia) [575.26 km]
14
15root@ip-172-31-41-190:~# speedtest-cli
16Retrieving speedtest.net configuration...
17Testing from Amazon.com (51.112.52.76)...
18Retrieving speedtest.net server list...
19Selecting best server based on ping...
20Hosted by ETISALAT-UAE (Dubai) [19.67 km]: 5.772 ms
21Testing download speed................................................................................
22Download: 1908.86 Mbit/s
23Testing upload speed......................................................................................................
24Upload: 1475.68 Mbit/s
Request time
1root@ip-172-31-4-174:~# curl -4 -w "@curl-format.txt" -o /dev/null -s https://example.com/api
2time_namelookup: 0.155062
3time_connect: 0.351696
4time_appconnect: 0.586982
5time_pretransfer: 0.587111
6time_redirect: 0.000000
7time_starttransfer: 0.781766
8----------time_total: 0.781826
到 Server IP 1.2.3.4
的線路測試
1root@ip-172-31-41-190:~# traceroute -T 1.2.3.4
2traceroute to 1.2.3.4 (1.2.3.4), 30 hops max, 60 byte packets
3 1 * * *
4 2 240.1.24.4 (240.1.24.4) 0.211 ms 240.1.24.5 (240.1.24.5) 0.225 ms 0.486 ms
5 3 242.3.43.1 (242.3.43.1) 3.451 ms 242.3.43.5 (242.3.43.5) 2.972 ms 242.3.42.7 (242.3.42.7) 2.963 ms
6 4 52.93.68.29 (52.93.68.29) 1.320 ms 52.93.68.79 (52.93.68.79) 8.062 ms 52.93.68.97 (52.93.68.97) 0.557 ms
7 5 100.91.177.167 (100.91.177.167) 190.061 ms 100.106.85.41 (100.106.85.41) 191.664 ms 100.91.176.251 (100.91.176.251) 190.035 ms
8 6 * 240.0.184.13 (240.0.184.13) 1860.666 ms 240.0.236.34 (240.0.236.34) 1901.460 ms
9 7 242.2.212.33 (242.2.212.33) 191.295 ms 242.3.84.161 (242.3.84.161) 192.339 ms 242.3.85.33 (242.3.85.33) 191.432 ms
1root@ip-172-31-41-190:~# mtr -b -T -r -c 30 1.2.3.4
2Start: 2024-05-09T10:16:58+0000
3HOST: ip-172-31-41-190 Loss% Snt Last Avg Best Wrst StDev
4 1.|-- ??? 100.0 30 0.0 0.0 0.0 0.0 0.0
5 2.|-- 240.1.24.5 0.0% 30 0.3 0.3 0.3 0.4 0.0
6 240.1.24.4
7 240.1.24.7
8 240.1.24.6
9 3.|-- 242.3.42.135 0.0% 30 2.8 5.7 2.5 20.4 5.0
10 242.3.42.129
11 242.3.43.3
12 242.3.43.7
13 242.3.43.133
14 242.3.43.131
15 242.3.43.1
16 242.3.42.131
17 4.|-- 52.93.68.95 0.0% 30 0.7 4.7 0.6 21.9 5.5
18 52.93.68.93
19 52.93.68.45
20 52.93.68.125
21 52.93.68.79
22 52.93.68.129
23 52.93.68.143
24 52.93.68.65
25 5.|-- 100.106.85.13 0.0% 30 193.4 193.8 190.2 211.9 5.0
26 100.91.177.73
27 100.91.176.243
28 100.91.177.5
29 100.91.176.221
30 100.91.177.93
31 100.106.86.73
32 100.106.85.1
33 100.91.177.113
1root@ip-172-31-41-190:~# iperf3 -t 30 -c 1.2.3.4 -p 31987
2Connecting to host 1.2.3.4, port 31987
3[ 5] local 172.31.41.190 port 42998 connected to 1.2.3.4 port 31987
4[ ID] Interval Transfer Bitrate Retr Cwnd
5[ 5] 0.00-1.00 sec 2.25 MBytes 18.9 Mbits/sec 0 440 KBytes
6[ 5] 1.00-2.00 sec 9.81 MBytes 82.3 Mbits/sec 61 3.88 MBytes
7[ 5] 2.00-3.00 sec 10.0 MBytes 83.9 Mbits/sec 303 2.84 MBytes
8[ 5] 3.00-4.00 sec 13.8 MBytes 115 Mbits/sec 0 3.05 MBytes
9[ 5] 4.00-5.00 sec 15.0 MBytes 126 Mbits/sec 0 3.05 MBytes
10[ 5] 5.00-6.00 sec 16.2 MBytes 136 Mbits/sec 0 3.05 MBytes
11[ 5] 6.00-7.00 sec 15.0 MBytes 126 Mbits/sec 0 3.05 MBytes
12[ 5] 7.00-8.00 sec 15.0 MBytes 126 Mbits/sec 0 3.05 MBytes
13[ 5] 8.00-9.00 sec 15.0 MBytes 126 Mbits/sec 0 3.05 MBytes
14[ 5] 9.00-10.00 sec 13.8 MBytes 115 Mbits/sec 0 3.05 MBytes
15[ 5] 10.00-11.00 sec 16.2 MBytes 136 Mbits/sec 0 3.05 MBytes
16[ 5] 11.00-12.00 sec 16.2 MBytes 136 Mbits/sec 0 3.05 MBytes
17[ 5] 12.00-13.00 sec 15.0 MBytes 126 Mbits/sec 0 3.05 MBytes
18[ 5] 13.00-14.00 sec 13.8 MBytes 115 Mbits/sec 0 3.05 MBytes
19[ 5] 14.00-15.00 sec 15.0 MBytes 126 Mbits/sec 0 3.05 MBytes
20[ 5] 15.00-16.00 sec 15.0 MBytes 126 Mbits/sec 0 3.05 MBytes
21[ 5] 16.00-17.00 sec 16.2 MBytes 136 Mbits/sec 0 3.05 MBytes
22[ 5] 17.00-18.00 sec 15.0 MBytes 126 Mbits/sec 0 3.05 MBytes
23[ 5] 18.00-19.00 sec 15.0 MBytes 126 Mbits/sec 0 3.05 MBytes
24[ 5] 19.00-20.00 sec 15.0 MBytes 126 Mbits/sec 0 3.05 MBytes
25[ 5] 20.00-21.00 sec 13.8 MBytes 115 Mbits/sec 0 3.05 MBytes
26[ 5] 21.00-22.00 sec 15.0 MBytes 126 Mbits/sec 0 3.05 MBytes
27[ 5] 22.00-23.00 sec 16.2 MBytes 136 Mbits/sec 0 3.05 MBytes
28[ 5] 23.00-24.00 sec 16.2 MBytes 136 Mbits/sec 0 3.05 MBytes
29[ 5] 24.00-25.00 sec 13.8 MBytes 115 Mbits/sec 0 3.05 MBytes
30[ 5] 25.00-26.00 sec 15.0 MBytes 126 Mbits/sec 0 3.05 MBytes
31[ 5] 26.00-27.00 sec 15.0 MBytes 126 Mbits/sec 0 3.05 MBytes
32[ 5] 27.00-28.00 sec 16.2 MBytes 136 Mbits/sec 0 3.05 MBytes
33[ 5] 28.00-29.00 sec 15.0 MBytes 126 Mbits/sec 0 3.05 MBytes
34[ 5] 29.00-30.00 sec 15.0 MBytes 126 Mbits/sec 0 3.05 MBytes
35- - - - - - - - - - - - - - - - - - - - - - - - -
36[ ID] Interval Transfer Bitrate Retr
37[ 5] 0.00-30.00 sec 430 MBytes 120 Mbits/sec 364 sender
38[ 5] 0.00-30.19 sec 429 MBytes 119 Mbits/sec receiver