Removal Policy and Load Balancing

Last updated: 2021-07-27 15:10:55

    TencentDB for PostgreSQL allows you to create one or more read-only replicas to form a read-only replica group (RO group), which is suitable for read/write separation and one-primary-multiple-secondary application scenarios and capable of greatly enhancing the read load capacity of your databases. This document describes how to manage RO groups.

    Rebalancing Traffic

    • If load rebalancing is disabled, modifying weight will take effect only for new loads but not affect the read-only replicas accessed by existing persistent connections or cause short disconnection from the database.
    • If load rebalancing is enabled, the read weights of upgraded read-only replicas will change, which causes all connections to the RO group to be disconnected after the upgrade is completed, and all new connections will be rebalanced according to the new weights.
      If you are not satisfied with the connection distribution of each read-only replica in the RO group, you can also manually rebalance it: log in to the console, click the primary instance ID to access the instance management page, select the Read-only Replica tab, locate the desired read-only replica in the RO group, and click Rebalance in the Operation column.
    Note:

    Make sure your business has an automatic reconnection mechanism. Neither enable automatic rebalancing nor manually rebalance if there is no automatic reconnection mechanism.

    Removing Failed Read-only Replicas

    When a read-only replica in a RO group becomes inaccessible due to an unexpected error, the RO group automatically removes the read-only replica. This rule is a default rule.

    Removing Delayed Read-only Replicas

    If this feature is enabled, a read-only replica will be removed from the RO group if the data sync log size difference between the primary instance and the read-only replica is greater than the specified threshold (MB).

    Allocating Read Weights

    The traffic of each read-only replica in an RO group will be automatically distributed according to its read weight, which can realize load balancing and reduce the difficulty of managing multiple read-only replica IP addresses. An RO group automatically allocates read weights to each read-only replica. The following table lists the read weights of read-only replicas of different specifications:

    SpecificationWeight
    2 GB memory1
    4 GB memory2
    8 GB memory2
    12 GB memory4
    16 GB memory4
    24 GB memory8
    32 GB memory8
    48 GB memory10
    64 GB memory12
    96 GB memory14
    128 GB memory16
    240 GB memory26
    480 GB memory50

    References

    • For more information on how to create one or more read-only replicas, please see Creating Read-only Replicas.
    • For more information on how to create one or more read-only replicas and add them to an RO group, please see Managing RO Groups.