What is the best bonding mode for TCP traffic such as NFS, ISCSI, CIFS, etc?

本文围绕Red Hat Enterprise Linux中TCP流量绑定模式展开。指出NFS、Samba/CIFS等大流量场景存在TCP重传等问题,根源在于部分绑定模式无法保证TCP流按序传输。决议推荐使用Bonding Mode 1、2、4等模式,并给出诊断步骤。

https://access.redhat.com/solutions/2217521

SOLUTION 已验证 - 已更新 2018年八月13日12:45 - 

English 

环境

  • Red Hat Enterprise Linux (all versions)
  • Bonding or Teaming
  • Large streaming TCP traffic such as NFS, Samba/CIFS, ISCSI, rsync over SSH/SCP, backups

问题

  • What is the best bonding mode for TCP traffic such as NFS and Samba/CIFS?
  • NFS repeatedly logs nfs: server not responding, still trying when no network issue is present
  • A packet capture displays many TCP retransmission, TCP Out-of-order, RPC retransmission, when there should be no reason for this.

决议

Use a bonding mode which guarantees in-order delivery of TCP traffic such as:

  • Bonding Mode 1 (active-backup)
  • Bonding Mode 2 (balance-xor)
  • Bonding Mode 4 (802.3ad aka LACP)
  • Bonding Mode 5 (balance-tlbwith tlb_dynamic_lb=0
  • Bonding Mode 6 (balance-albwith tlb_dynamic_lb=0

Note that Bonding Mode 2 (balance-xor) requires an EtherChannel or similar configured on the switch, and Mode 4 (802.3ad) requires an EtherChannel with LACP on the switch. Bonding Mode 1 (active-backup) requires no switch configuration.

Bonding Modes 5 (balance-tlb) and 6 (balance-alb) do not require switch configuration. Mode 5 has no capability to balance traffic back into the bond. Mode 6 balances transmit by intercepting ARP requests, so may not be suitable for all situations such as where traffic mostly goes through a default gateway.

For advice on configuring bonding, refer to How do I configure a bonding device on Red Hat Enterprise Linux (RHEL)?

For advice on picking a specific hash policy for your traffic, refer to Why are all interfaces not used in bonding Mode 2 or Mode 4?

根源

The following bonding modes:

  • Bonding Mode 0 (round-robin)
  • Bonding Mode 3 (broadcast)
  • Bonding Mode 5 (balance-tlb) with tlb_dynamic_lb=1
  • Bonding Mode 6 (balance-alb) with tlb_dynamic_lb=1

Do not guarantee in-order delivery of TCP streams, as each packet of a stream may be transmitted down a different slave, and no switch guarantees that packets received in different switchports will be delivered in order.

Given the following example configuration:

Raw

.---------------------------.
| bond0 in 0 (round-robin)  |
'---------------------------'
| eth0 | eth1 | eth2 | eth3 |
'--=---'--=---'---=--'---=--'
   |      |       |      |
   |      |       |      |
.--=------=-------=------=--.
|          switch           |
'---------------------------'

The bond system may send traffic out each slave in a correct order, like ABCD ABCD ABCD, but the switch may forward this traffic in any random order, like CADB BDCA DACB.

As TCP on the receiver expects to be presented a TCP stream in-order, this causes the receiver to think it's missed packets and request retransmissions, to spend a great deal of time reassembling out-of-order traffic in to be in the correct order, and for the sender to waste bandwidth sending retransmissions which are not really required.

The following bonding modes:

  • Bonding Mode 1 (active-backup)
  • Bonding Mode 2 (balance-xor)
  • Bonding Mode 4 (802.3ad aka LACP)

Avoid this issue by transmitting traffic for one destination down the one slave. Mode 2 and Mode 4's balancing algorithm can be altered by the xmit_hash_policy bonding option, but they will never balance a single TCP stream down different ports, and so will avoid the problematic behaviour discussed above.

It is not possible to effectively balance a single TCP stream across multiple bonding or teaming devices. If higher speed is required for a single stream, then faster interfaces (and possibly faster network infrastructure) must be used.

This theory applies to all TCP streams. The most common occurrences of this issue are seen on high-speed long-lived TCP streams such as NFS, Samba/CIFS, ISCSI, rsync over SSH/SCP, and so on.

诊断步骤

Inspect syslog for nfs: server X not responding, still trying and nfs: server X OK messages when there are no other network issues.

Inspect a packet capture for many occurrences of TCP retransmission, TCP Out-of-Order, RPC retransmission, or other similar messages.

Inspect bonding mode in /proc/net/bonding/bondX.

Nano-ESG数据资源库的构建基于2023年初至2024年秋季期间采集的逾84万条新闻文本,从中系统提炼出企业环境、社会及治理维度的信息。其构建流程首先依据特定术语在德语与英语新闻平台上检索,初步锁定与德国DAX 40成分股企业相关联的报道。随后借助嵌入技术对文本段落执行去重操作,以降低内容冗余。继而采用GLiNER这一跨语言零样本实体识别系统,排除与目标企业无关的文档。在此基础上,通过GPT-3.5与GPT-4o等大规模语言模型对文本进行双重筛选:一方面判定其与ESG议题的相关性,另一方面生成简明的内容概要。最终环节由GPT-4o模型完成,它对每篇文献进行ESG情感倾向(正面、中性或负面)的判定,并标注所涉及的ESG具体维度,从而形成具备时序特征的ESG情感与维度标注数据集。 该数据集适用于多类企业可持续性研究,例如ESG情感趋势分析、ESG维度细分类别研究,以及企业可持续性事件的时序演变追踪。研究者可利用数据集内提供的新闻摘要、情感标签与维度分类,深入考察企业在不同时期的环境、社会及治理表现。此外,借助Bertopic等主题建模方法,能够从数据中识别出与企业相关的核心ESG议题,并观察这些议题随时间的演进轨迹。该资源以其开放获取特性与连续的时间覆盖,为探究企业可持续性表现的动态变化提供了系统化的数据基础。 资源来源于网络分享,仅用于学习交流使用,请勿用于商业,如有侵权请联系我删除!
`BONDING_OPTS` 参数设置为 `mode=1 miimon=100` 具有特定的含义和作用,以下是详细解释: ### `mode=1` 的含义和作用 `mode=1` 表示采用主备份策略。在这种模式下,多个物理网络接口被捆绑在一起,但同一时间只有一个接口处于活动状态,其他接口作为备份。当活动接口出现故障时,备份接口会立即接管工作,确保网络连接的连续性。例如,假设有两个物理网卡 `eth0` 和 `eth1` 绑定为 `bondfeth0`,在正常情况下 `eth0` 作为活动接口传输数据,`eth1` 处于备用状态。一旦 `eth0` 出现故障,`eth1` 会马上接替 `eth0` 的工作,继续提供网络连接服务。 ### `miimon=100` 的含义和作用 `miimon=100` 表示系统每 100 毫秒监测一次链路连接状态。通过这种方式,系统能够及时发现网络链路中的故障。如果在监测过程中发现活动接口的链路不通,系统会迅速将工作切换到备份接口上,从而保证网络的正常运行。 ### 相关配置示例 以下是一个包含 `BONDING_OPTS="mode=1 miimon=100"` 的网络接口配置文件示例,通常存放在 `/etc/sysconfig/network-scripts/ifcfg-bondfeth0` 中: ```plaintext DEVICE=bondfeth0 ONBOOT=yes IPADDR=192.168.0.100 NETMASK=255.255.255.0 GATEWAY=192.168.1.254 BONDING_OPTS="mode=1 miimon=100" TYPE=bond BONDING_MASTER=yes BROWSER_ONLY=no BOOTPROTO=none NAME=bondfeth0 ``` ### 配置说明 - `DEVICE`:指定配置的设备名称。 - `ONBOOT`:设置系统启动时是否自动激活该网络接口。 - `IPADDR`、`NETMASK`、`GATEWAY`:分别为该接口的 IP 地址、子网掩码和网关地址。 - `BONDING_OPTS`:指定绑定模式和链路监测时间间隔。 - `TYPE`:表明该接口为 bond 类型。 - `BONDING_MASTER`:表示该设备是主设备。 - `BROWSER_ONLY`:设置是否仅用于浏览。 - `BOOTPROTO`:设置 IP 地址获取方式,`none` 或 `static` 表示手动配置静态 IP,`dhcp` 表示动态获取 IP。 - `NAME`:指定 bond 接口的名称。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值