To verify the load ratio of read weight, you can run the
select @@server_id; command for 10,000 times using persistent connections and count the number of each server_id in the output.
Alternatively, you can verify whether the load ratio of read weight is consistent with the distributed ratio using the following methods:
Verify the load ratio with the monitoring data on the console
- Log on to the RDS console.
- Select the region where the target instance is located.
- Click the target instance ID to enter the Basic Information page.
- Select Monitoring and Alarms in the left-side navigation pane to enter the Monitoring and Alarms page.
- Select the monitoring type Engine Monitoring in the Monitoring tab.
- You can see the number of reads/writes of each database (master database and read-only database involved in the read/write splitting) by viewing the TPS (Transaction Per Second)/QPS (Query Per Second) data.
Note The refresh of TPS/QPS performance data takes about five minutes.
- Compare the QPS/TPS of each database to verify whether the load ratio is correct.
Verify the SQL load by directly connecting each database
You can view the number of SQL statements run by each instance by connecting the master database and read-only databases involved in read/write splitting.
|To perform this verification, the connection addresses of the master database and read-only databases instead of the read/write splitting addresses are needed.|
Run any 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;