Quantcast
Channel: Network – Benjr.tw
Viewing all articles
Browse latest Browse all 56

Network 效能測試與調整

$
0
0

Network performance utilities

檢視網路效能的工具有區分軟體類的以及硬體類的.

  • Software based
    Iperf ,Netperf ,NTttcp ,IxChariot
  • Hardware based
    Spirent Smartbits 1G , Test center 10G , Ixia – – IxNetwork

如何使用請自行參考下面連結

  • 網路效能測試工具 – iperf
  • 另外一套專業級的網路效能測試工具 –IxChariot
    IXIA系列的 IxAutomate, IxExplorer, IxLoad
  • smartbits / TestCenter 是一套專門用來檢視網路設備的硬體檢測裝置,是由 SPIRENT 這一家公司所提供主要可以用來檢視網卡或是 switch 等網路裝置 smartbits / TestCenter
  • nttcp , netperf , vdbench , Finisar Medusa Test Tool

Impacted Network Performance

系統裡面哪些會影響到 Network 網路的效能?

  • System: OS, CPU , Memory , BIOSe setting, PCI-E
    在 Linux 下要如何得知 PCI-E Bus 使用的是 Gen(Generation) 1 還是 Gen2 還是新一代的 Gen 3 .請參考 http://benjr.tw/10842
    簡單的來說 如果是 10G x1 (port 埠) 就要使用 PCI-E Gen2 x4(16Gb/s) 以上的, 10G x2 (port 埠) 就要使用 PCI-E Gen2 x8(32Gb/s) 以上的,但如果是 40Gx1 (port 埠) 就要使用 PCI-E Gen3x8(63Gb/s) 以上的.
  • Ethernet : NVM image , Driver version , Driver configuration
  • Switch
  • Traffic Generator : Software traffic generator , HW traffic generator

Performance Tuning

如何調整系統讓 Network 的效能會更好.

  • Disable irqbalance
    # Killall irqbalance
    

    或是

    # /etc/init.d/irqbalance stop
    

    IRQ (Interrupt request) 是當週邊裝置需要資料的傳輸時會產生一個中斷請求給 CPU ,並請 CPU 停止工作並幫忙處理處理週邊資料的傳輸,不過現在的系統都是多處理器或是多核心的處理器(CPU),所以作業系統透過 irqbalance 這個服務定期強制中斷應用程式(但 CPU 在切換不同的中斷時需要額外的時間處理 新資料的寫入和暫存指令快取),讓每個應用程式能更公平的方式分享 CPU 的資源,但在 realtime 即時環境下,應用程序通常是專用的,並綁定到特定的 CPU,所以不需要 irqbalance 這個服務守護.

    所以啦!! 你也可以直接停掉服務試試看效能會不會比較好.

    關於中斷請參考 Linux daemon – irqbalance

  • To turn off ITR
    # ethtool -C ethX rx-usecs 0 tx-usecs 0 adaptive-rx off adaptive-tx off
    

    ITR (Interrupt Throttle Rate) 不知道是幹嘛的,不過這邊使用了兩個參數 x-usecs , tx-usecs 與 adaptive-rx , adaptive-tx

    我們先來看看什麼是 adaptive-rx , adaptive-tx, 查了一下參數資料 MTNIC_for_XEN_Readme.txt 相信還是看不懂.

    x-usecs , tx-usecs : Above an upper limit of packet rate, adaptive moderation will set the moderation time to its highest value. Below a lower limit of packet rate, the moderation time will be set to its lowest value.
    adaptive-rx , adaptive-tx : By default, the driver uses adaptive interrupt moderation for the receive path, which adjusts the moderation time to the traffic pattern

    不過在 Intel 的 gbe-controllers-interrupt-moderation-appl-note.pdf 文件有提到關於 ITR (Interrupt Throttle Rate)

    其實概念很簡單 Intel 的網路卡有針對 ITR (Interrupt Throttle Rate) 做限制,也就是我們可以透過設定針對 Ethernet 網卡對系統處理器發出的 interrupt 的頻率.一共有 4 種演算法個針對不同的 I/O 狀況而定的.

    • Bulk/Intermediate – 適用於大量的一般封包的網路傳輸.
    • Low Latency – 流量不大 而且 小的數據封包明顯是多數時
    • Lowest Latency – 小流量而且大多是小數據封包

    除了可以透過 ethtool 來設定,在 Linux 下可以在載入模組時就先設定好.

    • insmod e1000.ko InterruptThrottleRate=1 (Mode 1)
    • insmod e1000.ko InterruptThrottleRate=0 (ITR off)
    • insmod e1000.ko InterruptThrottleRate=8000 (Fixed value for all I/O patterns)

    多個網路裝置時,可以一起設定.

    • insmod e1000.ko InterruptThrottleRate=1,1,1,1

    在 Linux 下 Interrupt Throttle Rate 與 Interrupt Rates ,Latency ,CPU Utilization 的數值如下

    Mode/Value Interrupt Rates Latency Throughput CPU Utilization
    3 4,000 to 20,000 High to Low High Low to High
    1 4,000 to 70,000 High to Low High Low to High
    0 No Limit Lowest Varies Highest
    Fixed Value 100 to 100,000 High to Low Varies Low to High

    接下來討論 rx-usecs 與 tx-usecs ,通常封包資料從收到,到處理完然後再處理下一個封包資料的時間被稱為延遲 (latency) 時間.如果延遲時間太短則 cpu overhead (消耗 CPU)就會高.所以通常 kernels 2.6.15 以前的版本是 25us,之後的版本是 75us (單位為 us 10的負6次方,0.000001 秒).

  • Run IRQ affinity
    # set_irq_affinity ethX
    

    IRQ (Interrupt request) 是當週邊裝置需要資料的傳輸時會產生一個中斷請求給 CPU ,並請 CPU 停止工作並幫忙處理處理週邊資料的傳輸,但 CPU 在切換不同的中斷時需要額外的時間處理 新資料的寫入和暫存指令快取),所以為了幫助平衡被中斷所產生的 CPU 負載,irq affinity 可以將特定 irq 的中斷隔離到單一個 CPU,使負載都是在這同一個處理器來處理.
    關於 irq affinity 請參考 http://benjr.tw/93539

  • To set ring size
    ring size (或是 ring buffer) 是網路卡所需要的一塊記憶體空間,藉由增加網路介面接收信號緩衝區( ring size , ring buffer ) 的容量有助於抑制行程切換次數的增加,我們可透過 ethtool -g ethX 顯示數值,或是透過 ethtool -G ethx 來設定,不過這最大值在編譯驅動程式時就已經決定.
    # ethtool -G ethX rx 4096 tx 4096
    
  • To turn off general receive offload
    GRO (generic receive offload) 他是 LRO(Large Receive Offload) 的增強版,主要是針對TCP的機制,LRO 與 GRO 它將多個 TCP 封包集合在一個大封包才交給上層的其他網絡協議,這樣可以減少上層協議處理的數量.但如果在測試效能時,還是關閉這樣功能,避免效能的降低.

    我們可透過 ethtool -k ethX 顯示數值,或是透過 ethtool -K ethx 來設定

    # ethtool -K ethX gro off
    
  • Disable CPU C stat
    ACPI 定義了 C-State 也就是 CPU 的省電模式,其中包含了 C0(CPU 的 Working State)以及 Cx (x >= 1 CPU的睡眠模式).
  • Disable ASPM
    ASPM (Active State Power Management)主動式電源的管理機制是針對 PCI-E 的省電模式管理的新模式.
  • Check PCIe max_payload_size
    最大的資料承載量大小(Max Payload Size) 也就是 PCI-E 重送緩衝器的大小.
  • Hardware Traffice Generator – run with multiple source IP addesses

Viewing all articles
Browse latest Browse all 56

Trending Articles


Girasoles para colorear


mayabang Quotes, Torpe Quotes, tanga Quotes


Tagalog Quotes About Crush – Tagalog Love Quotes


OFW quotes : Pinoy Tagalog Quotes


Long Distance Relationship Tagalog Love Quotes


Tagalog Quotes To Move on and More Love Love Love Quotes


5 Tagalog Relationship Rules


Best Crush Tagalog Quotes And Sayings 2017


Re:Mutton Pies (lleechef)


FORECLOSURE OF REAL ESTATE MORTGAGE


Sapos para colorear


tagalog love Quotes – Tiwala Quotes


Break up Quotes Tagalog Love Quote – Broken Hearted Quotes Tagalog


Patama Quotes : Tagalog Inspirational Quotes


Pamatay na Banat and Mga Patama Love Quotes


Tagalog Long Distance Relationship Love Quotes


BARKADA TAGALOG QUOTES


“BAHAY KUBO HUGOT”


Vimeo 10.7.0 by Vimeo.com, Inc.


Vimeo 10.7.1 by Vimeo.com, Inc.