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

[5/5] Add Async MultiplexedClusterConnection #640

Open
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

utkarshgupta137
Copy link
Contributor

@utkarshgupta137 utkarshgupta137 commented Jun 24, 2022

Fixes #421.

This is the final PR for adding async connection support for cluster.

TODO:

  • Add tests
  • Add retry support
  • Add reconnect support
  • Profile & improve performance
  • Benchmark against other implementations (redis_cluster_async & fred.rs)
  • Add/improve docs

P.S. I've not added support for simple async connections, only multiplexed connections. I'm unaware of any benefits of the simple async connections.

@utkarshgupta137 utkarshgupta137 changed the title Cluster async Add Async MultiplexedClusterConnection Jun 24, 2022
@utkarshgupta137
Copy link
Contributor Author

@djc Can you do an initial review of these changes, after that I can proceed with adding tests/docs etc.

@djc
Copy link
Contributor

djc commented Jul 4, 2022

Since this is pretty big and complex I'd like to see this split into smaller commits. Each commit should pass the tests and be formatted correctly). If you can describe it in a single bullet, it should be a single commit. Also please rebase on current main (and submit clippy fixes in a separate PR, please).

@utkarshgupta137
Copy link
Contributor Author

@djc @jaymell I've rebased this PR onto main. Now we've 3 commits, each of which I think should be separated into individual PRs, after some initial reviews here. I'm not sure how I can further break down the 3 commits & also get it passing tests at the same time.
I would recommend you hide whitespace changes & then review each commit. I'll try to see if I can sub-divide the commits this weekend, but I doubt it would make the review much more straightforward. I think it would be helpful if we could connect over discord or something so we can discuss changes in a rapid-fire manner.

@djc
Copy link
Contributor

djc commented Jul 8, 2022

We have a Discord channel here: https://discord.gg/WHKcJK9AKP.

@jaymell
Copy link
Contributor

jaymell commented Jul 23, 2022

I just want to second @djc's request that we significantly break these changes down into smaller commits. The work looks promising, but we need to be very careful about lumping so many unrelated changes together.

@utkarshgupta137
Copy link
Contributor Author

@jaymell @djc Raised a PR with the first commit broken up: #653. Once that is merged, I can start working on the next one.

@utkarshgupta137
Copy link
Contributor Author

utkarshgupta137 commented Jul 28, 2022

@jaymell @djc Raised a PR with the 2nd commit broken up: #654. Now this PR only contains changes related to adding Async MultiplexedClusterConnection.

@neogenie
Copy link

neogenie commented Aug 21, 2022

Hi @djc @jaymell @utkarshgupta137

Any progress in this PR ? :)

@djc
Copy link
Contributor

djc commented Aug 21, 2022

See #653.

- implement proper builder pattern by adding `new` & `builder` methods to ClusterClient and `new` & `build` methods to ClusterClientBuilder
- deprecate & redirect `open` methods for ClusterClient & ClusterClientBuilder
- move build method to ClusterClientBuilder
- this is to simplify passing multiple params to & inside ClusterConnection impl
- use plain host:port node naming, even for TLS as the tls mode/insecure flag will always be the same for all connections
- move the connect method inside impl
- create new Connection directly instead of creating a Client first
- convert to methods & use required params from self instead of passing
- set connections within create_initial_connections & call refresh_slots
… cluster related params

- remove unnecessary RefCell from params
- this is to simplify passing multiple params to & inside the impl
- rename get_slots to parse_slots_response
- move coverage checks & Slot creation logic into this fn
- move CLUSTER SLOTS query logic out of this fn

- this to easily reuse this function in the Async impl
- since we only operate in 100% slot coverage scenarios, there is no point in maintaining random connection logic, which is supposed to help us find missing nodes in the cluster topology
- this also allows us to remove RefCell around connections & slots
- there is no point in using RefCell anymore
- this is to reuse the routing logic within ClusterConnection and also reuse it in async impl
…lots

- set write/read timeouts just after creating connection
- consolidate logic for create_initial_connections & refresh_slots connection creating/updating part into refresh_connections
- there is no point in having unnecessary indirection
- there is no point in having 2 different functions
@utkarshgupta137 utkarshgupta137 changed the title Add Async MultiplexedClusterConnection [5/5] Add Async MultiplexedClusterConnection Aug 23, 2022
- remove ClusterPipeline & add re-exports for Pipeline/pipe
- use `req_pipeline` instead of the packed version to avoid unpacking again for cluster
- move cluster-specific pipeline checks into the new req_pipeline trait function
@nihohit
Copy link
Contributor

nihohit commented Feb 1, 2024

@utkarshgupta137
Hi,
I see that you have multiple PRs for improving the cluster connection, that are based on old versions of the cluster. Are you interested in rebasing them, or can they be closed?

@utkarshgupta137
Copy link
Contributor Author

@utkarshgupta137 Hi, I see that you have multiple PRs for improving the cluster connection, that are based on old versions of the cluster. Are you interested in rebasing them, or can they be closed?

I've changed jobs & I don't use Redis anymore. I don't know the state of this crate at the moment & I'm not sure I've the bandwidth to make all the required changes. You're free to do with the PR as you like.

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

Successfully merging this pull request may close these issues.

is there support for async commands under cluster connection?
5 participants