pulsar icon indicating copy to clipboard operation
pulsar copied to clipboard

[improve][broker] Reduce topic watcher update overhead for large topic lists

Open void-ptr974 opened this issue 2 months ago • 1 comments

Search before reporting

  • [x] I searched the existing issues and did not find one tracking this specific optimization.

Motivation

When a matching topic is added or removed, TopicListWatcher computes a hash of its updated matching topic set. The current TopicList.calculateHash implementation copies and sorts the full collection before hashing it, even when the update changes only one topic.

For pattern subscriptions matching a large number of topics, frequent topic creation or deletion may make this repeated work significant. It would be useful to understand how the cost grows with topic count and update rate.

Possible improvement

Explore whether repeated work in this path can be reduced while keeping the existing topic-list hash semantics and client/broker reconciliation behavior compatible.

The choice of data structures or computation strategy is open for discussion.

Code references

void-ptr974 avatar Oct 01 '26 11:10 void-ptr974

Anyone interested is welcome to propose an approach and submit a PR for this improvement. The implementation details are open for discussion.

void-ptr974 avatar Oct 01 '26 11:10 void-ptr974