Skip to content

Optimized the algorithm of trace message send. #4098

@dugenkui03

Description

@dugenkui03

FEATURE REQUEST

algorithm before

Take batchSize loop calls then submit request, set 5ms timeout for every loop;

algorithm now

Submit request after take batchSize loop calls or wait maxWaitTime;

why better

In an operation of 'submit request', the new algorithm will send more data if there isn't any data in traceContextQueue more than 5ms.

describe in Chinese

优化AsyncTraceDispatcher 中的 消息发送算法。

之前的逻辑:轮询 batchSize 次获取数据,超过 5ms 则中断数据获取;

当前的逻辑:当获取 batchSize 个数据、或者500ms后,进行一次发送请求-如果有数据的话,500ms是最长等待时间、有之前的逻辑 5ms*batch计算所得;

优化的场景:在一个发送窗口中,如果有超过5ms间隔没有消息、会导致之前的算法存在没有获取到数据的轮询,则之前的算法会比当前的算法少发送数据。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions