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

Support fault tolerance and load balance with vert.x pool of reactive mysql client #31852

Conversation

benstonezhang
Copy link
Contributor

Add support to config load balance url for reactive mysql datasources in application.properties, for example

quarkus.datasource.reactive.url=mysql:loadbalance://192.168.32.101:3306,192.168.32.102:3306/dbname

or more simple

quarkus.datasource.reactive.url=mysql://192.168.32.101:3306,192.168.32.102:3306/dbname

…reactive-mysql-client-quarkus3-fix

# Conflicts:
#	extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/MySQLPoolRecorder.java
@Sanne
Copy link
Member

Sanne commented Mar 15, 2023

LGTM in principle, but I've never used this capability; better to rely on review from others about it being suitable.

Wouldn't it need some documentation changes?

It certainly needs to be squashed.

@Sanne Sanne requested a review from tsegismont March 15, 2023 10:37
@quarkus-bot

This comment has been minimized.

@benstonezhang
Copy link
Contributor Author

@Sanne I expect no document change needed. The PR just try to mimic load balance url supported by MySQL Connector/J driver. With this patch, we can use similar url for reactive datasource of mysql too.
You can refer to issue #31492 for more information.

@cescoffier
Copy link
Member

PArodn my ignorance, but it's fault tolerance, right? Is fatal tolerance a thing in MySQL?

@benstonezhang
Copy link
Contributor Author

@cescoffier Here the fault tolerance is about connection to mysql. With vert.x pool of mysql client, we can create connections to the servers in pool. In case of one server down and cause an active connection is broke, we still can use other alive connections in pool.

@gastaldi gastaldi linked an issue Mar 15, 2023 that may be closed by this pull request
@cescoffier cescoffier removed their request for review March 15, 2023 16:03
@cescoffier
Copy link
Member

We need @tsegismont review - he is the expert.

@cescoffier cescoffier changed the title Support fatal tolerance and load balance with vert.x pool of reactive mysql client Support fault tolerance and load balance with vert.x pool of reactive mysql client Mar 15, 2023
@Sanne Sanne removed their request for review March 15, 2023 22:07
@tsegismont
Copy link
Contributor

I'll review it today.

Copy link
Contributor

@tsegismont tsegismont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @benstonezhang

I think it is a good idea to support connection load-balancing.

Nevertheless, instead of parsing the url, I would prefer we change its type in DataSourceReactiveRuntimeConfig:

Instead of a Optional<String> field, we could have Optional<List<String>>.

Existing configurations wouldn't be broken, and users could configure it with either several values comma-separated, or Indexed Properties.

@benstonezhang
Copy link
Contributor Author

That's great. It would be more clear.

@benstonezhang
Copy link
Contributor Author

@tsegismont The change of DataSourceReactiveRuntimeConfig would have bigger impact. What's the action I can take by now?

@tsegismont
Copy link
Contributor

Right, the change would be relatively bigger. On the other hand, it would be more maintainable on the long term. If you're willing to update the PR, I will review it.

@benstonezhang
Copy link
Contributor Author

OK. I will work on it and update the PR.

@benstonezhang
Copy link
Contributor Author

@tsegismont I create a new PR #31994 name as "Support config reactive datasource with list of database urls for fault tolerance and load balance". Please review.

@benstonezhang
Copy link
Contributor Author

PR move to #31994. Close this one.

@quarkus-bot quarkus-bot bot added the triage/invalid This doesn't seem right label Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Loadbalance for reactive mysql client
4 participants