go-redis
go-redis copied to clipboard
CLIENT REPLY command
Hello,
I would like to thank you for this wonderful Redis client! It is serving me very well in my current project.
I'm hoping you can tell me whether it's possible to turn off server replies for the client. Redis has the following command: CLIENT REPLY
I'm running a lot of pipelined operations for which I don't require the reply. Because I am dealing with many values and a request-intensive system, I sometimes even get read timeouts when the Redis client tries to read the pipelined responses.
Is there any way I can turn off the replies in this client? I've looked for the CLIENT REPLY command but it is not implemented.
Thank you very much!
Hi,
This is not supported, but I guess we could add MutedPipeline
which would wrap pipeline commands with CLIENT REPLY OFF
and CLIENT REPLY ON
. I just doubt it is a good idea - I guess you can squeeze more performance with such approach, but you lose any confirmation that Redis actually processed commands you sent. And eventually you will have to properly scale Redis anyway to get more performance.
Just wanted to revisit this issue. I was thinking of using Redis streams for log aggregation, which may benefit from this feature.
More broadly, it would be beneficial for "fire-and-forget" workflows where the client isn't interested in parsing a response and some potential data loss is acceptable. In large pipeline writes, it would be nice to reduce i/o downtime from waiting/parsing the responses and also free up server memory from not having to buffer each response.
Happy to help implement this feature if you think it's worth pursuing. For pipeline operations specifically, I was thinking of creating a separate *Conn
and then sending a CLIENT REPLY OFF
before executing the pipeline. That way, you don't have to send a CLIENT REPLY ON
command at the end and also disrupt other clients which may need responses.
Cheers.