bumingchun commented on PR #1763: URL: https://github.com/apache/incubator-brpc/pull/1763#issuecomment-1129862584
> 新老代码的主要差异在计算“实际的延时”这点上:老代码大约是用前1秒的平均延时,新代码是只用上一次访问的延时。这个差异可能难以得出“随程序运行时间变长,抖动出现的次数越来越多,发送地请求会越来越不均匀”这个结论。需要要进一步看看深层次的原因,可能和高qps场景下一些计算的精度不够关联更大。这个随机抖动场景是否能人为构造一下? @bumingchun 这样其他人也可以复现debug看看。 新代码计算expected_time的方式为(start_time + n * interval),其中start_time是发第一个请求的时间,n是请求个数,并不是依赖上一次的访问时延,程序启动的时间就决定了每个请求发送的expected_time,这种实现方式中expected_time不受抖动影响。旧的实现方式中抖动是会累计的,本次抖动会影响一个窗口过后请求的发送时间,并一直传递,所以我才有“随程序运行时间变长,抖动出现的次数越来越多,发送地请求会越来越不均匀”的结论。 按照你的提示@[jamesge](https://github.com/jamesge),我在发送代码中引入一个人为抖动,可以稳定复现该问题,具体代码在 [reproduce_rpc_press_issue](https://github.com/bumingchun/incubator-brpc/tree/reproduce_rpc_press_issue) 这里,大家可以参考一下。 利用修改后rpc_press压测echo_server(为了让接口延时变大,在代码中增加了一段for循环),压测4000qps,可以看到接口延时在持续上涨,并且concurrency波动很大。  同时我又修改了rpc_press中info_thread.cpp的代码,让其以10ms为间隔打印发送的请求数,可以看到压测一段时间后,每10ms发送的请求数很不均匀  压测命令为: ./rpc_press -proto=../../example/echo_c++/echo.proto -method=example.EchoService.Echo -server=xxx:8000 -input=./test_echo.json -qps=4000 -- 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]
