This topic describes how to set read/write splitting weights for the default connection endpoint.
Assigning read/write separation weights
Two read/write separation methods are supported for connection endpoints, namely automatic and custom assignment, and automatic assignment is the default method.
Automatic assignment
When using automatic assignment, RDS for PostgreSQL determines each read-only node’s read weight based on its memory size under the connection endpoint. For example, if the specifications of read-only nodes A and B under an instance are 2C4G and 2C8G respectively, after enabling read/write separation and using automatic assignment, the read requests are processed by nodes A and B in a 1:2 ratio.
Custom assignment
With custom assignment, the read load of each node under a connection endpoint depends on the custom read weight assigned to that node. For example, if an instance has three read-only nodes with read weights of 100, 200, and 200, the read requests are processed by these nodes in a 1:2:2 ratio.
Prerequisites
Procedure
- In the upper-left corner of the top menu bar, select the project and region for the instance.
tip
If the project of the instance has not been set, the project should be selected as All resources.
- On the Instances page, click the name of target instance and enter Summary page.
- Click on the Connectivity tab and hover over the default endpoint card in the Instance topology section. Click Modify endpoint in the pop-up window to open the Modify endpoint page.
- Go to the Modify endpoint page and set the read/write separation weight assignment method in the Read/write separation section.
- Set the automatic assignment mode. Click Automatic assignment and then click OK.
- Set whether to Disable primary node. After enabling, the primary node of the default endpoint will reject all requests.
- Click Custom assignment. In the Custom read weight configuration area below, set weights for each node and click OK.
tip
Weight value ranges from 0 to 40000 and must be an integral multiple of 100. You are recommended to set weights based on memory size to avoid resource waste due to uneven distribution of pressure on nodes.