Bing
Bing

Reputation: 51

Does lettuce support pipelining in redis-cluster?

Need to run a batch of commands in redis-cluster mode with lettuce.For commands that should run in one partition, i hope to run them in one node sequentially.

As i know, lettuce can support redis pipelining by set the AutoFlushCommands state to be false. But in redis-cluster mode, the command may be send to different nodes in one partition. Is there any way to avoid the problem?

Upvotes: 5

Views: 7193

Answers (1)

kisna
kisna

Reputation: 3127

It does, at least, according to Lettuce:https://redis.github.io/lettuce/advanced-usage/#pipelining-and-command-flushing

Command flushing is an advanced topic and in most cases (i.e. unless your use-case is a single-threaded mass import application) you won’t need it as Lettuce uses pipelining by default.

It means, it uses pipelining by default, I don't think this is true or clear, as it also mentions:

A flush is an expensive system call and impacts performance. Batching, disabling auto-flushing

The AutoFlushCommands state is set per connection and therefore affects all threads using the shared connection. If you want to omit this effect, use dedicated connections. The AutoFlushCommands state cannot be set on pooled connections by the lettuce connection pooling.

Which means, if you want true Redis pipelining http://redis.io/topics/pipelining, you can do that as well with some extra effort.

Upvotes: 4

Related Questions