lettuce icon indicating copy to clipboard operation
lettuce copied to clipboard

Optimization idea: send GET to individual cluster shards instead of MGET when possible.

Open TimLovellSmith opened this issue 2 years ago • 1 comments

Feature Request

Is your feature request related to a problem? Please describe

Good news: I heard that lettuce is quite clever, and it can take MGET and multiplex it into a bunch of different shards. Bad news: It seems like when lettuce does this, it means MGET on a single key become a much more common scenario - especially if the client was not being sensitive to cluster sharding in their design.

Describe the solution you'd like

Good news: There's a semi-simple optimization for this - just send GET instead of MGET under the hood, when possible. This can save client and server resources, when it works, improving throughput and latency.

Describe alternatives you've considered

The main alternative I see is not doing this optimization, because its deemed overcomplicated.... or doing it in a more general way.

Teachability, Documentation, Adoption, Migration Strategy

If you can, explain how users will be able to use this and possibly write out a version the docs. Maybe a screenshot or design?

TimLovellSmith avatar Jun 29 '23 21:06 TimLovellSmith

Sounds good. We haven't considered using GET in a case where MGET slot hash splitting would yield a single key to be fetched.

mp911de avatar Jun 30 '23 08:06 mp911de