You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by "Tuvie (via GitHub)" <gi...@apache.org> on 2023/05/30 14:19:35 UTC

[PR] Allow disabling send size zerocopy for rdma (brpc)

Tuvie opened a new pull request, #2267:
URL: https://github.com/apache/brpc/pull/2267

   ### What problem does this PR solve?
   
   Issue Number:
   
   Problem Summary: 
   
   ### What is changed and the side effects?
   
   Changed: For convenience of debugging, allow user disabling send size zerocopy with gflags rdma_send_zerocopy
   
   Side effects:
   - Performance effects(性能影响): If user does not set rdma_send_zerocopy to false, there is no effect for performance
   
   - Breaking backward compatibility(向后兼容性): 
   
   ---
   ### Check List:
   - Please make sure your changes are compilable(请确保你的更改可以通过编译).
   - When providing us with a new feature, it is best to add related tests(如果你向我们增加一个新的功能, 请添加相关测试).
   - Please follow [Contributor Covenant Code of Conduct](../../master/CODE_OF_CONDUCT.md).(请遵循贡献者准则).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] Allow disabling send size zerocopy for rdma (brpc)

Posted by "wwbmmm (via GitHub)" <gi...@apache.org>.
wwbmmm commented on PR #2267:
URL: https://github.com/apache/brpc/pull/2267#issuecomment-1605907854

   bazel compile failed: 
   example/rdma_performance/client.cpp:91: error: undefined reference to 'brpc::rdma::RegisterMemoryForRdma(void*, unsigned long)'
   @Tuvie 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] Allow disabling send size zerocopy for rdma (brpc)

Posted by "372046933 (via GitHub)" <gi...@apache.org>.
372046933 commented on code in PR #2267:
URL: https://github.com/apache/brpc/pull/2267#discussion_r1212533566


##########
src/brpc/rdma/rdma_endpoint.cpp:
##########
@@ -801,29 +802,46 @@ ssize_t RdmaEndpoint::CutFromIOBufList(butil::IOBuf** from, size_t ndata) {
         wr.sg_list = sglist;
         wr.opcode = IBV_WR_SEND_WITH_IMM;
 
-        RdmaIOBuf* data = (RdmaIOBuf*)from[current];
         size_t sge_index = 0;
         while (sge_index < (uint32_t)max_sge &&
                 this_len < _remote_recv_block_size) {
-            if (data->size() == 0) {
+            if (from[current]->size() == 0) {
                 // The current IOBuf is empty, find next one
                 ++current;
                 if (current == ndata) {
                     break;
                 }
-                data = (RdmaIOBuf*)from[current];
                 continue;
             }
 
-            ssize_t len = data->cut_into_sglist_and_iobuf(
-                    sglist, &sge_index, to, max_sge,
-                    _remote_recv_block_size - this_len);
-            if (len < 0) {
-                return -1;
+            ssize_t len = 0;
+            if (FLAGS_rdma_send_zerocopy) {
+                ssize_t len = ((RdmaIOBuf*)from[current])->cut_into_sglist_and_iobuf(
+                        sglist, &sge_index, to, max_sge,
+                        _remote_recv_block_size - this_len);
+                if (len < 0) {
+                    return -1;
+                }
+                this_len += len;
+                total_len += len;
+            } else {
+                len = _remote_recv_block_size - this_len;
+                void* buf = AllocBlock(len);
+                if (!buf) {
+                    return -1;
+                }
+                len = from[current]->copy_to(buf, len);
+                base::IOBuf tmp;

Review Comment:
   use of undeclared identifier 'base'



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] Allow disabling send size zerocopy for rdma (brpc)

Posted by "yanglimingcn (via GitHub)" <gi...@apache.org>.
yanglimingcn commented on PR #2267:
URL: https://github.com/apache/brpc/pull/2267#issuecomment-1570044481

   ok


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] Allow disabling send size zerocopy for rdma (brpc)

Posted by "yanglimingcn (via GitHub)" <gi...@apache.org>.
yanglimingcn commented on PR #2267:
URL: https://github.com/apache/brpc/pull/2267#issuecomment-1569944639

   请问什么情况下需要zero copy,什么情况下不能做zero copy呢?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] Allow disabling send size zerocopy for rdma (brpc)

Posted by "Tuvie (via GitHub)" <gi...@apache.org>.
Tuvie commented on PR #2267:
URL: https://github.com/apache/brpc/pull/2267#issuecomment-1570005434

   理论上都应该做zero copy。关闭zery copy主要用来做debug。


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org