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

pipeline and transactions should not be the same #23

Closed
twidi opened this issue Mar 30, 2010 · 10 comments
Closed

pipeline and transactions should not be the same #23

twidi opened this issue Mar 30, 2010 · 10 comments

Comments

@twidi
Copy link
Contributor

twidi commented Mar 30, 2010

Since your commit bd411f9 redis-py executes pipelines atomically with MULTI/EXEC commands.
But pipelines and transactions are not the same, redis can handle a pipeline without MULTI/EXEC as before, and sometines it's what we want. After a long talk with Salvatore/Antirez, the two ways should be provided (transactions use more memory and are a bit slower).
Maybe an option to the pipeline command ?

@andymccurdy
Copy link
Contributor

Ya, that probably makes sense.

@twidi
Copy link
Contributor Author

twidi commented Mar 30, 2010

for example, a pipeline with a lot of sadd or zincr may not need to be atomic

@kmerenkov
Copy link
Contributor

What is a pipeline then if not MULTI/EXEC? There is no other pipeline or transaction in redis.

If you don't need sadd or zincr to be atomic then issue them one by one and you will get exactly what you want.

@andymccurdy
Copy link
Contributor

The benefit to pipelining without MULTI/EXEC would be speed of execution. Think batch data loading.

@twidi
Copy link
Contributor Author

twidi commented Mar 31, 2010

yes andy got the point

@kmerenkov
Copy link
Contributor

The only difference between Pipeline with MULTI/EXEC removed and sending commands one by one yourself is this:

When you use Pipeline and have 10 commands to send, connection.send (i.e. writing into socket) will be called 1 time (all your commands concatenated).

Without Pipeline for 10 commands connection.send() will be called 10 times. But I think that this is not a serious optimization at all.
You may save on saving one big packet instead of 10 small but... is it that critical? Maybe TCP_NODELAY option ought to be removed (or made optional) instead?

I think it is a false impression of efficiency.

If I got it all wrong, please tell me (because I am really interested).

@twidi
Copy link
Contributor Author

twidi commented Mar 31, 2010

With thousands of commands, even if it's just a small optimization, it counts... and it's a feature provided by redis so why should we ignore it ?

@kmerenkov
Copy link
Contributor

No we shouldn't. But now it is clear what is needed.
Sounds good!

@andymccurdy
Copy link
Contributor

Pipeines can not optionally be transactions (wrapped in MULTI/EXEC) or not by passing the transaction parameter. This closed by 74d4666.

@andymccurdy
Copy link
Contributor

This has been fixed in 74d4666

dbravender pushed a commit to dbravender/redis-py that referenced this issue May 6, 2014
…r not by passing the transaction parameter. This fixes redis#23.
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants