如何解決 Direct Connect 網路效能問題?

5 分的閱讀內容
0

我的 AWS Direct Connect 連線遇到低輸送量、流量延遲和效能問題。

解決方案

按照以下説明來隔離和診斷網路及應用程式效能問題。

**注意:**最佳實務是設定內部部署專用測試機器和 Amazon Virtual Private Cloud (Amazon VPC)。使用大小為 C5 或更大的 Elastic Compute Cloud (Amazon EC2) 執行個體類型

網路或應用程式問題

您可以安裝和使用 iPerf3 工具對網路頻寬進行基準測試,並與其他應用程式或工具交叉檢查結果。

1.    Linux/REHEL 安裝:

$ sudo yum install iperf3 -y

Ubuntu 安裝:

$ sudo apt install iperf3 -y

2.    在用戶端和伺服器上執行 iPerf3 以雙向測量輸送量,如下所示:

Amazon EC2 執行個體 (伺服器):

$ iperf3 -s -V

內部部署本地主機 (用戶端):

$ iperf3 -c <private IP of EC2> -P 15 -t 15
$ iperf3 -c <private IP of EC2> -P 15 -t 15 -R

$ iperf3 -c <private IP of EC2> -w 256K
$ iperf3 -c <private IP of EC2> -w 256K -R

$ iperf3 -c <private IP of EC2> -u -b 1G -t 15
$ iperf3 -c <private IP of EC2> -u -b 1G -t 15 -R 

----------------
-P, --parallel n
    number of parallel client threads to run; It is critical to run multi-threads to achieve the max throughput.
-R, --reverse
    reverse the direction of a test. So the EC2 server sends data to the on-prem client to measure AWS -> on-prem throughput.
-u, --udp
    use UDP rather than TCP. Since TCP iperf3 does not report loss, UDP tests are helpful to see the packet loss along a path.

TCP 測試結果範例:

[ ID] Interval          Transfer      Bitrate        Retry
[SUM] 0.00-15.00  sec  7.54 GBytes  4.32 Gbits/sec   18112   sender
[SUM] 0.00-15.00  sec  7.52 GBytes  4.31 Gbits/sec           receiver

位元速率 – 測得的輸送量或傳輸速度。

傳輸 – 用戶端和伺服器之間交換的資料總量。

重試 – 重新傳輸的封包數。可在寄件者一方觀察到重新傳輸。

UDP 測試結果範例:

[ ID] Interval           Transfer     Bitrate         Jitter    Lost/Total Datagrams
[  5] 0.00-15.00  sec  8.22 GBytes   4.71 Gbits/sec  0.000 ms   0/986756 (0%)  sender
[  5] 0.00-15.00  sec  1.73 GBytes   989 Mbits/sec   0.106 ms   779454/986689 (79%)  receiver

由於傳送了最大數量的 UDP 資料包,寄件者一方的遺失率為 0%。

接收者一方的資料包遺失率/總數表示遺失的封包數和遺失率。在此範例中,79% 的網路流量遺失。

**注意:**如果 Direct Connect 透過公有虛擬介面 (VIF) 使用 Amazon 虛擬私有網路 (Amazon VPN),則在沒有 VPN 的情況下執行效能測試。

檢查指標和介面計數器

檢查 Amazon CloudWatch Logs 以了解以下指標:

  • ConnectionErrorCount:套用統計數字加總,注意非零值表示 AWS 裝置上存在 MAC 級別錯誤。
  • ConnectionLightLevelTx 和 ConnectionLightLevelRx:確定光訊號讀數介於 -14.4 至 2.50 dBm 之間。
  • ConnectionBpsEgress、ConnectionBpsIngress、VirtualInterfaceBpsEgress 和 VirtualInterfaceBpsIngress:確定位元速率未達到最大頻寬。

如需詳細資訊,請參閲 Direct Connect 指標和維度

如果您使用的是與其他使用者共用總頻寬的託管虛擬介面 (託管 VIF),請與 Direct Connect 擁有者核實連線利用率。

針對以下項目檢查 Direct Connect 位置的路由器和防火牆:

  • CPU、記憶體、連接埠利用率、丟棄數、捨棄數。
  • 使用「顯示介面統計數字」或類似功能檢查介面輸入和輸出錯誤,如 CRC、影格、衝突和載波。
  • 清潔或更換磨損計數器的光纖跳接電纜和 SFP 模組。

檢查 AWS Personal Health Dashboard 以確定 Direct Connect 連線未在維護狀態。

雙向執行 MTR 以檢查網路路徑

您可以使用 Linux MTR 命令來分析網路效能。對於 Windows 作業系統,最佳實務是啟用 WSL 2,以便您可以在 Linux 子系統上安裝 MTR。您可以從 SourceForge 網站下載 WinMTR。

1.    Amazon Linux/REHEL 安裝:

$ sudo yum install mtr -y

Ubuntu 安裝:

$ sudo apt install mtr -y

2.    對於內部部署 --> AWS 方向,在本地主機上執行 MTR (基於 ICMP 和 TCP):

$ mtr -n -c 100 <private IP of EC2> --report
$ mtr -n -T -P <EC2 instance open TCP port> -c 100 <private IP of EC2> --report

3.    對於 AWS --> 內部部署方向,在 EC2 執行個體上執行 MTR (基於 ICMP 和 TCP):

$ mtr -n -c 100 <private IP of the local host> --report
$ mtr -n -T -P <local host open TCP port> -c 100 <private IP of the local host> --report

MTR 測試結果範例:

#ICMP based MTR results
$ mtr -n -c 100 192.168.52.10 --report
Start: Sat Oct 30 20:54:39 2021
HOST:                             Loss%   Snt   Last   Avg  Best  Wrst StDev
  1.|-- 10.0.101.222               0.0%   100    0.7   0.7   0.6   0.9   0.0
  2.|-- ???                       100.0   100    0.0   0.0   0.0   0.0   0.0
  3.|-- 10.110.120.2               0.0%   100  266.5 267.4 266.4 321.0   4.8
  4.|-- 10.110.120.1              54.5%   100  357.6 383.0 353.4 423.7  19.6
  5.|-- 192.168.52.10             47.5%   100  359.4 381.3 352.4 427.9  20.6

#TCP based MTR results
$ mtr -n -T -P 80 -c 100 192.168.52.10 --report
Start: Sat Oct 30 21:03:48 2021
HOST:                             Loss%   Snt   Last   Avg  Best  Wrst StDev
  1.|-- 10.0.101.222               0.0%   100    0.9   0.7   0.7   1.1   0.0
  2.|-- ???                       100.0   100    0.0   0.0   0.0   0.0   0.0
  3.|-- 10.110.120.2               0.0%   100  264.1 265.8 263.9 295.3   3.4
  4.|-- 10.110.120.1               8.0%   100  374.3 905.3 354.4 7428. 1210.6
  5.|-- 192.168.52.10             12.0%   100  400.9 1139. 400.4 7624. 1384.3

每一躍點中的每一行表示資料封包從源傳遞到目的地的網路裝置。如需如何讀取 MTR 測試結果的詳細資訊,請參閲 ExaVault 網站

以下範例顯示了與 BGP 對等 10.110.120.1 和 10.110.120.2 的 Direct Connect 連線。在第 4 個和第 5 個目的地躍點上觀察到遺失百分比。這可能表示 Direct Connect 連線或遠端路由器 10.110.120.1 存在問題。TCP MTR 結果顯示遺失百分比較低,因為 TCP 的優先順序高於使用 Direct Connect 連線的 ICMP。

#ICMP based MTR results
$ mtr -n -c 100 192.168.52.10 --report
Start: Sat Oct 30 20:54:39 2021
HOST:                             Loss%   Snt   Last   Avg  Best  Wrst StDev
  1.|-- 10.0.101.222               0.0%   100    0.7   0.7   0.6   0.9   0.0
  2.|-- ???                       100.0   100    0.0   0.0   0.0   0.0   0.0
  3.|-- 10.110.120.2               0.0%   100  266.5 267.4 266.4 321.0   4.8
  4.|-- 10.110.120.1              54.5%   100  357.6 383.0 353.4 423.7  19.6
  5.|-- 192.168.52.10             47.5%   100  359.4 381.3 352.4 427.9  20.6

#TCP based MTR results
$ mtr -n -T -P 80 -c 100 192.168.52.10 --report
Start: Sat Oct 30 21:03:48 2021
HOST:                             Loss%   Snt   Last   Avg  Best  Wrst StDev
  1.|-- 10.0.101.222               0.0%   100    0.9   0.7   0.7   1.1   0.0
  2.|-- ???                       100.0   100    0.0   0.0   0.0   0.0   0.0
  3.|-- 10.110.120.2               0.0%   100  264.1 265.8 263.9 295.3   3.4
  4.|-- 10.110.120.1               8.0%   100  374.3 905.3 354.4 7428. 1210.6
  5.|-- 192.168.52.10             12.0%   100  400.9 1139. 400.4 7624. 1384.3

以下範例顯示本地防火牆或 NAT 裝置封包遺失率為 5%。封包遺失會影響所有後續躍點,包括目的地。

$ mtr -n -c 100 192.168.52.10 --report
Start: Sat Oct 30 21:11:22 2021
HOST:                              Loss%   Snt   Last   Avg  Best  Wrst StDev
  1.|-- 10.0.101.222               5.0%   100    0.8   0.7   0.7   1.1   0.0
  2.|-- ???                       100.0   100    0.0   0.0   0.0   0.0   0.0
  3.|-- 10.110.120.2               6.0%   100  265.7 267.1 265.6 307.8   5.1
  4.|-- 10.110.120.1               6.0%   100  265.1 265.2 265.0 265.4   0.0
  5.|-- 192.168.52.10              6.0%   100  266.7 266.6 266.5 267.2   0.0

擷取封包並分析結果

在本地主機和 EC2 執行個體上擷取封包。使用 tcpdumpWireshark 實用程式獲取網路流量以進行分析。以下 tcpdump 範例命令可獲取時間戳記和主機 IP 地址:

tcpdump -i <network interface> -s0 -w $(date +"%Y%m%d_%H%M%S").$(hostname -s).pcap port <port>

使用交換機網站上的 TCP 輸送量計算器來計算網路限制、頻寬時延乘積和 TCP 緩衝區大小。

如需詳細資訊,請參閲AWS Direct Connect 故障排除


相關資訊

託管虛擬介面 (VIF) 和託管連線有何區別?

AWS 官方
AWS 官方已更新 2 年前