lorinlee commented on issue #1907: URL: https://github.com/apache/incubator-brpc/issues/1907#issuecomment-1233703195
1. 这个可以考虑先把这块内存append_user_data到一个IOBuf里,然后不同query共享这个IOBuf,之后每次都把这个IOBuf append到cntl.response_attachment()上,IOBuf对指向的内存块本身是有refcount的,每次append()都只会操作refcount 2. fetch会一次性返回所有的数据,且可能会发生拷贝(需要用户传一块内存进来)。如果分段取的话可以用cutn,当然也会发生拷贝。 3. 内存复用的话,这里一个背景是IOBuf内部的内存不保证连续,可能是分段的。如果要复用内存,可以直接持有IOBuf,但这里复用内存有利有弊,复用减少拷贝,但是内存不连续可能导致读数据变慢。也可以选择第一次的时候拷贝一份,后面复用这一份,得结合业务场景来看 -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
