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

Load balancing/connection pooling #978

Closed
jseldess opened this issue Jan 9, 2017 · 8 comments
Closed

Load balancing/connection pooling #978

jseldess opened this issue Jan 9, 2017 · 8 comments
Labels
O-external Origin: Issue comes from external users. T-enhancement

Comments

@jseldess
Copy link
Contributor

jseldess commented Jan 9, 2017

We should document multiple strategies with code samples in various langauges.

Possible strategies to cover (taken from @arjunravinarayan's response to this forum post):

  1. Configure the client driver to connect to multiple node URLs for failover tolerance/performance.
  2. Set up a proxy server (such as HAProxy) that provides a single connection URL for the client, and have HAProxy provide load balancing/failover resilience.
  3. Use DNS aliases with DNS round-robin load balancing.

2 and 3 seamlessly take advantage of cluster changes (e.g., a cockroach cluster growing to more nodes, or migrating nodes), without needing clients to be aware.

Related: #448

@jseldess jseldess added O-external Origin: Issue comes from external users. T-enhancement labels Jan 9, 2017
@InAnimaTe
Copy link

InAnimaTe commented Mar 13, 2017

Regarding the HAProxy (LB) method in general, there needs to clarification on configuration i.e. should there be concerns about session affinity, what are the best timeout settings to use, what balancing strategy should be utilized etc..

Really excited to see how this pans out. Making clients only need to be aware of a single endpoint to access a replica set is definitely awesome.

EDIT: Probably don't exactly need session affinity since CockroachDB supports distributed transactions (nice!). Although I'm not sure how authentication would work etc..

jseldess pushed a commit that referenced this issue Mar 29, 2017
- Add docs on using `cockroach gen haproxy`
- Add HAProxy load balancing to manual deployement docs; fixes #1203
- Add GCE managed load balancing to GCE deployment docs
- Add AWS managed load balancing to AWS deployment docs
- Add Azure managed load balancing to Azure deployment docs
- Add Digital Ocean managed load balanced to DO deployment docs

Partially address #978; might still add docs on configuring
client drivers to connect to multiple node URLs
jseldess pushed a commit that referenced this issue Mar 29, 2017
- Add docs on using `cockroach gen haproxy`
- Add HAProxy load balancing to manual deployement docs; fixes #1203
- Add GCE managed load balancing to GCE deployment docs
- Add AWS managed load balancing to AWS deployment docs
- Add Azure managed load balancing to Azure deployment docs
- Add Digital Ocean managed load balanced to DO deployment docs

Partially address #978; might still add docs on configuring
client drivers to connect to multiple node URLs
jseldess pushed a commit that referenced this issue Mar 30, 2017
- Add docs on using `cockroach gen haproxy`
- Add HAProxy load balancing to manual deployement docs; fixes #1203
- Add GCE managed load balancing to GCE deployment docs
- Add AWS managed load balancing to AWS deployment docs
- Add Azure managed load balancing to Azure deployment docs
- Add Digital Ocean managed load balanced to DO deployment docs

Partially address #978; might still add docs on configuring
client drivers to connect to multiple node URLs
jseldess pushed a commit that referenced this issue Mar 30, 2017
- Add docs on using `cockroach gen haproxy`
- Add HAProxy load balancing to manual deployement docs; fixes #1203
- Add GCE managed load balancing to GCE deployment docs
- Add AWS managed load balancing to AWS deployment docs
- Add Azure managed load balancing to Azure deployment docs
- Add Digital Ocean managed load balanced to DO deployment docs

Partially address #978; might still add docs on configuring
client drivers to connect to multiple node URLs
@jseldess
Copy link
Contributor Author

Status:

  • Updated manual deployment tutorials to feature HAProxy load balancing.
  • Updated Digital Ocean and GCE tutorials to feature platform-managed load balancing.

To do:

  • Improve load balancing guidance for Azure and AWS.
  • Consider whether to cover configuring client drivers to connect to multiple node URLs (@mberhault, is this important to cover?)

@alanhamlett
Copy link

Instead of implementing load balancing in every client driver, which is difficult to maintain, why not do what RethinkDB did and let the cockroach binary have a proxy mode thats used to load balance at each client?

@jseldess
Copy link
Contributor Author

@alanhamlett, thanks for the suggestion! Since it is a feature request, would you mind opening an issue in the cockroach repo?

@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.

@jseldess
Copy link
Contributor Author

@awoods187, @knz, @bdarnell, since this issue was opened, we added quite a bit of guidance around load balancing:

That links out to environment-specific load balancing guidance in our deployment tutorials.

Our docs still don't cover driver-level connection pooling. Is this something we should consider for 2.2 docs?

@bdarnell
Copy link
Contributor

I think any further changes in this area are probably low-priority; we've covered the important stuff (and we're recommending managed load balancers in most cases which should be reliable). The main thing that would be left would be to talk about running two HAProxy instances for the manual deployment case, and balance between them on the client side.

@jseldess
Copy link
Contributor Author

Given @bdarnell's last comment, closing this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-external Origin: Issue comes from external users. T-enhancement
Projects
None yet
Development

No branches or pull requests

5 participants