Re: Inquiry about using mysql router with java (tomcat server)
Posted by: Filipe Silva
Date: January 18, 2017 05:29PM


This seems to be related to how Tomcat is managing the connections and the way your are using them. So, it all depends on how many connections the connection pool is managing, which connections are you getting from the connection pool and for how long the connection pool manager keeps the connections active.

You must have in mind that once a connection to the Router is established all queries you send through will be routed to the same underlying MySQL server, and this is so until the connection is closed. By setting the routing mode to "read-only", you only get the load-balancing effect when establishing different connections, if you keep using the same connection the load-balancing won't happen.

Considering that you are using a connection pool manager and that it doesn't really close the connections when they are returned to the pool, this means that each connection is bound to a specific MySQL server, eventually forever. In this case, the only load-balancing effect you could get is from the connection pool manager if in between successive requests and returns of connections you were getting a different one, obviously assuming that you are requesting connections from the connection pool often and not using the same one for all the queries. So, in this scenario, the MySQL Router only interferes in the MySQL servers selection once, i.e., when the connection pool manager initializes its connections the first time, after that everything would remain static, at least for the lifetime of each connection.

With regard to how the connection pool manager creates and manages its connections it all depends on how it is implemented. I can't really help you on that, sorry.

Hope that helps.

Options: ReplyQuote

Written By
Re: Inquiry about using mysql router with java (tomcat server)
January 18, 2017 05:29PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.