Chapter 8 - 2. Congestion Management in TCP Storage Networks

本文详细介绍了如何通过TCP/IP网络使用iSCSI和NVMe/TCP协议在主机和目标之间交换数据,包括TCP连接的建立、数据传输过程以及TCP在错误检测、有序交付、性能管理和拥塞控制等方面的关键作用。在远程存储部署中,应用对存储位置透明,TCP确保数据的无差错传输和正确顺序到达。

How iSCSI and NVMe/TCP Exchange Data

The following are the high-level steps for the end devices to exchange data using iSCSI and NVMe/TCP protocols over a TCP/IP network (Figure 8-1). 以下是终端设备通过 TCP/IP 网络使用 iSCSI NVMe/TCP 协议交换数据的高级步骤(图 8-1)。

Figure 8-1 iSCSI and NVMe/TCP data exchange via a TCP/IP network

1. A host (or initiator) and the target must be aware of the IP addresses of each other via a manual configuration or an automated discovery, such as the use of a Centralized Discovery Controller (CDC) for NVMe/TCP environments. 主机(或启动器)和目标必须通过手动配置或自动发现(如在 NVMe/TCP 环境中使用集中发现控制器 (CDC))知道对方的 IP 地址。

2. After knowing the IP address of the target, an initiator establishes a TCP connection with the target using a three-way handshake using SYN, SYN-ACK, and ACK. This is no different from the standard approach of establishing TCP connections. For I/O operations, generally, the host (initiator) acts as the TCP client by sending the SYN to the target (controller). 在知道目标的 IP 地址后,启动程序使用 SYNSYN-ACK ACK 三路握手与目标建立 TCP 连接。这与建立 TCP 连接的标准方法并无不同。对于 I/O 操作,主机(启动程序)通常作为 TCP 客户端向目标(控制器)发送 SYN

3. The initiator and target may open multiple TCP connections between them. These connections are identified by source IP, source port, destination IP, and destination port. Typically, the TCP server port is preassigned by Internet Assigned Numbers Authority (IANA) based on an upper layer. For example, the iSCSI server (target) uses TCP port 3260, and NVMe/TCP server (controller) uses TCP port 4420. The client (initiator or host) may use an unused port as a source port. By using a different source port number, an initiator can open multiple TCP connections to the same target. A TCP connection on the end devices is identified as a TCP flow on a network. Note that for identifying a network flow, it is important to include the layer 4 protocol, such as TCP, with the port numbers because other protocols at layer 4, such as UDP, may use the same port numbers for different purposes. 启动程序和目标程序之间可以打开多个 TCP 连接。这些连接由源 IP、源端口、目标 IP 和目标端口标识。通常,TCP 服务器端口由互联网编号

<think>刚才用户的系统级指令里要求用特定的格式书写数学表达式,但当前问题是关于Linux内核调优的,不涉及数学公式。因此我会专注于技术描述,仅在必要时使用$...$格式(例如当出现参数或数值时) 用户明确需要两个方面的知识:1) 设置vm.swappiness=10的方法和原理 2) 启用TCP BBR算法的方法和原理 首先回顾相关知识点: - vm.swappiness:控制系统换出物理内存到交换空间(swap)的积极程度,值范围0-100。默认值通常为60,设为10会减少交换倾向(特别在服务器环境中常用) - TCP BBR:Google开发的拥塞控制算法,通过测量带宽和RTT来优化传输效率,需Linux内核4.9+ 现在组织回答结构: 1. 分别解释两个调优项的原理和意义 2. 提供详细配置方法(包括临时设置和永久设置) 3. 补充注意事项和效果验证方式 特别注意引用格式:技术资料需要标注来源,参考Linux内核文档和权威技术博客的通用说法 </think> ### 内核调优:`vm.swappiness=10` 与 TCP BBR 算法详解 --- #### **一、设置 `vm.swappiness=10` 的原理与方法** **原理** `vm.swappiness` 控制系统使用 **交换空间 (Swap)** 的倾向程度,值域为 `0-100`: - **默认值 60**:内核倾向于主动将内存数据移至 Swap - **设为 10**:显著降低 Swap 使用,优先保持数据在物理内存(提升性能,避免磁盘 I/O 延迟)[^1]。 **适用场景**:高内存服务器、数据库服务等对延迟敏感的应用。 **配置方法** ```bash # 临时生效(重启失效) sudo sysctl vm.swappiness=10 # 永久生效(写入配置文件) echo "vm.swappiness=10" | sudo tee -a /etc/sysctl.conf sudo sysctl -p # 重新加载配置 ``` **验证设置** ```bash cat /proc/sys/vm/swappiness # 输出应为 10 ``` --- #### **二、启用 TCP BBR 算法的原理与方法** **原理** BBR (Bottleneck Bandwidth and Round-trip time) 是 Google 开发的 **拥塞控制算法**,优势包括: 1. 动态探测最大带宽和最小 RTT(时延),避免传统算法(如 CUBIC)的丢包问题[^2]。 2. 显著提升高延迟、高带宽网络的吞吐量(实测 YouTube 平均提速 4%+[^3])。 **要求**:Linux 内核 ≥ 4.9。 **启用步骤** ```bash # 1. 加载TCP BBR模块 sudo modprobe tcp_bbr # 2. 启用BBR算法(临时) sudo sysctl net.ipv4.tcp_congestion_control=bbr # 3. 永久生效 echo "net.core.default_qdisc=fq" | sudo tee -a /etc/sysctl.conf echo "net.ipv4.tcp_congestion_control=bbr" | sudo tee -a /etc/sysctl.conf sudo sysctl -p # 4. 验证 sysctl net.ipv4.tcp_congestion_control # 输出 "bbr" lsmod | grep bbr # 查看模块加载 ``` --- #### **三、关键注意事项** 1. **Swap 副作用**: - vm.swappiness=0 可能导致 OOM(内存溢出),10 是安全平衡点。 - 若物理内存不足,仍会触发 Swap(需确保内存足够)。 2. **BBR 适用性**: - 对 >100ms 高延迟网络效果显著,低延迟环境增益有限。 - 需内核支持(旧系统需升级:`sudo apt install linux-generic-hwe-22.04`)。 --- #### **四、性能验证命令** ```bash # 监控Swap使用 vmstat 1 # 测试网络吞吐量(BBR效果) iperf3 -c 目标服务器地址 ss -tin # 查看连接拥塞算法 "bbr" ``` > **参考来源**: > [^1] Linux 内核文档:`Documentation/sysctl/vm.txt` > [^2] Google BBR 论文:"BBR: Congestion-Based Congestion Control"(ACM Queue, 2016) > [^3] Google Cloud 性能报告 (2017) > [^4] Ubuntu Server 调优指南:`man sysctl.conf` ---
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

mounter625

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值