yanglimingcn commented on issue #2315:
URL: https://github.com/apache/brpc/issues/2315#issuecomment-1898444623

   > > 优势在于,创建span仍然是能够完全规避了线程竞争,所以对性能应该很友好。
   > 
   > 这个修改没有想象中那么简单,至少还涉及了rpcz相关的代码。这里会出现多个trace id,span id一样的span对象。 
那么存入leveldb时,可能要考虑是否合并到一起。 如果不合并则要考虑rpcz的展示需要做一些修改。
   > 
   > 所以,加一个锁,或者一个lockfree的队列会来的更快。
   > 
   > 另外还注意到TRACEPRINTF这个宏其实可能也有线程安全问题,最终其实是调用到Span::Annotate这个函数。 
如果是多个线程同时写,则显然需要一个锁。
   > 
   > 所以总的来说,除非trace部分整体重新设计一遍,否则,使用锁是一个看上去更清晰的方案。
   
   单线程调用内部多次调用createClientSpan,这个应该不会造成重复spanId吧,多线程调用Annotate相当于多线程并发处理一个请求?


-- 
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-unsubscr...@brpc.apache.org

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


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

Reply via email to