All Products
Search
Document Center

:FAQ about read/write splitting

Last Updated:Apr 29, 2024

This topic provides answers to commonly asked questions about read/write splitting.

After I modify the read weights of the primary RDS instance and read-only RDS instances, why do the new read weights not take effect?

The new read weights take effect only on new connections. The new read weights do not take effect on existing connections because the existing connections are not re-established.

Why do the loads on the primary RDS instance and read-only RDS instances not comply with the read weights of the instances?

This issue may occur in the following scenarios:

  • Requests contain transactions. All of the requests that contain transactions are routed to the primary RDS instance. These transactions include those that are executed to read data.

  • Your database system is connected by using the endpoints of the primary or read-only RDS instances. In these cases, your database system does not route requests to the primary and read-only RDS instances based on the specified read weights. Make sure that your database system is connected only by using the read/write splitting endpoint.

Why are a large number of read requests routed to my primary RDS instance even if the read weight of the primary RDS instance is 0?

This issue may occur in the following scenarios:

  • All of the requests that contain transactions are routed to the primary RDS instance. These transactions include those that are executed to read data.

  • All of the read-only instances with a non-zero read weight are unavailable, or the latency on these instances exceeds the specified threshold. In these cases, your database system stops routing read requests to these read-only instances.

How does read/write splitting ensure data reading in a timely manner?

For more information, see How do I ensure the timeliness of reading data on an ApsaraDB RDS for MySQL instance when the read/write splitting feature is enabled?.

How do I configure read weights by calling API operations?

For more information, see ModifyReadWriteSplittingConnection.

How do I select the network type for a read/write splitting endpoint?

If your application is deployed in the same VPC as the RDS instance, we recommend that you use the internal endpoint to ensure data security and communication efficiency. If your application is deployed on an on-premises client or in a different network from the RDS instance, we recommend that you use the public endpoint to establish connections. For more information about how to switch between network types, see Change the network type of the read/write splitting address for an ApsaraDB RDS MySQL instance.

What is the difference between the read/write splitting endpoint and the internal and public endpoints of a primary RDS instance?

After you enable read/write splitting, a read/write splitting endpoint is generated. If you add the endpoint to your application, all requests are routed to this endpoint, and then to the primary and read-only RDS instances based on the request types and the read weights of these instances.

If only the internal or public endpoint of the primary RDS instance is configured in your application, all requests are sent to the primary RDS instance. To implement read/write splitting, you must configure the endpoints and read weights of the primary and read-only RDS instances in your application.

Can I change the read/write splitting endpoint?

The read/write splitting endpoint cannot be manually changed. If you enable or disable read/write splitting multiple times, the endpoint remains unchanged, and you do not need to update the endpoint configurations for your application. This reduces overall maintenance costs.

If I create a read-only RDS instance, will my primary RDS instance be affected?

When you create a read-only RDS instance, the system replicates data from a secondary RDS instance. The primary RDS instance is not affected.

After I set the read weight of a read-only RDS instance to 0, can I still connect to the read-only RDS instance?

Yes, after you set the read weight of a read-only RDS instance to 0, you can still connect to the read-only RDS instance by using the internal or public endpoint of the read-only RDS instance. However, you cannot connect to the read-only RDS instance by using the read/write splitting endpoint. For more information, see View and change the internal and public endpoints and port numbers of an ApsaraDB RDS for MySQL instance. This feature is used to configure a read-only RDS instance to process only specific workloads.

If I want to release all read-only RDS instances of my primary RDS instance that runs MySQL and has the shared database proxy feature enabled, is the shared database proxy of the primary RDS instance affected?

When you release the last read-only RDS instance of the primary RDS instance that runs MySQL and has the shared database proxy feature enabled, the system deletes the read/write splitting endpoint provided by the shared database proxy feature. If an application is connected to the RDS instance by using the read/write splitting endpoint, the application cannot access the RDS instance.