You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/04/14 18:28:09 UTC
[GitHub] [rocketmq] dugenkui03 commented on a diff in pull request #4169: [ISSUE #4099]Optimized the performance of sending traceMessage
dugenkui03 commented on code in PR #4169:
URL: https://github.com/apache/rocketmq/pull/4169#discussion_r850701643
##########
client/src/main/java/org/apache/rocketmq/client/trace/AsyncTraceDispatcher.java:
##########
@@ -243,113 +245,130 @@ class AsyncRunnable implements Runnable {
@Override
public void run() {
while (!stopped) {
- List<TraceContext> contexts = new ArrayList<TraceContext>(batchSize);
synchronized (traceContextQueue) {
- for (int i = 0; i < batchSize; i++) {
- TraceContext context = null;
+ long endTime = System.currentTimeMillis() + waitTimeThreshold;
+ while (System.currentTimeMillis() < endTime) {
Review Comment:
Set `waitTimeThreshold` to could ensure that all data could send out in 1000ms.
> 将`waitTimeThreshold`设置为500ms可以保证数据在本地保存时间不超过1000ms,如果想要减小该间隔、可修改endTime获取逻辑、如下。
```
long endTime = System.currentTimeMillis() + waitTimeThreshold / 2;
```
--
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-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org