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

Executing Multi Slot commands through Envoy Proxy #2426

Closed
dceravigupta opened this issue Apr 1, 2023 · 6 comments
Closed

Executing Multi Slot commands through Envoy Proxy #2426

dceravigupta opened this issue Apr 1, 2023 · 6 comments

Comments

@dceravigupta
Copy link

I have a cache which consists of multiple standalone Redis instances all behind an Envoy Proxy. As per the Envoy documentation, it is capable of fanning out a multi slot command like MGET to the right Redis instances based on its hash slot. It works as expected when I run such commands through redis-cli.
image

But in my .NET application, when I issue such command through StackExchange.Redis, it throws an exception saying Multi-key operations must involve a single slot; Wondering is there any way to execute such operations in my step?

image

image
StackExchange.Redis.RedisCommandException HResult=0x80131500 Message=Multi-key operations must involve a single slot; keys can use 'hash tags' to help this, i.e. '{/users/12345}/account' and '{/users/12345}/contacts' will always be in the same slot Source=StackExchange.Redis StackTrace: at StackExchange.Redis.ServerSelectionStrategy.Select(Message message, Boolean allowDisconnected) in /_/src/StackExchange.Redis/ServerSelectionStrategy.cs:line 148 at StackExchange.Redis.ConnectionMultiplexer.SelectServer(Message message) in /_/src/StackExchange.Redis/ConnectionMultiplexer.cs:line 1828 at StackExchange.Redis.ConnectionMultiplexer.PrepareToPushMessageToBridge[T](Message message, ResultProcessor1 processor, IResultBox1 resultBox, ServerEndPoint& server) in /_/src/StackExchange.Redis/ConnectionMultiplexer.cs:line 1843 at StackExchange.Redis.ConnectionMultiplexer.TryPushMessageToBridgeSync[T](Message message, ResultProcessor1 processor, IResultBox1 resultBox, ServerEndPoint& server) in /_/src/StackExchange.Redis/ConnectionMultiplexer.cs:line 1905 at StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImpl[T](Message message, ResultProcessor1 processor, ServerEndPoint server, T defaultValue) in /_/src/StackExchange.Redis/ConnectionMultiplexer.cs:line 1966
at StackExchange.Redis.RedisBase.ExecuteSync[T](Message message, ResultProcessor1 processor, ServerEndPoint server, T defaultValue) in /_/src/StackExchange.Redis/RedisBase.cs:line 62 at StackExchange.Redis.RedisDatabase.StringGet(RedisKey[] keys, CommandFlags flags) in /_/src/StackExchange.Redis/RedisDatabase.cs:line 3028 at Program.<Main>$(String[] args) in C:\Users\ravgup\source\repos\ConsoleApp14\ConsoleApp14\Program.cs:line 10

@mgravell
Copy link
Collaborator

mgravell commented Apr 2, 2023

Is there a documented list of which operations support this? We could simply let these through and let the server worry about it - it would be a simple case of changing the envoy handling here to simply do break; - I guess it depends on how universal this feature is. I'm guessing it doesn't apply to rpoplpush for example.

@dceravigupta
Copy link
Author

dceravigupta commented Apr 2, 2023

@mgravell their documentation have not mentioned any such list. This is what their document mentioned on this topic.

image
https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/other_protocols/redis

Also, they don't support all the Redis commands at this moment and rpoplpush is one of them. They do have list of supported commands listed on the page above.

@mgravell
Copy link
Collaborator

mgravell commented Apr 2, 2023

Thoughts @NickCraver ? I'm thinking "disable the check" (i.e. just break; for envoy) - disagree at all?

@NickCraver
Copy link
Collaborator

+1 - this is only optimizing an error path to throw faster, if that's not 100% correct let's rip it out!

@mgravell
Copy link
Collaborator

mgravell commented Apr 3, 2023

PR: #2428

@dceravigupta
Copy link
Author

Thanks @mgravell and @NickCraver!

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

3 participants