This topic describes the read/write splitting feature of ApsaraDB MyBase for SQL Server. This feature allows ApsaraDB MyBase for SQL Server to distribute read requests to read-only ApsaraDB MyBase for SQL Server instances based on the read weights of these instances. This is implemented by using a read-only routing endpoint that is provided by ApsaraDB MyBase for SQL Server.

If your system receives a large number of read requests and a small number of write requests, one single ApsaraDB MyBase for SQL Server instance may fail to process read requests and your business may be interrupted. To offload the read requests of the system and increase the read capabilities of the system, you can create one or more read-only ApsaraDB MyBase for SQL Server instances. This way, a large number of read requests can be processed. For information about how to create a read-only ApsaraDB MyBase for SQL Server instance, see Create a read-only ApsaraDB MyBase for SQL Server instance.

After read-only ApsaraDB MyBase for SQL Server instances are created, you can enable the read-only routing endpoint and add the endpoint of the primary ApsaraDB MyBase for SQL Server instance and the read-only routing endpoint to your application. This way, your system can forward write requests to the primary ApsaraDB MyBase for SQL Server instance and read requests to the read-only routing endpoint. Then, the read-only routing endpoint automatically forwards the read requests to the read-only instances based on the read weights of the read-only instances. For information about how to enable read/write splitting, see Enable read/write splitting.

Note The read/write splitting feature of ApsaraDB MyBase for SQL Server is implemented in a different manner from the read/write splitting feature of ApsaraDB MyBase for MySQL.
  • ApsaraDB MyBase for SQL Server: You must add an endpoint of the primary ApsaraDB MyBase for SQL Server instance and the read-only routing endpoint to your application to implement read/write splitting.
  • ApsaraDB MyBase for MySQL: You must add a read/write splitting endpoint to your application to implement read/write splitting.

Differences between a read-only routing endpoint and a private or public endpoint

After you enable a read-only routing endpoint, the read-only routing endpoint is generated. You can add the read-only routing endpoint to your application. Then, the read requests from your client are routed to the read-only routing endpoint and are then distributed to your read-only instances based on the read weights of these instances.

If you add only the private or public endpoint of a primary ApsaraDB MyBase for SQL Server instance to your application, all requests are routed to the primary ApsaraDB MyBase for SQL Server instance. To implement read/write splitting, you must add an endpoint of the primary ApsaraDB MyBase for SQL Server instance and the read-only routing endpoint to your application, and configure read weights for read-only ApsaraDB MyBase for SQL Server instances.

Benefits

  • A unified read-only routing endpoint that ensures easy maintenance

    You are provided with a unified read-only routing endpoint that can distribute read requests to read-only ApsaraDB MyBase for SQL Server instances. The read-only routing endpoint reduces maintenance costs.

    You can create read-only ApsaraDB MyBase for SQL Server instances to increase the read capabilities of your system without the need to modify your application.

  • A native high-security link that improves performance

    If you build your proxy layer in the cloud to implement read/write splitting, data must be parsed and forwarded by multiple components before the data reaches your database. As a result, the response latency increases. ApsaraDB MyBase is built into an existing high-security link that precludes additional components. This shortens the response latency and accelerates processing.

  • Configurable read weights for various scenarios

    You can configure read weights for read-only ApsaraDB MyBase for SQL Server instances.

  • Health checks for instances to ensure high availability

    The cluster management module automatically performs health checks on read-only ApsaraDB MyBase for SQL Server instances. If a read-only ApsaraDB MyBase for SQL Server instance does not respond or the latency of the instance exceeds the specified threshold, the system stops routing read requests to the instance and routes read requests to healthy instances. This way, if a read-only ApsaraDB MyBase for SQL Server instance fails, service availability is ensured. After the faulty read-only instance is recovered, ApsaraDB MyBase resumes routing read requests to the instance.

  • Reduced resource and maintenance costs due to read-only routing endpoints that are free of charge

    You are not charged for using read-only routing endpoints.