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

   ### What problem does this PR solve?
   
   Issue Number: #3072
   
   Problem Summary:
   
   当前,brpc 的用户函数里(CallMethod )无法获取 RPC 在  socket 被读取的时间点,所以存在几个问题:
   1. 无法在用户代码里统计出 RPC 正确的处理总耗时:因为在用户代码里只能从 RPC 开始被处理时开始统计时间, 而实际耗时还应该包含 RPC 在 
bthread 队列里的等待时间
   2. 无法直接抛弃超时的RPC: 如果 RPC 在 bthread 调度队列等待的时间过长(也就是从 socket 读取到被 bthread 
开始处理这个 RPC 的排队时间,我们线上偶发), 且超过了超时时间, 这个请求应该直接被抛弃, 但是用户无法获取 RPC 到达时间, 导致无法实现这功能
   
   所以,应该把 RPC 从 socket 读取到的时间点暴露给用户代码。
   
   > 说明:
   > 1.  brpc 中 RPC 的 received_us 并不是 RPC 达到机器网卡的时间, 也不代表用户的发送时间, 但是相对于从 
CallMethod 调用后用户自己统计 RPC 耗时, received_us 相对更精确
   > 2. 当前代码仅修改了 baidu_rpc, 其他的协议没支持, get_rpc_received_us 返回 0, 表示这个协议不支持
   
   
   
   ### What is changed and the side effects?
   
   Changed:
   
   Side effects:
   - Performance effects:
   
   - 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](https://github.com/apache/brpc/blob/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: [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]

Reply via email to