What are the recommendations for 10 Gigabit network adapter tuning parameters?

本文提供10Gbps网络适配器的推荐调优参数,包括中断平衡、环形缓冲区、套接字缓冲区及网络预算调整等,以实现更快的数据传输速度。

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

What are the recommendations for 10 Gigabit network adapter tuning parameters?

 SOLUTION 已验证 - 已更新 2017年三月20日01:07 - 

English 

环境

  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 5
  • 10 Gigabit Ethernet network interface adapters (10GbE)

问题

  • What are the recommendations for 10 Gigabit network adapter tuning parameters?
  • 10Gbit NIC with MTU of 9000. Testing using iperf between two systems only results in 6-7 gigabits/s transfer speed.
  • What are the expected and recommended tuning parameters to configure to achieve 10Gbps connection wirespeed for streaming bulk transfers?

决议

The following parameters are very general recommendations to achieve faster streaming transfers over 10 Gigabit Ethernet.

Depending on the actual production use of the network, these settings may not be optimal for your usage, however they will certainly make artificial benchmarks like iperf run faster.

Interrupt Balancing

Ensure the irqbalance service is installed and running.

Ring Buffer

It is recommended to make the NIC receive and transmit ring buffers as large as possible to prevent packet drops.

The procedure to increase the buffer size is described at:

The change can be persisted across reboots by following:

Socket Buffers

Increasing the maximum socket buffer size to 16MiB allows buffers to grow larger if required.

The following changes can be applied in /etc/sysctl.conf and applied immediately with sysctl -p:

Raw

# set min/default/max TCP read buffer
net.ipv4.tcp_rmem = 4096 87380 16777216
# set min/default/max TCP write buffer
net.ipv4.tcp_wmem = 4096 16384 16777216

# set maximum non-TCP receive socket buffer size
net.core.rmem_max = 16777216
# set maximum non-TCP write socket buffer size
net.core.wmem_max = 16777216

Increasing the default socket buffer sizes is not required as this basic level of tuning as it may harm efficiency of non-streaming transfers.

Network Budget

If the third column of /proc/net/softnet_stat is increasing, eg:

Raw

# cat /proc/net/softnet_stat
0073d76b 00000000 000049ae 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

Then there could be benefit to allowing the kernel packet receive handler to run for a slightly longer time.

The default value is 300 meaning 300 packets are received before the handler ends. This can be increased, though there is unlikely to be much improvement increasing this past several thousand.

The following change can be applied in /etc/sysctl.conf and applied immediately with sysctl -p:

Raw

# set number of packets softirq receives off NIC before exiting
net.core.netdev_budget = 1000

Further Reading

The following documents can assist in more precise tuning:

To provide a precise answer, I need to see the specific Action script you're referring to. However, I can give you a general framework for evaluating and improving an Action script, which could apply to various types of scripts, including those used in GitHub Actions, Jenkins pipelines, or other CI/CD tools. ### General Framework for Improving an Action Script #### 1. **Simplify and Modularize** - **Improvement**: Break down complex scripts into smaller, modular steps. - **Why**: Modularization makes the script easier to read, maintain, and debug. Each step can be tested independently, reducing errors. #### 2. **Use Environment Variables and Secrets Securely** - **Improvement**: Replace hardcoded sensitive information with environment variables or secrets. - **Why**: This enhances security by preventing sensitive data from being exposed in the script. It also allows for easier updates to sensitive values. #### 3. **Implement Error Handling** - **Improvement**: Add error handling mechanisms (e.g., try-catch blocks, exit codes) to handle failures gracefully. - **Why**: Proper error handling ensures that the script can fail gracefully and provide useful error messages, helping to diagnose issues quickly. #### 4. **Optimize Resource Usage** - **Improvement**: Optimize commands or processes that consume significant resources (CPU, memory, disk I/O). - **Why**: Efficient resource usage reduces build times and minimizes the impact on infrastructure, especially in cloud environments where costs are tied to resource consumption. #### 5. **Add Documentation and Comments** - **Improvement**: Add comments and inline documentation to explain non-obvious parts of the script. - **Why**: Clear documentation makes it easier for others (or future you) to understand and modify the script, reducing the learning curve. #### 6. **Leverage Caching** - **Improvement**: Implement caching strategies for dependencies or artifacts. - **Why**: Caching can significantly speed up build times by avoiding redundant downloads or computations, especially in CI/CD pipelines. #### 7. **Improve Logging** - **Improvement**: Enhance logging to provide more detailed and actionable logs. - **Why**: Detailed logs help in debugging and monitoring the execution of the script, making it easier to identify and fix issues. #### 8. **Ensure Security Best Practices** - **Improvement**: Follow security best practices, such as limiting permissions, using the principle of least privilege, and regularly updating dependencies. - **Why**: Security is crucial to protect against vulnerabilities and ensure that the script operates safely within the environment. ### Example: GitHub Actions Workflow Improvement If you're working with a GitHub Actions workflow, here’s an example of how you might improve a script: ```yaml name: Build and Deploy on: push: branches: - main jobs: build: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 # Improvement: Use a specific version of setup-node to avoid unexpected behavior - name: Set up Node.js uses: actions/setup-node@v2 with: node-version: '14' # Improvement: Cache node modules to speed up builds - name: Cache node modules uses: actions/cache@v2 with: path: ~/.npm key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} # Improvement: Use environment variables for secrets instead of hardcoding - name: Install dependencies run: npm install env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} # Improvement: Add error handling and logging - name: Build project run: | if ! npm run build; then echo "Build failed!" exit 1 fi echo "Build successful!" # Improvement: Only deploy on successful build - name: Deploy if: success() run: npm run deploy ``` ### Conclusion Without seeing the specific Action script, these general improvements can still guide you toward writing more efficient, secure, and maintainable scripts. If you provide the actual script, I can offer more targeted recommendations!
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值