zoukankan      html  css  js  c++  java
  • 网卡多队列

    网卡多队列

    内容来自:https://help.aliyun.com/document_detail/52559.html

    单个 CPU 处理网络中断存在瓶颈,您可以将 ECS 实例中的网卡中断分散给不同的 CPU 处理。经测试,在网络 PPS 和网络带宽的测试中,与 1 个队列相比,2 个队列最多可提升 50% 到 1 倍,4 个队列的性能提升更大。

    支持多队列的 ECS 实例规格

    各种实例规格对网卡多队列的支持现状,详见 实例规格族

    支持多队列的镜像

    目前,由阿里云官方提供的公共镜像中,支持多队列的镜像如下表所示。镜像是否支持多队列与操作系统的位数无关。

    镜像名称是否支持多队列?备注
    Windows 2012 R2 尚未公开支持,可邀测
    Windows 2016 尚未公开支持,可邀测
    CentOS 7.2
    CentOS 6.8
    Ubuntu 16.04
    Ubuntu 14.04
    Debian 8.6
    SUSE Linux Enterprise Server 12 SP1
    OpenSUSE 13.1
    CoreOS

    在 Linux ECS 实例上配置网卡多队列

    推荐使用较新的 Linux 发行版(如 CentOS 7.2)配置网卡多队列。

    这里以 CentOS 7.2 为例介绍如何配置网卡多队列,假设是 2 个队列,网卡 interface 名称为 eth0。

    • 查看网卡是否支持多队列。运行命令:ethtool -l eth0

    • 设置网卡当前使用多队列。运行命令:ethtool -L eth0 combined 2

    • 对于有多个网卡的用户,可以对多个网卡分别进行设置:

      1. [root@localhost ~]# ethtool -l eth0
      2. Channel parameters for eth0:
      3. Pre-set maximums:
      4. RX: 0
      5. TX: 0
      6. Other: 0
      7. Combined: 2 # 这一行表示最多支持设置2个队列
      8. Current hardware settings:
      9. RX: 0
      10. TX: 0
      11. Other: 0
      12. Combined: 1 #表示当前生效的是1个队列
      13. [root@localhost ~]# ethtool -L eth0 combined 2 # 设置eth0当前使用2个队列
    • 建议开启 irqbalance 服务,让系统自动调整网卡中断在多个 CPU 核上的分配。运行命令:systemctl start irqbalance (CentOS 7.2 已默认开启)。

    • 开启多队列后,如果网络性能提升仍不如您的预期,您可以考虑开启 RPS 特性。参考如下 Shell 脚本:

      1. #!/bin/bash
      2. cpu_num=$(grep -c processor /proc/cpuinfo)
      3. quotient=$((cpu_num/8))
      4. if [ $quotient -gt 2 ]; then
      5. quotient=2
      6. elif [ $quotient -lt 1 ]; then
      7. quotient=1
      8. fi
      9. for i in $(seq $quotient)
      10. do
      11. cpuset="${cpuset}f"
      12. done
      13. for rps_file in $(ls /sys/class/net/eth*/queues/rx-*/rps_cpus)
      14. do
      15. echo $cpuset > $rps_file
      16. done

    在 Windows ECS 实例上配置网卡多队列

    注意:目前,Windows 用户采用邀测的方式。Windows 系统使用网卡多队列后其网络性能也会提升,但是提升效果不如 Linux 系统。

    如果您使用的是 Windows 系统,您需要下载并安装驱动程序,才能使用网卡多队列功能。

    Windows 系统的驱动安装过程如下。

    1. 提交工单,索取并下载驱动安装包。

    2. 解压驱动安装包。您会看到几个文件夹,Windows 2012/2016 应使用 Win8/amd64 文件夹下的驱动。

    3. 升级网卡驱动:

      1. 选择 设备管理器 > 网络适配器
      2. 右键单击 Red Hat VirtIO Ethernet Adapter,选择 更新驱动程序软件
      3. 选择本地刚才解压的驱动目录的 Win8/admin64 目录,更新驱动即可。
    4. 完成驱动升级后,建议重启 Windows 系统。

    至此,您就可以开始使用网卡多队列功能了。

  • 相关阅读:
    hdu 4521 小明系列问题——小明序列(线段树 or DP)
    hdu 1115 Lifting the Stone
    hdu 5476 Explore Track of Point(2015上海网络赛)
    Codeforces 527C Glass Carving
    hdu 4414 Finding crosses
    LA 5135 Mining Your Own Business
    uva 11324 The Largest Clique
    hdu 4288 Coder
    PowerShell随笔3 ---别名
    PowerShell随笔2---初始命令
  • 原文地址:https://www.cnblogs.com/flyfish919/p/7338418.html
Copyright © 2011-2022 走看看