bumingchun commented on code in PR #1763:
URL: https://github.com/apache/incubator-brpc/pull/1763#discussion_r873797780


##########
tools/rpc_press/rpc_press_impl.cpp:
##########
@@ -219,14 +219,8 @@ void RpcPress::sync_client() {
     }
     const int thread_index = g_thread_count.fetch_add(1, 
butil::memory_order_relaxed);
     int msg_index = thread_index;
-    std::deque<int64_t> timeq;
-    size_t MAX_QUEUE_SIZE = (size_t)req_rate;
-    if (MAX_QUEUE_SIZE < 100) {
-        MAX_QUEUE_SIZE = 100;
-    } else if (MAX_QUEUE_SIZE > 2000) {
-        MAX_QUEUE_SIZE = 2000;
-    }
-    timeq.push_back(butil::gettimeofday_us());
+    int64_t last_expected_time = butil::gettimeofday_us();
+    const int64_t interval = (int64_t) (1000000 / req_rate);

Review Comment:
   如果req_rate > 
100000,确实有你说的这个问题。但是考虑到单线程发送1百万qps是几乎不可能的,我在新代码中设置了单线程发送qps的上限为1百万,这也是一个合理的限制。同时使用nanosecond来计算interval,这样可以使高qps情况下interval计算更为准确。



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