Introduction to the types of load balancing in Mycat
The SQL within the transaction, which defaults to the write node and starts with the comment / * balance*/, gets b according to balance= "1" or "2". For SQL within a non-transaction, read-write separation is enabled according to balance= "1" or "2" by default. If you start with the comment / * balance*/, you will go to write and solve some scenarios in which read-write separation has been enabled but requires real-time data acquisition with strong consistency.
Currently, there are three types of Mycat load balancer:
1. Balance= "0". The read-write separation mechanism is not enabled, and all read operations are sent to the currently available writeHost.
2. Balance= "1", all readHost and stand by writeHost participate in the load balancing of select statements. To put it simply, when the double master and double slave mode (M1-> S1 less M2-> S2, and M1 and M2 are the master and standby of each other), under normal circumstances, M2Magin S1 S2 participates in the load balancing of select statements.
3. Balance= "2", all read operations are randomly distributed on writeHost and readhost.
4. Balance= "3". All read requests are randomly distributed to the readhost corresponding to wiriterHost for execution. WriterHost does not bear the read pressure.