Virtual Network----网卡offload特性和网络加速技术简述

Virtual Network----网卡offload特性和网络加速技术简述

前言

当前越来越多的网卡设备支持 offload 特性,来提升网络收/发性能。offload 是将本来该操作系统进行的一些数据包处理(如分片、重组等)放到网卡硬件中去做,降低系统 CPU 消耗的同时,提高处理的性能;包括 LSO/LRO、GSO/GRO、TSO/UFO 等。

Linux系统和周边硬件针对网络加速的一些方案,主要思想还是减少CPU处理网络数据包的时间,网络传输的核心问题是CPU可以用来处理每个网络包的时间变短了,所以减少CPU处理网络数据包所需的时间是最直观的解决方法。伴随着sdn/dpdk等网络技术的发展,对于网络层面的加速和性能提升也有了其他各种方案,比如大页Cache缓存命中和绕过内存等新技术方案的产生(这部分需要阅读dpdk的相关书籍);

在运维过程中,收到offload特性的配置在云平台虚拟网络模式下,也可能会产生一些不可知的问题,需要对相关特性的作用和特点有一个比较清晰的认识,才能更快的定位到问题;

相关资料文档:

《Segmentation Offloads in the Linux Networking Stack》https://www.kernel.org/doc/Documentation/networking/segmentation-offloads.txt、

《Checksum Offloads in the Linux Networking Stack》https://www.kernel.org/doc/Documentation/networking/checksum-offloads.txt

《常见网络加速技术浅谈》https://zhuanlan.zhihu.com/p/44635205

《了解 VMware 环境中的 TCP 分段清除 (TSO) 和大型接收卸载 (LRO) (2055140)》 https://kb.vmware.com/s/article/2055140?lang=zh_CN

《Packet fragmentation and segmentation offload in UDP and VXLAN》 http://hustcat.github.io/udp-and-vxlan-fragment/

实例实操

Linux 服务器查看网卡配置选项可使用命令 ethtool;

查看配置项:ethtool -k [网卡设备名]

需要注意的是,如果物理机网卡有组bond,进行配置检查和修改时,需要将bond,eth0,eth1 都进行操作;

修改配置项:

ethtool -K eth1 gro off
ethtool -K eth1 lro on
ethtool -K eth1 tso on
# 查看信息:
ethtool -k eth1 | grep tcp-segmentation-offload   # tso
ethtool -k eth0 | grep generic-segmentation-offload  # gso
ethtool -k eth0 | grep udp-fragmentation-offload  # ufo
ethtool -k eth0 | grep generic-receive-offload    # gro
ethtool -k eth0 | grep large-receive-offload      # lro
# 和服务器版本和网卡 硬件强相关
[root@network-test ~]# 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
rx-vlan-offload: on
tx-vlan-offload: on
ntuple-filters: off
receive-hashing: on
highdma: on [fixed]
rx-vlan-filter: on
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]
fcoe-mtu: off [fixed]
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值