Sharing one connection amongst multiple threads is the intended usage. There are multiple reasons:
- Connections are threadsafe.
- Redis is single-threaded. Using multiple connections to one host makes obviously no sense as there is no performance gain due to the lack of Redis processing parallelism.
- Connection pooling opens multiple connections. Although this might make sense for transaction and blocking command isolation, pooling may cause performance degradation. A single Redis server that receives connections from multiple application servers is kept busy in the first place with accepting and managing connections. The single-threaded Redis nature affects also the process of accepting and dropping connections.
Regarding pipelining: lettuce does not await command completion before sending subsequent commands to Redis which means lettuce uses pipelining by default. The only way to prevent pipelining is outside synchronization on command invocation.
Each command is flushed directly to the TCP connection. Lettuce can use batching to group commands before flushing them to the connection. Command flushing is a manual thing and more intended for bulk loading and not for reactive use.
There are two more things:
- The wiki should answer your questions in a deeper level of detail: https://github.com/mp911de/lettuce/wiki
- Lettuce migrates away from RxJava 1 to a Reactive Streams API based on Project Reactor. That happens with lettuce 5.0 of which the first beta is already available.