dugenkui03 commented on PR #4099:
URL: https://github.com/apache/rocketmq/pull/4099#issuecomment-1108885876

   > I think there's no need to be so precise. The logic is a little 
complicated.
   
   最新的代码已经在 pr-4180 中进行review,其实我认为这个优化是十分有意义的。我们可以简单做下分析:
   
   100个会发送给不同traceTopic的轨迹消息生产者均以 1个/ms 
的速度提交轨迹消息,那么原始的算法每次循环结束都会进行100次网络IO发送消息、因为消息要发送给100个不同的traceTopic。100ms中100次循环就会产生1w次网络IO。但最优思路应该是对这100ms中产生的消息按照要发送的traceTopic进行分组然后发送,最优次数应该是100次、而非1w次。
   
   
而优化的算法则是持续不断的将这些不同目标traceTopic的数据分配到traceTopic对应的缓存对象`TraceDataSegment`中,直到`TraceDataSegment`中数据大小达到指定阈值、或者存放时间达到指定阈值。至于实现,将逻辑捋顺了只要很少的代码即可。
   
   
   
   


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

Reply via email to