Coder Social home page Coder Social logo

Comments (5)

Ladicek avatar Ladicek commented on June 11, 2024

I think this is intentional. When we SUBSCRIBE, we don't know to which node we're connected, it is selected randomly. So when we want to UNSUBSCRIBE, we need to execute that command on all nodes.

from vertx-redis-client.

jabolina avatar jabolina commented on June 11, 2024

Yeah, that makes sense to me, a single request to each node. I believe that currently, it sends N times for the same node, where N is the number of slots a node owns.

It looks like in cluster mode from version 7+, pub/sub goes to a slot owner (https://redis.io/docs/interact/pubsub/#sharded-pubsub).

from vertx-redis-client.

Ladicek avatar Ladicek commented on June 11, 2024

Sharded pub/sub is done using SSUBSCRIBE, SUNSUBSCRIBE and SPUBLISH, so that's a different thing. What you have is not sharded. (I recently made a change where the sharded pub/sub commands are treated similarly to classic pub/sub, which was probably a mistake I made without understanding sharded pub/sub properly. I will have to revisit it.)

It seems super unlikely that we would send the command once for each slot, because the number of slots in Redis cluster is 16K. In the reproducing test you made, the cluster has 3 nodes, so I would expect the UNSUBSCRIBE command to be send 3x and hence there would be 3 responses to it. The total number of received messages in the test should IMHO be 5.

from vertx-redis-client.

jabolina avatar jabolina commented on June 11, 2024

Yeah, that's it. Coming back to the test now:

received msg [subscribe, sub-unsub, 1]
received msg [message, sub-unsub, hello]
received msg [unsubscribe, sub-unsub, 0]
received msg [unsubscribe, sub-unsub, 0]
received msg [unsubscribe, sub-unsub, 0]

One for each node. I believe we can safely close this one. Thanks for the help, and sorry about the noise.

from vertx-redis-client.

Ladicek avatar Ladicek commented on June 11, 2024

Sure thing, thanks for the confirmation!

from vertx-redis-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.