【RDMA】优化 RDMA 代码的提示和技巧

本文提供了一系列关于如何优化RDMA代码的提示和技巧,包括避免在数据路径中使用控制操作,使用事件批量处理工作完成,减少scatter/gather条目,以及优化带宽、降低延迟、减少内存和CPU消耗的方法。通过这些优化,可以充分利用RDMA的高性能特性。
摘要由CSDN通过智能技术生成

RDMA is used in many places, mainly because of the high performance that it allows to achieve. In this post, I will provide tips and tricks on how to optimize RDMA code in several aspects.

General tips

Avoid using control operations in the data path

Unlike the data operations that stay in the same context that they were called in (i.e. don't perform a context switch) and they are written in optimized way, the control operations (all create/destroy/query/modify) operations are very expensive because:

  • Most of the time, they perform a context switch
  • Sometimes they allocate or free dynamic memory
  • Sometimes they involved in accessing the RDMA device

As a general rule of thumb, one should avoid calling control operations or decrease its use in the data path.

The following verbs are considered as data operations:

  • ibv_post_send()
  • ibv_post_recv()
  • ibv_post_srq_recv()
  • ibv_poll_cq()
  • ibv_req_notify_cq

When posting multiple WRs, post them in a list in one call

When posting several Work Requests to one of the ibv_post_*() verbs, posting multiple Work Requests as a linked list in one call instead of several calls each time with one Work Request will provide better performance since it allows the low-level driver to perform optimizations.

When using Work Completion events, acknowledge several events in one call

When handling Work Completions using events, acknowledging several completions in one call instead of several calls each time will provide better performance since less mutual exclusion locks are being performed.

Avoid using many scatter/gather entries

Using several scatter/gather entries in a Work Request (either Send Request or Receive Request) mean that the RDMA device will read th

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值