4.3. 使用 Receive Flow Steering(RFS)提高网络性能
通过进一步减少网络延迟,Receive Flow Steering (RFS) 进一步扩展了 Receive Packet Steering (RPS)。RFS 在技术上基于 RPS,通过增加 CPU 缓存命中率来提高数据包处理的效率。RFS 通过确定计算最方便的 CPU,以便缓存命中更有可能在 CPU 中发生,增加了对队列长度的考虑。因此,会减少 CPU 缓存无效的频率,从而只需要较少的循环来重建缓存。这有助于缩短数据包处理运行时间。
4.3.1. 使用 Machine Config Operator (MCO) 激活 RFS
流程
将以下 MCO 示例配置集复制到 YAML 文件中。例如,
enable-rfs.yaml
:apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig metadata: labels: machineconfiguration.openshift.io/role: worker name: 50-enable-rfs spec: config: ignition: version: 2.2.0 storage: files: - contents: source: data:text/plain;charset=US-ASCII,%23%20turn%20on%20Receive%20Flow%20Steering%20%28RFS%29%20for%20all%20network%20interfaces%0ASUBSYSTEM%3D%3D%22net%22%2C%20ACTION%3D%3D%22add%22%2C%20RUN%7Bprogram%7D%2B%3D%22/bin/bash%20-c%20%27for%20x%20in%20/sys/%24DEVPATH/queues/rx-%2A%3B%20do%20echo%208192%20%3E%20%24x/rps_flow_cnt%3B%20%20done%27%22%0A filesystem: root mode: 0644 path: /etc/udev/rules.d/70-persistent-net.rules - contents: source: data:text/plain;charset=US-ASCII,%23%20define%20sock%20flow%20enbtried%20for%20%20Receive%20Flow%20Steering%20%28RFS%29%0Anet.core.rps_sock_flow_entries%3D8192%0A filesystem: root mode: 0644 path: /etc/sysctl.d/95-enable-rps.conf
创建 MCO 配置集:
$ oc create -f enable-rfs.yaml
验证是否列出了名为
50-enable-rfs
的条目:$ oc get mc
要取消激活,请输入:
$ oc delete mc 50-enable-rfs