This topic describes how to change read weights to balance loads among the read-only instances of a primary ApsaraDB for RDS instance. If read-only instances are heavily loaded and consequently cannot process read requests properly, the overall performance of your DB system decreases. In such cases, you can change the read weights of heavily loaded read-only instances to stop distributing read requests to them.
After a primary instance executes complex SQL statements, it transfers the binary logs generated from executing those SQL statements to its read-only instances. The read-only instances execute all the SQL statements recorded in the binary logs to replicate data from the primary instance. During the replication process, some read-only instances may be heavily loaded and consequently cannot process requests properly.
If the data replication from the primary instance to a read-only instance cannot be completed, run the show processlist; command to check the thread usage of the read-only instance.
- The primary instance must run the MySQL 5.6, MySQL 5.7, or MySQL 8.0 database engine and the High-availability or Enterprise Edition.
- The read/write splitting function must be enabled for the primary instance.
- Log on to the ApsaraDB for RDS console.
- In the upper-left corner of the page, select the region where the primary RDS instance resides.
- Find the primary instance and click its ID.
- In the left-side navigation pane, click Database Proxy.
- Click the Read/Write Splitting tab, and in the Basic Information of Read/Write Splitting section click Configure Read/Write Splitting.
- In the dialog box that appears, choose 0, and click OK.
, set the read weights of the heavily loaded read-only instances to Note
- After the read weights of the heavily loaded read-only instances are set to 0, no more read requests are distributed to the instances.
- After all complex SQL statements are executed and the data replication from the primary instance to every heavily loaded read-only instance is complete, you can change the read weights back to their original values.