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

cli: client side load balancing through proxy mode #24001

Closed
alanhamlett opened this issue Mar 18, 2018 · 6 comments
Closed

cli: client side load balancing through proxy mode #24001

alanhamlett opened this issue Mar 18, 2018 · 6 comments
Labels
A-cli-client CLI commands that pertain to using SQL features A-server-networking Pertains to network addressing,routing,initialization C-wishlist A wishlist feature. no-issue-activity O-community Originated from the community T-server-and-security DB Server & Security

Comments

@alanhamlett
Copy link

alanhamlett commented Mar 18, 2018

FEATURE REQUEST

Ability for cockroach to run in a proxy mode, where it acts as a load balancer for the localhost machine to connect to the cluster. Instead of connecting to <node1 address>:26257/<database> you would run cockroach proxy --join=<node1 address>:26257,<node2 address>:26257 then the client connects to localhost:26257/<database> and it's queries are automatically load balanced to nodes in the cluster.

Think of it like the current haproxy load balancing setup running locally on each client.

An extra bonus would be discovering all node addresses automatically from an initial subset of node addresses.

Related to cockroachdb/docs#978.

This is a Nice-to-have. Current work-around is using a single load balancer for all clients.

Jira issue: CRDB-6359

@thibaultmeyer
Copy link

thibaultmeyer commented Mar 18, 2018

PostgreSQL driver already has this feature, at least the Java version.

jdbc:postgresql://node1,node2,node3/accounting?loadBalanceHosts=true

Coupled with a pool connection (like HikariCP), you could have, by instance, 10 open connections dispatched between n nodes.

@alanhamlett
Copy link
Author

Yes, but clients in other languages don't support multiple connections. Instead of implementing load balancing in all the client libraries it's easier to just run a local load balancer. Also, this way the load balancer knows about Cockroach's routing and could auto-discover nodes that are part of the cluster.

@knz knz changed the title Client side load balancing through proxy mode cli: client side load balancing through proxy mode Jul 21, 2018
@knz knz added C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) O-community Originated from the community A-cli labels Jul 21, 2018
@alanhamlett
Copy link
Author

RethinkDB used proxy nodes and one feature was offloading query processing to clients:
rethinkdb/docs#962

Instead of just acting like a load balancer, could a cockroach proxy also offload some query planning to clients?

@knz
Copy link
Contributor

knz commented Apr 17, 2020

@andreimatei in case you need a tracking issue for your work, this one already exists.

@knz knz added A-cli-client CLI commands that pertain to using SQL features C-wishlist A wishlist feature. and removed A-cli C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) labels Mar 20, 2021
@jlinder jlinder added the T-server-and-security DB Server & Security label Jun 16, 2021
@knz knz added the A-server-networking Pertains to network addressing,routing,initialization label Jul 29, 2021
@github-actions
Copy link

We have marked this issue as stale because it has been inactive for
18 months. If this issue is still relevant, removing the stale label
or adding a comment will keep it active. Otherwise, we'll close it in
10 days to keep the issue queue tidy. Thank you for your contribution
to CockroachDB!

@knz
Copy link
Contributor

knz commented Sep 26, 2023

We recommend haproxy and pgbouncer for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cli-client CLI commands that pertain to using SQL features A-server-networking Pertains to network addressing,routing,initialization C-wishlist A wishlist feature. no-issue-activity O-community Originated from the community T-server-and-security DB Server & Security
Projects
No open projects
Status: Done 21.2
Development

No branches or pull requests

4 participants