#26802·pulsar

[improve][broker] Improve topic watcher notification dispatch scalability

Author: void-ptr974Created Oct 1, 2026Updated Oct 1, 2026

Search before reporting

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

Motivation

Broker-side topic list watchers support pattern subscriptions. In the current implementation, TopicResources.handleNotification iterates over the registered topic listeners and matches each listener's namespace pattern against the metadata notification path.

As a result, a topic creation or deletion in one namespace also involves listener-matching work for watchers associated with other namespaces. This path may become more expensive when a broker has many watchers spread across namespaces, especially during bursts of topic creation and deletion.

Possible improvement

It would be useful to evaluate how notification dispatch scales with the number and distribution of watchers, and explore opportunities to reduce unnecessary work while preserving listener lifecycle and notification behavior.

The implementation approach is open for discussion.

Code reference

TopicResources.handleNotification on the reviewed master revision