Understanding auto flush in async client #2282
Replies: 1 comment
-
When people think of Redis pipelining, I think they equate it to batching, but the two are slightly different. Pipelining sends multiple commands to Redis before awaiting the result of them. This can be achieved with and without auto-flush using the async interface in lettuce. There is, however, a difference in how the commands are sent to Redis. With auto-flush, each command is sent in a separate TCP packet, which means you will have significantly more network overhead (and context switching overhead) to send the command. When you flush lettuce manually, the commands are sent in as few packets as possible (you can see this if you look at the traffic with Wireshark). From the docs, you can use the command interface directly if you want lettuce to auto-batch your commands, but I haven't looked at this myself yet. |
Beta Was this translation helpful? Give feedback.
-
We are planning to switch our redis client from jedis to lettuce. One of the feature we are looking is pipelining commands.
Behaviour in Jedis:
We simply call sync on pipeline object to send all the commands to redis. The commands are batched together by client and a single request is made to redis.
How to achieve the same in lettuce
or
Beta Was this translation helpful? Give feedback.
All reactions