jamesge commented on PR #1763:
URL: https://github.com/apache/incubator-brpc/pull/1763#issuecomment-1128361374

   > > 把时间分辨率从us变成ns有什么特殊的考虑吗?是不是和要解决的问题无关?
   > 
   > 
将时间分辨率从us变成ns是为了解决高qps情况下,因为取整interval精度不够的问题,导致压测qps不准问题。举例说明,例如我们设置req_rate为510000,要是使用us,计算出来的interval
 = 1 
us,要是忽略发送请求的时间(理想情况),则最终的qps是1000000。要是使用ns,计算出来的interval是1960ns,忽略发送请求时间,则最终qps为510204,更为准确。
   
   
基于通知机制的(condition)的唤醒精度是60us,sleep的精度一般远大于60us,小于2ms。只是把参数计算地很精确的话,传给sleep后的实际效果其实得不到保证。一般要追求精确的时间控制,是不能使用sleep机制的,这里用了sleep其实潜台词就是这个场景下的时间精度没那么重要,用us肯定是够了。


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