All Products
Search
Document Center

ApsaraDB RDS:FAQ about the database proxy feature

Last Updated:Jan 12, 2024

This topic provides answers to some frequently asked questions about the database proxy feature of ApsaraDB RDS for MySQL. If you encounter problems when you use the database proxy feature, you can refer to this topic.

Contents

What are database proxies?

A database proxy serves as a network proxy that resides between your database system and your application and forwards all requests from your application. The database proxy provides advanced capabilities, such as automatic read/write splitting, transaction splitting, connection pooling, and persistent connection. Database proxies are easy to use and maintain, and deliver high availability and high performance.

What are the differences between general-purpose database proxies and dedicated database proxies?

  • General-purpose: This type of database proxies share physical CPU resources and are provided free of charge. The highest specification of this database proxy type is 16 CPU cores that are provided by eight database proxies.

  • Dedicated: This type of database proxies exclusively occupy the allocated physical CPU resources and are charged based on the pay-as-you-go billing method. This type of database proxy delivers stable performance, and the highest specification of this database proxy is 32 CPU cores that are provided by 16 database proxies.

For more information, see Database proxy types, Change the types and the number of database proxies, Billing rules for the database proxy feature.

Does a database proxy consume the QPS or TPS of my primary RDS instance?

No, a database proxy does not consume the queries per second (QPS) or transactions per second (TPS) of a primary RDS instance.

Is a database proxy endpoint the same as a regular endpoint?

No, a database proxy endpoint is different from a regular endpoint.

  • A regular endpoint forwards all requests that are sent only to the RDS instance.

  • A database proxy endpoint automatically forwards write requests to the primary RDS instance and read requests to the read-only RDS instances based on the SQL statements that are executed. This helps reduce the loads on the primary RDS instance.

After I enable the database proxy feature, does the system reclaim the original endpoints of the primary RDS instance and its read-only RDS instances?

No, the system does not reclaim the original endpoints of the primary RDS instance and its read-only RDS instances in your database system after you enable the database proxy feature.

Is the internal network type of a database proxy the same as the internal network type of its primary RDS instance?

Yes, the internal network types of a database proxy and its primary RDS instance are virtual private clouds (VPCs).

Which architecture do database proxies use? Does this architecture provide a failover mechanism?

Database proxies use a high availability architecture with two primary nodes. Connections are distributed to the two nodes at a ratio of 1:1. If one node fails, the other node takes over the faulty node and the system automatically triggers a restoration task on the faulty node to ensure high availability of database services.

What is the relationship between the number of database proxies and the specification of the database proxies?

The following calculation describes the relationship between the specification of database proxies and the number of database proxies: Specification of database proxies = Unit specification of a database proxy × Number of database proxies. In this calculation, the unit specification of a database proxy is fixed as 2 CPU cores.

For example, if the number of database proxies is 3, the specification of the database proxies is 6 CPU cores. The value is obtained based on the following calculation: 2 x 3 = 6.

For more information, see Change the types and the number of database proxies.

Does the number of database proxy endpoints depend on the number of database proxies?

No, the number of database proxy endpoints does not depend on the number of database proxies.

Each RDS instance with the database proxy feature enabled supports up to seven database proxy endpoints. You can apply for one internal endpoint and one public endpoint for each database proxy endpoint. For more information, see Create a database proxy endpoint.

Is the performance of database proxies improved if I increase the number of database proxy endpoints?

No, if you increase the number of database proxy endpoints, the performance of the database proxy feature is not improved.

If your RDS instance runs RDS High-availability Edition, the performance of the database proxy feature for the RDS instance is related to the number of read-only RDS instances, the number of database proxies, and the database proxy specification. If your RDS instance runs RDS Cluster Edition, the performance of the database proxies for the RDS cluster is related to the number of secondary nodes, the number of database proxies, and the database proxy specification. An RDS instance that runs RDS Cluster Edition is referred to as an RDS cluster.

  • If you increase the number of read-only RDS instances for RDS instances that run RDS High-availability Edition or the number of secondary nodes for RDS clusters, the database proxies can process more read requests.

  • If you increase the number of database proxies or add the database proxy specification, the performance of the database proxies is improved.

  • Note
    • The recommended specification of database proxies is calculated by using the following formula:

      • Recommended database proxy specification = Recommended number of database proxies × Unit specification of a database proxy The unit specification of a database proxy is fixed as 2 CPU cores.

      • The highest specification of a general-purpose database proxy is 16 CPU cores. The highest specification of a dedicated database proxy is 32 CPU cores. The following table describes how the recommended number of database proxies is calculated.

    Proxy type

    RDS instance that runs RDS High-availability Edition

    RDS instance that runs RDS Cluster Edition

    Recommended number of general-purpose database proxies

    (Number of CPU cores of the primary RDS instance + Number of CPU cores of all read-only RDS instances that belong to the primary RDS instance)/4. The result is rounded up.

    (Number of CPU cores of the primary node + Number of CPU cores of all secondary nodes that belong to the primary node)/4. The result is rounded up.

    Recommended number of dedicated database proxies

    (Number of CPU cores of the primary RDS instance + Number of CPU cores of all read-only RDS instances that belong to the primary RDS instance)/8. The result is rounded up.

    (Number of CPU cores of the primary node + Number of CPU cores of all secondary nodes that belong to the primary node)/8. The result is rounded up.

    For example, if your primary RDS instance that runs RDS High-availability Edition has 8 CPU cores and its read-only RDS instance has 4 CPU cores, the recommended number of database proxies is 2. The number is obtained based on the following calculation: (8 + 4)/8 = 1.5. The result 1.5 is rounded up to 2. The recommended specification of database proxies is 4 CPU cores. The number is obtained based on the following calculation: 2 × 2 = 4.

Is the number of connections to a database proxy limited?

The maximum number of connections that can be established to a database proxy is unlimited. The maximum number of connections varies based on the specifications of the primary RDS instance and read-only RDS instances in your database system.

What do I do if a timeout error occurs when I use a database proxy endpoint to connect to my RDS instance?

We recommend that you increase the value of the wait_timeout parameter and try again. For more information about how to modify instance parameters, see Modify instance parameters.

Can I modify a database proxy endpoint or a read/write splitting endpoint?

Yes, you can modify a database proxy endpoint or a read/write splitting endpoint.

For more information, see Manage the database proxy endpoints of an ApsaraDB RDS for MySQL instance.

If my primary RDS instance processes a small number of write requests, can read requests also be sent to my primary RDS instance?

Yes,

if your primary RDS instance processes a small number of write requests, read requests can also be sent to your primary RDS instance. You only need to specify a suitable read weight for your primary RDS instance. For more information, see Enable the database proxy feature.

Does read/write splitting support hints?

Yes, read/write splitting supports hints. You can use hints to forward requests to the primary RDS instance. For more information about supported hint formats, see Rules of read weight allocation by the system.

After I modify the read weights of my primary RDS instance and read-only RDS instances, the new read weights do no take effect. Why?

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 the 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 requests that contain transactions are forwarded only to the primary RDS instance. To offload the requests from the primary RDS instance, you can enable transaction splitting. For more information, see Use the transaction splitting feature.

  • The endpoints of the primary RDS instance and the read-only RDS instances are used to connect to your database system. As a result, requests are not forwarded to the primary RDS instance and read-only RDS instances based on the read weights of the instances. In this case, you can use a database proxy endpoint to connect to your database system.

If I disable the database proxy feature for an RDS instance, can I assign read weights to its read-only RDS instances?

No, you cannot assign read weights to read-only RDS instances if you disable the database proxy feature for your RDS instance. You can configure the endpoints of the primary RDS instance and its read-only RDS instances in different applications to implement read/write splitting and load balancing.

If a read-only RDS instance becomes faulty, new connections are established only to other healthy read-only RDS instances. In this case, does the current connection to the faulty read-only RDS instance fail over to another healthy read-only RDS instance?

No, the current connection to the faulty read-only RDS instance does not fail over to another healthy read-only RDS instance. You must wait until the current connection times out. Then, a new connection is established to another healthy read-only RDS instance.

After I enable the database proxy feature for my RDS instance, how do I verify read/write splitting?

For more information, see Verify read/write splitting on an ApsaraDB RDS for MySQL instance.

After I purchase a read-only RDS instance to implement read/write splitting, is the historical data of my primary RDS instance automatically synchronized to the read-only RDS instance?

Yes, after you enable the database proxy feature and complete the configurations for read/write splitting, the historical data of the primary RDS instance is automatically synchronized to the read-only RDS instance.

What is the difference between the connection pool in a database proxy and the connection pool in an application? How do I use the connection pools together?

The connection pooling feature of a database proxy in ApsaraDB RDS for MySQL does not affect the connection pooling feature of the client. If the client provides a connection pool, you can disable the connection pooling feature of the database proxy. For more information about the connection pooling feature of a database proxy in ApsaraDB RDS for MySQL, see Set the connection pool type of an ApsaraDB RDS for MySQL instance.

Why are garbled characters returned when I query data?

The character sets that are used on the primary RDS instance may be different from the character sets that are used on the read-only RDS instances. You can execute the following statement to check whether the primary RDS instance and the read-only RDS instances use the same character sets:

select 
@@global.character_set_results, 
@@global.character_set_client, 
@@global.character_set_connection, 
@@global.character_set_server;

If the primary RDS instance and the read-only RDS instances use different character sets, you can modify the character sets of the primary RDS instance or read-only RDS instances to ensure that these instances use the same character sets. For more information about how to modify the character set of an RDS instance, see Character set description for ApsaraDB RDS for MySQL.

Are DDL operations automatically synchronized from the primary RDS instance to the secondary RDS instance?

All DDL operations such as creating and deleting databases and tables, changing table schemas, and changing permissions are automatically synchronized from the primary RDS instance to the secondary RDS instance.

How do I view the VPC ID and vSwitch ID parameters of a VPC-type internal endpoint?

In the Connection Information section of the Database Proxy page, move the pointer over the icon to the right of Port.

image.png