I am using a remote redis master with a network latency (distance) of ~40ms.

I do: connect, auth, mset or connect, auth, pipeline

Because "auth" is a separate transfer, almost 1/3 of the total redis time is spent with auth (or the network latency of the auth command)

Would it be possible to "pipeline" the connect & auth together?

Comment From: moki

@kkmuffme Are you aware of the fact that you can auth by providing pw with an a flag? redis-cli -h <host> -p <port> -a <password> Sorry i can't make an assumption about your client.

Or is that irrelevant to the issue, and does not affect latency problem?

Comment From: antirez

Yes you can use pipelining to send AUTH + command, and you can do it while the connect is still pending AFAIK, from the POV of TCP/IP. The client need to support it however.

Comment From: kkmuffme

@moki yes I'm aware, but if you check this will send 2 commands still (connect + auth separately, instead of together)

@antirez which would mean that I need to send an unnecessary "auth" everytime I reuse the connection.

In an ideal scenario, redis would allow me to do it all at once (pipeline with connect, auth + mset), but I guess there would also be use cases for just connect+auth in one (honestly, everyone who uses redis with auth would benefit from this)

Comment From: antirez

I don't understand what you mean. Redis does not have any "connect" command, you just create a TCP connection to the server, and after the threeway handshake, in the final ACK you can already send data, and this could be the pipelined AUTH + MSET, so there is no loss at all, same number of packets needed, same latency.