After enabling read/write splitting, you can configure the latency threshold and read weights of instances.
- Log on to the RDS console.
- Select the region where the target instance is located.
- Click the ID of the target instance to enter the Basic Information page.
- Click Connection Options in the left-side navigation pane to enter the Connection Options page.
- Click the Read/Write Splitting tab.
- Click Configure Read/Write Splitting to enter the Configure Read/Write Splitting page.
- Change parameter settings as needed by referring to the following information:
Note When a read-only instance is deleted, its weight is removed automatically while the weights of other instances remain unchanged.
- Latency Threshold: refers to the latency threshold of read-only instances and ranges from 0-7,200s. If the latency of a read-only instance exceeds this threshold, read requests will not be forwarded to this instance regardless of its weight. Based on SQL statement execution situations, latencies may occur in read-only instances. We recommend that you set the value to at least 30s.
- Read Weight Distribution: refers to read request weights of different instances. An instance with a higher weight processes more read requests. For example, if read weights of one master instance and three read-only instances are 0, 100, 200, and 200 respectively, the master instance does not process read requests (write requests are all automatically forwarded to the master instance) while the three read-only instances process read requests with a ratio of 1:2:2. To set weights, use either of the following modes:
- Automatic Distribution: The system automatically distributes read weights to instances (including read-only instances added afterwards) according to their specifications. For more information about read weights of instances with different specifications, see Rules of weight distribution by system.
- Customized Distribution: You can set read weights of instances with values ranging from 0 to 10,000. In this mode, the default weight of a newly added read-only instance is 0, and you have to manually set this parameter.
Note To enable certain queries to return data in real time, you can forcibly forward these hint statements to the master instance. For the Hint formats supported by RDS read/write splitting, see Specify whether an SQL is sent to the master instance or a read-only instance by using Hint in Rules of weight distribution by system.
- Click OK.