This topic provides an overview of read-only ApsaraDB RDS for PostgreSQL instances. If your database system receives a small number of write requests but a large number of read requests, a single primary RDS instance may be overwhelmed by the read requests, and your workloads may be interrupted. To offload read requests from the primary RDS instance, you can create one or more read-only RDS instances. Read-only RDS instances help increase the read capability of your database system and the throughput of your application.
Overview
When a read-only RDS instance is being created, ApsaraDB RDS replicates data from the secondary RDS instance to the read-only RDS instance. After the read-only RDS instance is created, it has the same data as the primary RDS instance. In addition, after the data on the primary RDS instance is updated, ApsaraDB RDS immediately synchronizes the updates to all read-only RDS instances that are attached to the primary RDS instance.
If the primary RDS instance uses local disks, you can create up to 5 read-only RDS instances. If the primary RDS instance uses cloud disks, you can create up to 32 read-only RDS instances.
If the primary RDS instance uses local disks, its read-only RDS instances run in a high-availability architecture.
If the primary RDS instance uses cloud disks, its read-only RDS instances run in a single-node architecture. In this architecture, no secondary read-only RDS instances are provisioned as standby. To ensure service availability, we recommend that you purchase more than one read-only RDS instance. This allows you to implement failovers among the created read-only RDS instances by using libpq or Java Database Connectivity (JDBC). For more information, see Configure automatic failover and read/write splitting. You can also use the database proxy feature to implement automatic read/write splitting. For more information, see What are database proxies?
The following figure shows the topology of the primary RDS instance and its read-only RDS instances.
Scenarios
If the primary RDS instance is overloaded, you can create read-only RDS instances to offload read requests from the primary RDS instance.
If the primary RDS instance is temporarily unavailable due to backup or maintenance reasons, read requests are forwarded to its read-only RDS instances to support some of your workloads.
You can use read-only RDS instances to query and analyze a large amount of data in scenarios such as report analysis. This does not affect the primary RDS instance.
If the read/write splitting feature is used, you can use read-only RDS instances to prevent read/write lock contention and improve the system performance and throughput.
Billing
Read-only RDS instances support the subscription and pay-as-you-go billing methods. For more information about the fee for a subscription read-only RDS instance, visit the ApsaraDB RDS buy page. For more information about the fee for a pay-as-you-go read-only RDS instance, see Instance types for read-only ApsaraDB RDS instances.
Highlights
Regions and zones: Read-only RDS instances reside within the same region as the primary RDS instance, but can reside in different zones.
Network type: The network types of read-only RDS instances can differ from the network type of the primary RDS instance. For more information, see Change the network type of an ApsaraDB RDS for MySQL instance.
Account and database management: The accounts and databases on read-only RDS instances are synchronized from the primary RDS instance. You do not need to manage databases or accounts on read-only RDS instances.
Management of IP address whitelists: When you create a read-only RDS instance, ApsaraDB RDS replicates the IP address whitelists of the primary RDS instance to the read-only RDS instance. However, the IP address whitelists of the read-only RDS instance are independent of the IP address whitelists of the primary RDS instance. If you want to modify the IP address whitelists of a read-only RDS instance, follow the instructions provided in Configure an IP address whitelist for an ApsaraDB RDS for SQL Server instance.
Monitoring and alerting: You can monitor the performance metrics of a read-only RDS instance. The metrics include the disk usage, IOPS, number of connections, and CPU utilization. The monitoring data of the metrics is provided in charts.
Read/write splitting: The read/write splitting feature works with the database proxy feature to allow ApsaraDB RDS for PostgreSQL to forward write requests to the primary RDS instance and read requests to the read-only RDS instances. This reduces the loads on the primary RDS instance. For more information about how to enable the database proxy feature for a primary RDS instance, see What are database proxies?
Read-only RDS instances: If the primary RDS instance uses local disks, you can create up to 5 read-only RDS instances. If the primary RDS instance uses cloud disks, you can create up to 32 read-only RDS instances.
Usage notes
You cannot configure backup policies or manually create backups for read-only RDS instances. These operations are performed on primary RDS instances.
Data migration: You cannot migrate data to read-only RDS instances.
Database management: You cannot create or delete databases on read-only RDS instances.
Account management: You cannot create or delete accounts, grant permissions to accounts, or change the passwords of accounts on read-only RDS instances.
Specifications and storage capacity:
If the primary RDS instance uses cloud disks, the storage capacity of its read-only RDS instances cannot be less than the storage capacity of the primary RDS instance. If the memory capacity of the primary RDS instance is greater than the memory capacity of its read-only RDS instance and you change the specifications of the primary RDS instance, the read-only RDS instances restart.
If the primary RDS instance uses local disks, the specifications and storage capacity of its read-only RDS instances cannot be lower than the specifications and storage capacity of the primary RDS instance.
If a read-only RDS instance encounters unexpected errors, such as failures to replicate database engine settings, ApsaraDB RDS rebuilds the read-only RDS instance.
After the primary RDS instance is released, the subscription read-only RDS instances of the primary RDS instance are automatically refunded and released, and the pay-as-you-go read-only RDS instances of the primary RDS instance are directly released.