This topic describes how to verify the allocated read weights when read/write splitting is enabled.
To verify the load ratio of each read weight, you can run the select @@server_id;
command for 10,000 times by using persistent connections and collect the number of
times that each server_id
appears in the output.
Alternatively, you can check whether the load ratio of read weight is consistent with the distributed ratio by using one of the following two methods:
Verify the load ratio based on monitoring data in the console
- Log on to the RDS console.
- In the upper-left corner, select the region where the target RDS instance is located.
- Find the target RDS instance and click the instance ID.
- In the left-side navigation pane, click Monitoring and Alerts.
- On the Monitoring tab, select the monitoring type Engine Monitoring.
- View the TPS (Transactions per Second)/QPS (Queries per Second) chart to obtain the number of read and write operations on each of the master and
read-only instances.
Note Refreshing the TPS/QPS chart takes about five minutes.
- Compare the QPS/TPS of each instance to verify whether the load ratio is correct.
Verify the SQL load by directly connecting to each instance
You can view the number of SQL statements executed by each instance by connecting to the master database and read-only databases involving read/write splitting.
Run either of the following commands to verify the SQL load:
select * from information_schema.global_status where VARIABLE_NAME = 'COM_SELECT';
select * from information_schema.global_status where VARIABLE_NAME = 'COM_INSERT;