Comments (8)
Pipelining is a mechanism to send commands without awaiting completion of the previous command. That's exactly the default configuration setting to have a balance between command processing and latency. Since a framework cannot make any assumptions on how long you will wait between sending commands you can configure LettuceConnectionFactory.pipeliningFlushPolicy
to your needs.
from spring-data-redis.
Pipelining is a mechanism to send commands without awaiting completion of the previous command. That's exactly the default configuration setting to have a balance between command processing and latency. Since a framework cannot make any assumptions on how long you will wait between sending commands you can configure
LettuceConnectionFactory.pipeliningFlushPolicy
to your needs.
If the default config is to submit a command every time, then what is the difference with loop to direct the command?
In jedis and lettuce, the default implementation of pipeline is the last to submit.
Why does spring-data want to change this?
from spring-data-redis.
then what is the difference with loop to direct the command?
Care to elaborate? I do not understand the question.
In jedis and lettuce, the default implementation of pipeline is the last to submit.
That's not true. Lettuce's async API submits commands without awaiting previous command completion. Also, there's no pipelining API. Also, Jedis sends commands to the pipeline directly, however, Jedis uses a BufferedOutputStream
that buffers a few commands (up to 8kb of data IIRC).
from spring-data-redis.
then what is the difference with loop to direct the command?
I mean if default policy is flushEachCommand ,it same as :
for (int i = 0; i < 100; i++) {
RedisTemplate.opsForValue().get("key:"+i);
}
in lettuce:,it pipeline is write all commands to the transport layer:
In my code I wanted to be able to submit all commands together, less network io, but after using spring-data -lettuce, all requests were submitted one by one,it causing the machine's out-of-heap memory to continue to rise, which made me feel very confused.
I notice Lettuce pipelining behaviour is different than Jedis pipelining.
and I think using pipeline, the default is to want to submit commands in batches, not one by one.
from spring-data-redis.
flushCommands
is in Lettuce only an optimization to use netty's buffering mechanism for additional command buffering. Using flushCommands
can be dangerous especially in multi-threaded arrangements.
If you're want to optimize for performance then using Lettuce directly is a good alternative.
from spring-data-redis.
What I mean is that pipeline should be more focused on batch submission, like the jedis implementation whitch buffer all commands and flush them to the transport at once, then it doesn't bother users.
But now the default policy in spring-data-redis is flushEachCommand,it can cause a lot of trouble for upgrades, and upgrades and switch implementations should not be such a big difference.so I think the default policy should be flushOnClose.
By the way ,in a production environment, direct use of redis pipeline policy of spring-data-redis , under certain conditions(it could be the Internet.), will cause off-heap memory to continue to rise, what is the reason for this? spring-data-redis
version is 2.7.1.
from spring-data-redis.
There's a difference between pipelining and batching. We do not want to force all users into a particular scheme that appears convenient in a specific application.
Your other question relates to Lettuce's buffering feature upon disconnect. Please refer to ClientOptions.disconnectedBehavior
and requestQueueSize
for configuration options.
from spring-data-redis.
But when we use pipeline, we want to be able to execute it in batches. I think this is more general. Each command is submitted as a special scenario.
Inotice that the client disconnected buffer queue is an unbounded queue, but why use off-heap memory here?
from spring-data-redis.
Related Issues (20)
- Pipelined usage of Redis Cluster with Lettuce fails for some commands that return `PipelinedRedisFuture` HOT 3
- `RedisCache.get(Object, Callable)` synchronizes on entire cache instead of individual keys HOT 1
- Release 3.1.12 (2023.0.12)
- Release 3.2.6 (2023.1.6)
- Release 3.3 GA (2024.0.0)
- AWS ElasticCache issue with Config command HOT 1
- Spring Speficification default Redis key generator HOT 2
- Use SET command instead of SETEX HOT 2
- Redis repository: Error while converting to Timestamp HOT 2
- Support Lettuce SSL/TLS Verification Modes HOT 1
- BITFIELD INCRBY does not work properly with multiplied by field type length offset
- `BITFIELD INCRBY` applies incorrect offset using Lettuce
- feature request: SINTERCARD in SetOperations
- Handle search aliased fields with special characters HOT 3
- Executing full-text queries by using Redis template HOT 4
- spring-boot-start-data-redis:2.3适配Redis6中sentinel HOT 1
- Release 3.2.7 (2023.1.7)
- Release 3.3.1 (2024.0.1)
- Release 3.4 M1 (2024.1.0)
- Redis standalone can't use application.properties to change Redis configuration HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-data-redis.