You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by "WingsGo (via GitHub)" <gi...@apache.org> on 2023/02/17 03:48:16 UTC

Re: [I] IOBuf是否能支持连续的内存避免内存拷贝 (brpc)

WingsGo commented on issue #2120:
URL: https://github.com/apache/brpc/issues/2120#issuecomment-1434056903

   > > 请问一下这一块是需要在哪里进行修改呢,我理解这一层在自定义协议是没法完成的,因为自定义协议的接口都是基于IOBuf,理论上是否是需要修改OnNewMessages这个函数的实现,例如申请一块连续内存,然后通过append_user_data保证接收端接收到的内存是连续的?这个问题的背景是因为在高性能计算的场景下,向量化的计算需要保证内存是连续的,现在其实多了一层内存拷贝的开销,这在大数据量的场景下其实有比较大的性能损耗
   > 
   > 可能需要大改,包括IOBuf、Socket、InputMessenger、协议 这里还有个麻烦就是brpc支持多协议,所以一开始不知道要准备多大的buf,只能先随便读一段数据再尝试逐个协议解析,这时候可能已经读进来一部分body了,那么后续再读就不连续了
   
   协议解析的时候需要的应该只是一小部分body吧,例如brpc的协议其实只需要前12个字节就可以确认了,后续的内存可以先申请,然后把前12个字节的数据重新set一下就可以了吧,不知道这个理解是否正确?


-- 
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