XenServerでpfSenseを使っていると、非常に限定された状況で、通信性能が激烈に劣化することがある。
この劣化は、以下の条件で発生することがわかっている。(ただし、これに限定されるかどうかは未確定)
この条件に合致する場合に、TCP Checksumがおかしくなって性能が激烈に低下するように見える。 こういう場合には、以下の設定をVM側で行えば良い
net.inet.tcp.tso=0 kern.ipc.nmbclusters=1000000 # この行は、NICがIntel系(em等)の場合に入れておくと良い
net.inet.tcp.tso=0 kern.ipc.nmbclusters=1000000 # この行は、NICがIntel系(em等)の場合に入れておくと良い
加えて、rc.confなどで設定するifconfigの引数に -tso を加えると良い。自分の場合は、 -rxcsum -txcsum -tso -lro を加えている
これをpfSenseで行うには以下を実行する。
net.inet.tcp.tso=0 kern.ipc.nmbclusters=1000000 # この行は、NICがIntel系(em等)の場合に入れておくと良い
これで、再起動すればOK。
なお、XenServer側からの設定に関しては、
xe vif-param-set uuid=VMに割り当てられているVIFのUUID other-config:ethtool-gso="off" xe vif-param-set uuid=VMに割り当てられているVIFのUUID other-config:ethtool-ufo="off" xe vif-param-set uuid=VMに割り当てられているVIFのUUID other-config:ethtool-tso="off" xe vif-param-set uuid=VMに割り当てられているVIFのUUID other-config:ethtool-sg="off" xe vif-param-set uuid=VMに割り当てられているVIFのUUID other-config:ethtool-tx="off" xe vif-param-set uuid=VMに割り当てられているVIFのUUID other-config:ethtool-rx="off"
とすれば良いのだが、自分の場合は面倒なので、全VMのTSO類をoffにするために以下のようなscript実行している
#! /bin/sh # See http://cloudnull.io/2012/07/xenserver-network-tuning/ # # for All VM's VIF NIC offloading to off. # for VMUUID in `xe vm-list | awk '/uuid/ {print $5}'`; do INSTANCEID=`xe vm-list uuid=$VMUUID | awk '/name-label/' | grep -v "Control domain" | sed 's/ name-label ( RW): //'` for VIFUUID in `xe vif-list vm-uuid=$VMUUID | awk '/uuid/ {print $5}' | sed '/^$/d'`; do echo $INSTANCEID xe vif-param-list uuid=$VIFUUID | grep "other-config" xe vif-param-set uuid=$VIFUUID other-config:ethtool-gso="off" xe vif-param-set uuid=$VIFUUID other-config:ethtool-ufo="off" xe vif-param-set uuid=$VIFUUID other-config:ethtool-tso="off" xe vif-param-set uuid=$VIFUUID other-config:ethtool-sg="off" xe vif-param-set uuid=$VIFUUID other-config:ethtool-tx="off" xe vif-param-set uuid=$VIFUUID other-config:ethtool-rx="off" xe vif-param-list uuid=$VIFUUID | grep "other-config" done done
この時、XenServerのdom0側も設定したいのであれば、併せて以下のscriptを実行するのも良い。
#! /bin/sh # See http://cloudnull.io/2012/07/xenserver-network-tuning/ # # for All XenServer PIF NIC offloading to off # for PIFUUID in `xe pif-list | awk '/uuid/ {print $5}' | sed '/^$/d'` do xe pif-param-list uuid=$PIFUUID | grep "other-config" xe pif-param-set uuid=$PIFUUID other-config:ethtool-gso="off"; xe pif-param-set uuid=$PIFUUID other-config:ethtool-ufo="off"; xe pif-param-set uuid=$PIFUUID other-config:ethtool-tso="off"; xe pif-param-set uuid=$PIFUUID other-config:ethtool-sg="off"; xe pif-param-set uuid=$PIFUUID other-config:ethtool-tx="off"; xe pif-param-set uuid=$PIFUUID other-config:ethtool-rx="off"; xe pif-param-list uuid=$PIFUUID | grep "other-config" done