All Products
Search
Document Center

:Enable read/write splitting

Last Updated:Sep 06, 2024

Tair provides the read/write splitting feature. After you enable read/write splitting for an instance, the instance can automatically identify read and write requests and forward them to corresponding nodes. This enhances the overall performance and availability of the instance, meeting the requirements of high-concurrency read and write scenarios.

Background information

The read/write splitting feature uses the star replication architecture where all read replicas synchronize data from the master node. This reduces synchronization latency. All read replicas come equipped with disaster recovery capabilities and can serve as replica nodes for data backup. You can select the number of read replicas within the range from 1 to 9 based on your needs. For more information, see Read/write splitting architecture.

Prerequisites

  • The instance is deployed in cloud-native mode.

  • The cluster mode is disabled for the instance.

  • The instance is a DRAM-based or persistent memory-optimized instance.

  • Each data shard of the instance has 1 GB memory or higher specifications.

Precautions

This operation may cause transient connections that last for a few seconds on the instance and trigger data migration in the background. Make sure that the write queries per second (QPS) of the instance is less than 100,000 during the operation. We recommend that you perform this operation during off-peak hours and make sure that your application can automatically reconnect to the instance.

Procedure

  1. Log on to the Tair console and go to the Instances page. In the top navigation bar, select the region in which the instance that you want to manage resides. Then, find the instance and click the instance ID.

  2. In the left-side navigation pane, click Read/Write Splitting Settings.

  3. Click Enable.

  4. In the Enable Read/Write Splitting panel, set Number of Read Replicas. Valid values: 1 to 9.

    Note

    New read replicas have the same specifications as the instance.

  5. Check the order amount and click Pay.

  6. Complete the payment.

    After the payment is complete, the instance specifications begin to change and the instance enters the Changing Configuration state. Wait for 1 minute to 5 minutes. If the configuration change is complete, the instance enters the Running state. You can check the instance status on the details page of the instance.

Customize the number of read replicas

You can adjust the number of read replicas for a read/write splitting instance based on your business requirements. On the Read/Write Splitting Settings page, click Modify in the Actions column to adjust the number of read replicas.

FAQ

Why does the ECS cluster DbInstance does not support SecurityGroup error message appear when I try to enable read/write splitting for an instance?

Cause: If a security group is added to a cloud-native instance, read/write splitting cannot be enabled for the instance.

Solution: Check whether a security group is added to the instance. If a security group is added to the instance, add the corresponding IP addresses to a whitelist of the instance and remove the security group from the instance. For more information, see Configure whitelists. After you remove the security group, enable read/write splitting again.