I have following configuration for read-write splitting the load between maria1 and maria3; maria2 is used for backup purpose only so it has the last priority et weight=0.
I'm using Maxscale 2.1.4 and I don't know why but the SELECT statements go all into maria1, and none into maria3.
What should I check to troubleshoot this and to get lesser load on maria1?
Any help appreciated!
[RW]
type=service
router=readwritesplit
servers=maria1,maria2,maria3
max_slave_connections=1
router_options=slave_selection_criteria=LEAST_GLOBAL_CONNECTIONS,master_accept_reads=true
user=mastersplit
localhost_match_wildcard_host=1
weightby=myweight
[maria1]
type=server
address=10.181.111.74
protocol=MySQLBackend
priority=1
myweight=1
[maria2]
type=server
address=10.181.111.32
protocol=MySQLBackend
priority=3
myweight=0
[maria3]
type=server
address=10.181.111.14
protocol=MySQLBackend
priority=2
myweight=1
Hi,
To test that MaxScale works as you expect, try using the mysql command line client to connect to MaxScale. Executing SELECT @@hostname will allow you to see where the selects are going.
Reasons why SELECT statements can be sent to the master are:
For more details, refer to the ReadWriteSplit documentation and the Limitations document.
If you still have problems, let me know.
Markus
-- Markus Mäkelä, Software Engineer MariaDB Corporation t: +358 40 7740484 | Skype: markus.j.makela
The command SELECT @@hostname is always returning the first node's name even w/o the option master_accept_reads.
No limitation seems to interfere in this use case from what I've read on the provided links.
I attached a screen cap of the observed load of queries on all 3 servers grouped by query type.
Node 1 is getting all the load from maxscale and node 3 isn't even getting a part of the SELECT load.
The strange this is that maxscale's RW Split service show that 49% goes to a slave :
Number of queries forwarded to master: 17530969 (50.20%)
Number of queries forwarded to slave: 17392880 (49.80%)
Number of queries forwarded to all: 5062417 (14.50%)
But as master_accept_reads=1, it seems that master=master and slave=master too,
because there isn't event 10% load going to node 3.
Expected behavior would be :75% to master (50% as master + 25% because master_accept_reads=1) and 25% to slave node3.
Hi,
How many connections do you have open through MaxScale on
average? It's possible that with only one or two average
connections you'd see output like that.
The slave_selection_criteria=LEAST_GLOBAL_CONNECTIONS option combined with max_slave_connections=1 will pick two servers for each new session; a master and a slave. The root level master is always chosen as the master server and it does not count towards the slave server count. The server with the smallest amount of connections will be chosen as the slave. This means that each client connection picks the master node and one of the slave nodes. With this setup, connections are balanced equally but it alone does not guarantee that the number of queries to each server is balanced equally.
I'd suggest trying out the slave_selection_criteria=LEAST_CURRENT_OPERATIONS mode combined with max_slave_connections=100%. This is what we call the dynamic load balancing mode where the amount of active operations on each server is used to find the least busy server where the query is routed. With this, you should see equal load on all slave servers.
To figure out how the master_accept_reads parameter fits into this all, we will have to first know what the output of the service diagnostics mean.
Number of queries forwarded to master: 17530969 (50.20%) Number of queries forwarded to slave: 17392880 (49.80%) Number of queries forwarded to all: 5062417 (14.50%)
The first number is how many queries classify as queries that must be routed to a master (e.g. INSERT, DELETE). The second number is how many queries classify as read-only queries that do not modify either the database or the connection state. These are mainly SELECT statements that only read data. The last number is how many queries must be routed to all active connections because they somehow change the state of the connection (e.g. SET commands, changing default database).
Looking at that output, you seem to have a roughly 50/50 split of reads and writes which means that you should see at least 50% of the load on the master, as you yourself stated, and the remaining 50% of the reads should be split across all servers that qualify as a slave. The master_accept_reads parameter controls whether the master is included in the list of servers that can be a target of a read-only query. With a three node setup, this causes all thee servers to be considered as slaves.
I'd recommend tracking the output of maxadmin show servers
to see how many active operations each server has. This should
give a good picture of how many operations MaxScale thinks are
running on each server. It's not perfect for this particular
purpose but it should be an indicator of whether load balancing
works.
I think we could improve the diagnostic output of the readwritesplit router to show per server statistics of the load. Showing this for each server alone would also be a good way to display it.
Markus
Hi,
That's great to hear! Let us know if you run into any more strange behavior.
Markus
--
You received this message because you are subscribed to the Google Groups "MaxScale" group.
To unsubscribe from this group and stop receiving emails from it, send an email to maxscale+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi,
It seems the replication lag between the master and the slaves could not be measured. This probably means that the absolute lag measurement done in the monitor is not working.
Are there any errors in the MaxScale log? If there are, they
should point to what is wrong with the replication lag
measurement.
Markus
--
You received this message because you are subscribed to the Google Groups "MaxScale" group.
To unsubscribe from this group and stop receiving emails from it, send an email to maxscale+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
-- Markus Mäkelä, Senior Software Engineer MariaDB Corporation t: +358 40 7740484 | IRC: markusjm@freenode