Coder Social home page Coder Social logo

Comments (6)

Grokzen avatar Grokzen commented on June 5, 2024 1

The first iteration i did for the pubsub support i found out that the return from a publish command about how many clients that recieved the message was not accurate and it was only taking into account how many clients that was connected to that specific node that the publish command was talking to. Because of this, the compatibility with the existing publish/subscribe API and mechanics that is used by redis-py compatible software would be broken and redis-py-cluster could not act as a drop-in replacement to provide seamless compatibility. The only fix at that time was to have all clients talk to the same node because that would ensure that it would still work as expected.

Sinc then some things have changed because i now know that you can use the slot hashing mechanism to distribute the clients on all nodes but still do it in a predictable way and the pub/sub API would work as expected, however then you hit the performance problem that still plagues redis internally and that is described in the docs.

from redis-py-cluster.

Grokzen avatar Grokzen commented on June 5, 2024

The pubsub implementation inside this lib is going to be removed and the work is happening in this PR #115. Pubsub should not be used in a cluster environment right now and you can read up on why here https://github.com/Grokzen/redis-py-cluster/blob/unstable/docs/Pubsub.md

The only time i will consider to add pubsub back into this lib, is redis itself reworks their implementation to be more cluster friendly.

from redis-py-cluster.

melhin avatar melhin commented on June 5, 2024

Thanks for the update @Grokzen . But i just wanted to know why when i do a plain publish using the redis-cli the connections are returned and when i do a publish with the redis-cluster it hoggs on one particular node, any specific reason for that ?

from redis-py-cluster.

melhin avatar melhin commented on June 5, 2024

Ok so i was still curious with the connection leakage problem with publish so after some digging around i found in rediscluster/connection.py get_connection there was this tag

  • TODO: Pop existing connection if it exists.

So in release you were removing it from _in_use_pubsub_connections and then you blindly appended the connection to _available_pubsub_connections so a lot of publish connections stayed on and eventually causing the file limits on the system to get exhausted

I have created a pull request with this change . Let me know if im on the right track
#130

from redis-py-cluster.

Grokzen avatar Grokzen commented on June 5, 2024

I worked some on this problem today and took a deeper look and compared my implementation to how redis-py handles connections in the pool and i saw several flaws with my implementation. I have now reworked the connection_pool code to be more similar to redis-py and how it works in there. It also means that it impacts pubsub code because those connections is no longer tracked in a different variables. You can see the code here #136 and it should superseed your PR #130 where it should fix the same problems and more.

from redis-py-cluster.

Grokzen avatar Grokzen commented on June 5, 2024

Fixed in unstable and included in release 1.2.0

from redis-py-cluster.

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.