Skip to content

Conversation

@mgravell
Copy link
Collaborator

@mgravell mgravell commented Apr 8, 2020

in most ways it is similar to twemproxy, and you can make it just about work by manually configuring things in the config, but this makes everything better integrated, so all you need to do is use a config like "127.0.0.1,proxy=RedisClusterProxy", and everything else clicks into place automatically.

In particular:

  • configure the command map
  • default the port to 7777
  • disable the subscriber/server APIs
  • set a minimum redis version of 3 (because: cluster)
  • only work with DB zero (again, because: cluster)

work todo:

  • consider PROXY MULTIPLEXING on
    • find out whether MULTI resets MULTIPLEXING afterwards (it disables it during)
  • look into *SCAN cursor change

(it turns out that PROXY MULTIPLEXING on isn't a thing; it is on by default, and you can turn it off, or it gets turned off when you do the first MULTI; conclusion: just let the server worry about it)

@artix75
Copy link

artix75 commented Apr 8, 2020

@mgravell Hello, I'm the developer of Redis Cluster Proxy, thank you for trying it.

As for PROXY MULTIPLEXING ON, just some tip:

  • By default, every client is connected to a shared (multiplex) connection, as you said. The multiplexing mode is automatically disabled by some commands (ie. MULTI or blocking commands) that could not work properly in a shared connection, so that the client gets its own private connection to the cluster (multiplexing off). Alternatively, the command PROXY MULTIPLEXING OFF can be used to give the client a private connection, anyway, it has been designed for debugging purpose.
  • Disabling multiplexing for all the clients is an option, but it's dangerous since it could open too many file descriptors depending on the number of clients, so it's there for testing and debugging purposes too.
  • Every thread has a "connections pool" used to provide ready-to-use (already connected) sockets to clients with private connections, in order to speed-up query execution. The pool is automatically re-populated and its size and re-population (re-spawn) criteria can be set in the configuration.

@NickCraver NickCraver changed the base branch from master to main June 20, 2020 13:27
NickCraver added a commit that referenced this pull request Feb 8, 2022
This should make PRs like #1977 and #1425 much easier.
@NickCraver
Copy link
Collaborator

@mgravell ping, check out #1982 to base on for simplicity

@mgravell
Copy link
Collaborator Author

mgravell commented Feb 8, 2022

Consencus is that this proxy failed to launch; community guidance (there are literally no official responses) from here RedisLabs/redis-cluster-proxy#81 (comment) is to look to envoy instead, which is already covered above. Closing this.

@mgravell mgravell closed this Feb 8, 2022
NickCraver added a commit that referenced this pull request Feb 10, 2022
This should make PRs like #1977 and #1425 much easier.
NickCraver added a commit that referenced this pull request Feb 22, 2022
Envoy proxy for redis: https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/other_protocols/redis

Envoy does the heavy lifting of redis cluster instance discovery and partitioning commands among redis cluster instances from the clients to a set of proxy instances. Clients can round robin or randomly select a proxy to connect to and the proxy will do the right thing of picking the right cluster instance for a given command.

Apart from the glue of wiring up the new proxy in Enums and disabling pub/sub for the proxy (similar to Twemproxy), this PR contains the following major change in the primary node selection; When an envoy proxy mode is selected for connection, the check for verifying if the node is master or replica is disabled. In the envoy proxy world we can connect to any proxy instance. All we care about here is ensuring that the load is balanced between the proxy instances (which is accomplished through the current round-robin logic).

@mgravell raised a valid point offline that the order of operations wouldn't be guaranteed in this mode and this is indeed one of the limitation of this approach. The commands that form the foundation for redis transactions (exec, discard, multi, watch, unwatch) (https://redis.io/topics/transactions) are not supported by Envoy (https://github.com/envoyproxy/envoy/blob/main/source/extensions/filters/network/common/redis/supported_commands.h) and hence added to the exclusion list in PR.

The testing is inspired from this PR: #1425. Open to suggestions on that.

Co-authored-by: Nick Craver <[email protected]>
@NickCraver NickCraver deleted the cluster-proxy branch March 7, 2022 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants