For more information on MySQL Load Balancer, including how to be
included in the beta programme, contact
<enterprise-beta@mysql.com>.
When using the MySQL Load Balancer, you must adapt your application to work with the connections provided by the MySQL Load Balancer interface, rather than directly to MySQL servers. The MySQL Load Balancer supports the same MySQL network protocol - you do not need to change the method that you use to communicate with MySQL. You can continue to use the standard MySQL interface appropriate for your application environment.
On each client, you should configure your application to connect to port 4040 on the machine on which you started the MySQL Load Balancer. All MySQL connections for read queries should be sent to the MySQL Load Balancer connection. When a client connects, the connection is routed by MySQL Load Balancer to an appropriate MySQL server. All subsequent queries on that connection will run be executed on the same backed MySQL server. The backend will not be changed after the connection has been established.
If MySQL Load Balancer identifies an issue with the backend MySQL server, then connections to the backend server are closed. Your application should be adapted so that it can re-open a connection if it closes during execution, re-executing the query again if there is failure. MySQL Load Balancer will then choose a different MySQL server for the new connection.
The thresholds with which the monitor considers a slave to be too
far behind are specified in the
monitor-backends.lua file. By default it
checks for information obtained by SHOW SLAVE
STATUS, namely Seconds_Behind_Master
and tries to calculate the amount of data (in bytes) the slave has
to read from the master. The default values for those metrics are
10 seconds and 10 kilobytes, respectively.
You need to restart the MySQL Load Balancer if you change the
monitor-backends.lua script while it is
running. This is different from MySQL Proxy, which automatically
reloads a script if you modify the script during execution.
The load balancing algorithm is specified in the
monitored-ro-balance.lua script. For this
release, it keeps a counter of how many queries each backend has
executed and always picks the backend with the least number of
queries. Look at connect_server() and
pick_ro_backend_least_queries() for the code.

User Comments
Add your own comment.