Neutron Network Nodeの外側NICではgroをoffにする

仮想マシンインスタンスと外部の通信(ftp受信)でスループットが低い

通信経路

instance-A ---> hypervisor ---> network node ---> router -(internet)-> ftp.iij.ad.jp

スループットがやたらと低い

テストで仮想マシンインスタンス(instance-A)からftp.iij.ad.jpからCentOSのLiveCDイメージをダウンロードしてみると、以下の通り平均400kB/s程度しかスループットが出ない

CentOS-6.5-x86_64-LiveCD.iso:     ETA:  21:34  116.51/649.00 MB  421.35 kB/s

network nodeから直接同じ操作を実行してみると...6MB/s以上出ている

CentOS-6.5-x86_64-LiveCD.iso:     ETA:   0:50  327.91/649.00 MB    6.41 MB/s

原因

仮想マシンインスタンスNICのmodel typeやリンクの状態、仮想インスタンス同士の通信などは全く問題なさそう。 最終的にnetwork nodeのineternet接続側NICのオフロードエンジンが悪さをしているのではないかと予想してオフロードを無効化する設定を投入してみることにした。

instance-A ---> hypervisor ---> network node ---> router -(internet)-> ftp.iij.ad.jp
                                            ^
                                            |
                           network nodeのinternet接続側のNICが問題

NICのデフォルト状態

起動直後のNICのオフロードエンジン利用状況はethtool -k で確認できる。

$ ethtool -k eth0
Features for eth0:
rx-checksumming: on
tx-checksumming: on
    tx-checksum-ipv4: on
    tx-checksum-ip-generic: off [fixed]
    tx-checksum-ipv6: on
    tx-checksum-fcoe-crc: off [fixed]
    tx-checksum-sctp: off [fixed]
scatter-gather: on
    tx-scatter-gather: on
    tx-scatter-gather-fraglist: off [fixed]
tcp-segmentation-offload: on
    tx-tcp-segmentation: on
    tx-tcp-ecn-segmentation: off [fixed]
    tx-tcp6-segmentation: on
udp-fragmentation-offload: off [fixed]
generic-segmentation-offload: on
generic-receive-offload: on
large-receive-offload: off [fixed]
rx-vlan-offload: on
tx-vlan-offload: on
ntuple-filters: off [fixed]
receive-hashing: on
highdma: on [fixed]
rx-vlan-filter: on [fixed]
vlan-challenged: off [fixed]
tx-lockless: off [fixed]
netns-local: off [fixed]
tx-gso-robust: off [fixed]
tx-fcoe-segmentation: off [fixed]
tx-gre-segmentation: off [fixed]
tx-udp_tnl-segmentation: off [fixed]
tx-mpls-segmentation: off [fixed]
fcoe-mtu: off [fixed]
tx-nocache-copy: on
loopback: off [fixed]
rx-fcs: off [fixed]
rx-all: off
tx-vlan-stag-hw-insert: off [fixed]
rx-vlan-stag-hw-parse: off [fixed]
rx-vlan-stag-filter: off [fixed]

manによるとethtoolで設定可能なフィーチャーは以下の通り。

       rx on|off
              Specifies whether RX checksumming should be enabled.

       tx on|off
              Specifies whether TX checksumming should be enabled.

       sg on|off
              Specifies whether scatter-gather should be enabled.

       tso on|off
              Specifies whether TCP segmentation offload should be enabled.

       ufo on|off
              Specifies whether UDP fragmentation offload should be enabled

       gso on|off
              Specifies whether generic segmentation offload should be enabled

       gro on|off
              Specifies whether generic receive offload should be enabled

       lro on|off
              Specifies whether large receive offload should be enabled

       rxvlan on|off
              Specifies whether RX VLAN acceleration should be enabled

       txvlan on|off
              Specifies whether TX VLAN acceleration should be enabled

       ntuple on|off
              Specifies  whether  Rx  ntuple filters and actions should be en‐
              abled

       rxhash on|off
              Specifies whether receive hashing offload should be enabled

対策

通信はftpでのファイル受信であるため、様々なフィーチャーの中でもgroをoffにしてみた。

$ sudo ethtool -K eth1 gro off

その後、実際にダウンロードしてみると、network node上から直接ダウンロードした場合と同程度のスループットが出た。

ncftp ...centos/6.5/isos/x86_64 > get CentOS-6.5-x86_64-LiveCD.iso   
CentOS-6.5-x86_64-LiveCD.iso:     ETA:   1:39   31.27/649.00 MB    6.25 MB/s 

コレで解決。NICのオフロードエンジンってちっとも良い印象ないな。