Updated on 2026-03-24 GMT+08:00

Changing Read Weights of Nodes

Scenarios

In high-concurrency database access scenarios, if all read requests are sent to the primary node, the primary node will be overloaded, affecting database performance. After a proxy instance is created, you can change the read weights of its associated nodes. Read requests are routed to nodes based on the read weights, reducing the load on the primary node.

You can only change the read weights when the proxy instance uses the weighted routing policy. If the proxy instance is deleted, the read weights will be automatically removed.

Weighted Routing

As shown in Figure 1, one TaurusDB instance has one primary node and three read replicas. Two proxy instances have been created and they both use the weighted routing policy.

  • Proxy instance 1 is in the read/write mode. The primary node and read replica 1 are associated with proxy instance 1 and assigned with a read weight of 100 and 200, respectively. They process read requests in the ratio of 1:2, that is, the primary node processes 1/3 read requests and read replica 1 processes 2/3 read requests. Write requests are automatically routed to the primary node.
  • Proxy instance 2 is in the read-only mode. Read replica 2 and read replica 3 are associated with proxy instance 2 and assigned with a read weight of 100 and 200, respectively. Read replica 2 and read replica 3 process read requests in the ratio of 1:2, that is, read replica 2 processes 1/3 read requests, and read replica 3 processes 2/3 read requests.
Figure 1 Read/Write splitting in multi-proxy scenarios (weighted routing policy)

Precautions

  • You can configure read weights for both the primary node and read replicas.
  • The default read weight of the primary node is 0. The higher read weight the primary node is assigned, the more read requests it can process.
  • When the read weights of all nodes are 0, services are not affected. In this case, the primary node processes all read and write requests by default.
  • The weight of a read replica ranges from 0 to 1000.
  • After Associate New Nodes is enabled, new read replicas will be automatically associated with the current proxy instance. The default read weight of any new node is 100.

Procedure

  1. Log in to the TaurusDB console.
  2. Click in the upper left corner and select a region and project.
  3. On the Instances page, click the instance name to go to the Basic Information page.
  4. In the navigation pane, choose Database Proxy. Then click the name of a proxy instance.
  5. On the Basic Information page, click Configure under Routing Policy.
  6. In the displayed dialog box, select the nodes that you want to associate with the current proxy instance or deselect the nodes that you want to remove from the current proxy instance in the Database Nodes area, and configure read weights in the Read Weight column. Read requests are forwarded to nodes based on the weights you specify.

    Figure 2 Configuring read weights

  7. Click OK. The proxy instance status changes to Configure routing policy.
  8. After several minutes, check that the proxy instance status becomes Available and the read weights are updated.