我对udp RPC方法进行了基准测试,该方法可能会丢弃数据包并导致超时。 结果可能是:
Iteration 20: 0.712 ms/op
Iteration 21: failed to receieve exception= com.my.rpc.exception.RPCInterfaceRuntimeException: request time out.
475.665 ms/op
Iteration 22: 0.824 ms/op
Iteration 23: 0.728 ms/op
Iteration 24: 0.765 ms/op
Iteration 25: 1.152 ms/op
Iteration 26: 1.216 ms/op
Iteration 27: 1.155 ms/op
Iteration 28: 1.238 ms/op
Iteration 29: failed to receieve exception= com.my.rpc.exception.RPCInterfaceRuntimeException: request time out.
5633.007 ms/op
由于可能发生超时,因此无法正确计算最终结果,例如:
Benchmark Mode Cnt Score Error Units
BenchmarkMain.queryBeers thrpt 90 1.020 ± 0.110 ops/ms
BenchmarkMain.queryBeers avgt 90 46.558 ± 155.295 ms/op
平均时间不在上方。
如何排除这些超时迭代以获得合理的结果?