Coder Social home page Coder Social logo

Comments (3)

Grokzen avatar Grokzen commented on May 23, 2024

By default, pipelines executes sequentially. When a pipeline executes it will still use a pipeline object for each node in the cluster. If you want to run the pipeline in concurrent mode you can use the flag pipeline_use_threads=True to use a experimental feature to run each pipeline for each node with threads. From what i know it works really well.

Transactions is a hard problem to solve because there is several ways of defining a transaction and implementing support for both solutions is very hard because there is several corner cases that needs to be handled for the implementation to work. In short the 2 main options is to have a transaction pipeline across the entire cluster, or that the commands that is sent to each node should be transaction but they are not dependent on each other. So if one of 4 would fail the other 3 would still execute and be commited to redis. Currently i have documented and suggested that transactions is not supported right now and should not be used.

You should really read up on the docs, specially this one https://github.com/Grokzen/redis-py-cluster/blob/unstable/docs/Pipelines.md that describes the problems and my thoughts on the problem and possible solutions.

Regarding MGET in pipelines, it is currently disabled because because if you run MGET keyA keyB keyC keyD and 2 of the keys belongs to 1 node in the cluster and 2 keys belong to another node, i can't just split the command into MGET keyA keyC and MGET keyB keyD and send them off to their nodes and then handle any errors, moved, asking errors that pops up and retry until it either works or fails.
The only somewhat viable solution to this problem would be to take the MGET command and replace that command with a series of GET commands that each fetches the all keys and after execution is done, reassembles the original MGET to make it appear to work. In theory you can already do this yourself manually by having a helper function that you call when you want to run MGET that splits it into multiple GET and puts them on the pipeline stack, but it is not something that will be supported for now.

from redis-py-cluster.

Grokzen avatar Grokzen commented on May 23, 2024

If that answers your questions, please close this issue. If you find some issue when trying something out, please open a new issue with a description of the problem. Also if you want to discuss this more, please join in the gitter chatroom (link in Readme) and ping me there.

from redis-py-cluster.

ppLorins avatar ppLorins commented on May 23, 2024

hi @Grokzen #92 , this is my issue,by your answer , when I set pipeline_use_threads=True, all the commands queued on pipe will be sent to their coresponding node in the cluster respectively ? And pipe.executes() will returns only after all the responses arrived ? This is the way I supposed the pipe's behavior to be

my gitter quesion , just for record .

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.