Updated on 2024-04-11 GMT+08:00

Configuring Delay Threshold and Distributing Read Weight

After the read/write splitting function is enabled, you can set the delay threshold and read weight distribution as required.

Table 1 Read/write splitting parameters

Parameter

Description

Delay Threshold

The maximum delay for data to be synchronized from primary DB instances to read replicas. To prevent data inconsistencies between primary DB instances and read replicas for a long time, when the delay of a read replica exceeds the configured threshold, read requests are not forwarded to the read replica regardless of the read weight distributed to it.

When read/write splitting is enabled, the default delay threshold is 30s and the default value range is 0–7,200s. It is recommended that the threshold be greater than or equal to 30s. Traffic is not allocated to read replicas whose delay exceeds the configured threshold.

Read Weight Distribution

When read/write splitting is enabled, the read weight of the primary DB instance is 0 by default. You can modify the read weights distributed to read replicas.

Read replicas with higher read weight distributions process more read requests. For example, if the read weights distributed to one primary DB instance and four read replicas are 0, 100, 200, 500, and 300, respectively, the primary DB instance does not process read requests (write requests are all automatically forwarded to the primary DB instance) while the four read replicas process read requests with a ratio of 1:2:5:3.

The system automatically distributes weights to read replicas, including read replicas created afterwards, according to their specifications based on the distribution rules listed in Rules for Distributing Weights.

Setting Delay Threshold

  1. Log in to the management console.
  2. Click in the upper left corner and select a region and a project.
  3. Click Service List. Under Database, click Relational Database Service. The RDS console is displayed.
  4. On the Instance Management page, click the target DB instance. The Basic Information page is displayed.
  5. In the navigation pane on the left, choose Database Proxy. On the displayed page, click the Read/Write Splitting tab.
  6. In the Read/Write Splitting area, click in the Delay Threshold field.

Distributing Read Weight

  1. Log in to the management console.
  2. Click in the upper left corner and select a region and a project.
  3. Click Service List. Under Database, click Relational Database Service. The RDS console is displayed.
  4. On the Instance Management page, click the target DB instance. The Basic Information page is displayed.
  5. In the navigation pane on the left, choose Database Proxy. On the displayed page, click the Read/Write Splitting tab.
  6. In the Read Weight Distribution area, click Set Read Weight.

    The system automatically distributes weights to read replicas, including read replicas created afterwards, according to the default distribution rules. If a read replica breaks down or is deleted, the weight is automatically removed. After the read replica recovers, the weight is automatically restored.