Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protocol feature proposal: RESP3 (+?) correlation (long term) #13240

Open
mgravell opened this issue Apr 30, 2024 · 1 comment
Open

Protocol feature proposal: RESP3 (+?) correlation (long term) #13240

mgravell opened this issue Apr 30, 2024 · 1 comment

Comments

@mgravell
Copy link

mgravell commented Apr 30, 2024

RESP is strongly FIFO, but occasionally - for a varied and complex set of reasons - protocol desync occurs, leading to incorrectly mating responses to their corresponding requests, in particular when using pipelining and/or multiplexing, or sometimes with redis proxy nodes between client and server. When this happens it might be noticed immediately, or it might not - depending on the commands and consequences. This can range from "mildly inconvenient" to "oh god, unplug everything right now and call the lawyers".

For people at the right-hand edge of that severity scale, I would like to propose, in some future version of redis, supporting entirely optional RESP3 attributes to communicate correlation, providing strong correctness guarantees - at the ticket price of "the client and server must support this, and you'll have some extra bytes in each message in both directions".

I'm also aware that attributes have silently disappeared from these docs, despite being here and here, and I know that no server or (AFAIK) clients currently handle them. Hence this isn't a "this week" thing. It is a "can we, as a community, work together to improve things in the long term, rather than constantly ignoring a problem because there is no immediate fix possible" thing.

Meat of the proposal:

Once inside RESP3 and having performed some version-check/handshake/whatever, clients can begin annotating messages with a preamble attribute, with a well-known key, cid perhaps ("correlation id"):

|1\r\n
+cid\r\n
$10\r\n
1029f737sd\r\n
{actual command here}

where the value passed (1029f737sd in the example) is opaque bytes with no meaning for the server. The server would, because of recognizing cid as a well-known meaning, echo the cid attribute as part of the response message:

|1\r\n
+cid\r\n
$10\r\n
1029f737sd\r\n
{actual response here}

With this, the client can have strong correctness guarantees about the response it is processing, and can immediately identify and burn a suspect connection.

@mgravell
Copy link
Author

mgravell commented Apr 30, 2024

Not sure this is really viable for a range of reasons; also discussing as above^^^ at the client-library level, but thought it was at least worth mentioning at the redis platform level - see if there's any interest or prior art.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant