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

ISPN-10602 Lazily register clustered listener for counters #9436

Merged
merged 1 commit into from Aug 10, 2021

Conversation

pruivo
Copy link
Member

@pruivo pruivo commented Jul 9, 2021

Only register the clustered listener when it is required. The clustered
listener has an impact on add operation performance.

https://issues.redhat.com/browse/ISPN-10602

Copy link
Member

@danberindei danberindei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pedro, a bit off-topic, but what's the advantage of weak counters if writes have to update the value synchronously (via the cluster listener) on all the cluster members?

@danberindei
Copy link
Member

I forgot one more question: have you considered also removing the counter listener when the last user listener is removed?

@pruivo
Copy link
Member Author

pruivo commented Jul 13, 2021

In the weak counter, the updates happen concurrently. Each node will keep track of the keys belonging to the weak counter and only perform writes in the keys where the node is the primary owner. You save 1 round trip and you avoid lock contention as well. In addition, the reads are local (reading a field in an object)

have you considered also removing the counter listener when the last user listener is removed?

I don't think users will remove listeners that often. I mean, adding a listener just to listen for a couple "time" and then remove it, it does not seem a frequent use case.
If you think otherwise, I can take look at it in this PR too.

Only register the clustered listener when it is required. The clustered
listener has an impact on add operation performance.
@pruivo
Copy link
Member Author

pruivo commented Jul 13, 2021

PR updated

@wburns wburns merged commit cd4ba9c into infinispan:main Aug 10, 2021
@wburns
Copy link
Member

wburns commented Aug 10, 2021

Integrated into main, thanks @pruivo !

@pruivo pruivo deleted the t_10602 branch August 16, 2021 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants