Bugfix/fix linear time search for registrations 5.0#159
Merged
zyclonite merged 4 commits intovert-x3:5.0from Apr 8, 2026
Merged
Conversation
- The original implementation flatten all the registrations into the keys of the Map. When we need to search for all registrations of an address, it uses query() and the complexity essentially grows with the number of registrations linearly. - Instead, we should make use of the constant time asscess in Map that we store address as the key so that when we search for all registrations, we directly get the result and we don't have to do linear time search among all registrations.
This reverts commit bce6cee.
zyclonite
added a commit
to zyclonite/vertx-ignite
that referenced
this pull request
Apr 9, 2026
zyclonite
added a commit
that referenced
this pull request
Apr 10, 2026
Fix binarizable issue introduced in #159
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation:
I'm switching between different cluster-managers in Vertx and I found out that in one situation, IgniteClusterManager performs way slower than HazelClusterManager. I have one Verticle frequently publishing to addresses that have not been subscribed by any consumer yet. Vertx continues to invoke clusterManager->getRegistrations(), and SubsMapHelper->get() takes up lots of cpu time. Having a look at the implementation between HazelClusterManager and IgniteClusterManager suggests that the IgniteClusterManager->SubsMapHelper->get() has performance issue when the number of registrations are large.
Solution:
The original implementation flatten all the registrations into the keys of the Map. When we need to search for all registrations of an address, it uses query() and the complexity essentially grows with the number of registrations linearly.
Instead, we should make use of the constant time assess in Map that we store address as the key so that when we search for all registrations, we directly get the result and we don't have to do linear time search among all registrations.
Comparison:
IgniteClusterManager.getRegistrationsBefore:


After:
Note:
Author @zyclonite provides the solution for keeping the atomicity.