All Products
Search
Document Center

ApsaraDB RDS:Enable read/write splitting by enabling the read-only routing endpoint

Last Updated:Jan 12, 2024

ApsaraDB RDS for SQL Server allows you to manage read-only ApsaraDB RDS for SQL Server instances in your database system and provides the read-only routing endpoint for your database system. You can add the endpoint of the primary RDS instance and the read-only routing endpoint to your application to implement read/write splitting. After read/write splitting is implemented, the system forwards write requests to the endpoint of the primary RDS instance and read requests to the read-only routing endpoint. Then, the read-only endpoint distributes the read requests to the secondary nodes or all involved read-only RDS instances based on the read weights of the read-only RDS instances. Read/write splitting helps improve the performance and scalability of your database system, offloads read requests from your primary RDS instance, and provides efficient read/write splitting services for applications.

Prerequisites

Your RDS instance is a primary RDS instance and meets the following requirements:

  • The primary RDS instance runs SQL Server 2017 EE on RDS Cluster Edition, SQL Server 2019 EE on RDS Cluster Edition, or SQL Server 2022 EE on RDS Cluster Edition.

  • The primary RDS instance runs RDS Cluster Edition.

  • The primary RDS instance uses enhanced SSDs (ESSDs).

Note

You can go to the Basic Information page of the RDS instance to view the preceding information.

Usage notes

  • If this is the first time you enable the read-only routing endpoint, the system automatically upgrades the control and management systems of the primary and read-only RDS instances to the latest versions. This ensures service availability. When you enable the read-only routing endpoint, the primary RDS instance encounters a transient connection that lasts for approximately 30 seconds. During this period, all read-only RDS instances of the primary RDS instance are inaccessible. We recommend that you enable the read-only routing endpoint during off-peak hours and make sure that your application is configured to automatically reconnect to your RDS instance. This prevents interruptions to your workloads.

  • If you restarted the primary RDS instance for which you want to enable the read-only routing endpoint and its read-only RDS instances or changed the specifications of the RDS instances at least once after March 08, 2017, the control and management systems of the RDS instances have been upgraded to the latest versions. When you enable the read-only routing endpoint, the system does not restart the RDS instances and no transient connections occur.

  • The read-only routing endpoint is fixed. It does not change even if you enable or disable the read-only routing endpoint multiple times. You do not need to update the configuration data on your application on a regular basis. This reduces maintenance costs.

    Note

    The read-only routing endpoint cannot be manually modified.

  • The read-only routing endpoint is free of charge. However, you still need to pay for the read-only RDS instances that you use. For more information, see Overview of read-only ApsaraDB RDS for SQL Server instances.

  • The read-only routing endpoint is not supported in the classic network.

Procedure

After you enable the read-only routing endpoint and configure the read weights of your read-only RDS instances, the system processes read requests based on the read weights that you configure.

  1. Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
  2. In the left-side navigation pane, click Cluster Management.

  3. Click Enable now..

  4. In the Configure Readonly Splitting Address dialog box, configure the following parameters.

    Parameter

    Description

    Network Type

    The type of the read-only routing endpoint.

    • Intranet address (VPC): RDS instances that run SQL Server 2017 EE or SQL Server 2019 EE support only the virtual private cloud (VPC) network type. Therefore, the read-only routing endpoint must be of the VPC network type.

    • Internet Address: This type of endpoint is used to connect to RDS instances over the Internet. We recommend that you use internal read-only routing endpoints to connect to RDS instances because connections over the Internet are prone to fluctuations.

    Read Weight Distribution

    The read weight of each RDS instance. A higher read weight indicates more read requests to process. For example, if the primary RDS instance has three read-only RDS instances whose read weights are 100, 200, and 200, the read-only RDS instances process read requests at a ratio of 1:2:2.

    • Automatic Distribution: The system automatically assigns a read weight to each RDS instance based on the instance specifications. After you create a read-only RDS instance, the system automatically assigns a read weight to the created read-only RDS instance. You do not need to manually specify a read weight for the created read-only RDS instance. For more information, see Default read weights.

    • Customized Distribution: You must manually specify the read weight of each read-only RDS instance. Valid values: 0 to 10000. After you create a read-only RDS instance, the system sets the read weight of the read-only RDS instance to 0. You must manually modify the read weight of the created read-only RDS instance.

  5. Click OK.

Related operations

  • On the Cluster Management page, view the ID, status, and read weight of the read-only RDS instance. On the Cluster Management page, find the read-only RDS instance that you want to manage and click Manage in the Actions column to manage the instance.

    image..png

  • Modify the read weights of the read-only RDS instances based on your business requirements. If your workloads are heavy, you can modify the read weights of the read-only RDS instances. Then, the read-only routing endpoint distributes read requests to the secondary nodes and all involved read-only RDS instances based on the new weights. For more information, see Modify read weights.

    Note

    If you use RDS Cluster Edition, secondary nodes in your RDS cluster are readable. An RDS instance that runs RDS Cluster Edition is referred to as an RDS cluster. After you create an RDS cluster, the secondary nodes in the RDS cluster serve as read-only nodes by default. For more information, see Configure the read attribute for a secondary RDS instance of a primary ApsaraDB RDS for SQL Server instance.

  • If your RDS instance no longer requires read/write splitting, you can disable read/write splitting by disabling the read-only routing endpoint. For more information, see Disable read/write splitting by disabling the read-only routing endpoint.