All Products
Search
Document Center

ApsaraDB RDS:FAQ about the database proxy feature

Last Updated:Jan 11, 2024

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

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 and transaction splitting. Database proxies are easy to use and maintain, and deliver high availability and high performance. For more information, see What are database proxies?

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 and Billing rules for the database proxy feature.

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
Note

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.

The number of database proxies is used to calculate the performance of the database proxy feature. The actual number of database proxies varies. If the number of database proxies that you enabled is large, the database proxies can process more requests of your RDS instance.

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 ApsaraDB RDS for PostgreSQL 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. A database proxy endpoint is formerly known as proxy terminal. For more information, see Create a database proxy endpoint.

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 your 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 my primary RDS instance and the read-only RDS instances?

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

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.

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. The performance of the database proxy feature for an RDS instance is related to the number of read-only RDS instances, the number of database proxies, and the database proxy specification.

  • If you increase the number of read-only RDS instances, the database proxies can process more read requests.

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

    Note

    The recommended specification of database proxies is calculated by using the following calculation:

    • 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

      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.

      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.

    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.

Can I modify the prefix of a database proxy endpoint?

Yes, you can modify the prefix of a database proxy endpoint and the port that is associated with the database proxy endpoint.

For more information, see Manage database proxy endpoints.

Is the number of connections to a database proxy limited? How many concurrent connections are supported by a database proxy?

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

The number of connections that are supported by a database proxy is determined by the smaller value between the maximum number of connections that are supported by a primary RDS instance and the maximum number of connections that are supported by the read-only RDS instances of the primary RDS instance.

For example, if the maximum number of connections that are supported by a primary RDS instance is 1,600 and the maximum number of connections that are supported by the read-only RDS instances of the primary RDS instance is 800, the number of connections that are supported by the database proxy is 800.

Note

How do I ensure that a read request is forwarded to my primary RDS instance instead of my read-only RDS instance after I enable the database proxy feature?

You can add /*FORCE_MASTER*/ to the SQL statement for the read request. This way, the request is forwarded to the primary RDS instance. If you want the read request to be forwarded to a read-only instance, you can add /*FORCE_SLAVE*/ to the SQL statement for the request.

Example:

/*FORCE_MASTER*/ SELECT * FROM table_name;

After I modify read weights, 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.

After my RDS instance is recovered from a failure, how long does it take for the database proxy feature to provide services as expected?

The database proxy feature monitors the health status of your RDS instance in real time. The feature can detect the failure of your RDS instance within 2 second. After your RDS instance is recovered from the failure, the feature immediately provides services as expected

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, find the required internal endpoint and move the pointer over the image.png icon in the Internal Endpoint/Port column.