Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve refreshMetadataIfNecessary in BrokerPool #1612

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mkocsar
Copy link

@mkocsar mkocsar commented Aug 18, 2023

The performance problem which this PR addresses is described in Performance degradation when sending messages to thousands of topics.

Functionality-wise the updated code is identical to the original, but it has O(n log n) runtime complexity instead of O(n^2) which becomes relevant if a client publishes to multiple thousands of topics.

Measured improvement (using mkocsar/test-send-duration.js):

Topics 'send' duration
(original)
'send' duration
(updated)
1 2.080 ms 1.835 ms
10 2.161 ms 1.999 ms
100 2.760 ms 2.056 ms
250 3.947 ms 2.212 ms
500 6.145 ms 2.238 ms
1000 15.741 ms 2.658 ms
1500 18.794 ms 2.981 ms
2000 19.272 ms 3.389 ms
2500 19.718 ms 3.853 ms
3000 23.959 ms 4.299 ms
3500 31.592 ms 4.286 ms
4000 41.728 ms 4.692 ms
4500 53.501 ms 4.864 ms
5000 65.370 ms 5.047 ms

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant