Updated on 2023-02-07 GMT+08:00

Introducing Read/Write Splitting

Read/write splitting enables read and write requests to be automatically routed through a read/write splitting address.

You can enable the single-proxy or multi-proxy function for your RDS for MySQL instance. The multi-proxy function supports multiple database proxies and is useful for workload isolation.

After you enable read/write splitting, if there is no read replica, read and write requests will be automatically routed to the primary instance through the read/write splitting address.

After you enable read/write splitting, if there are read replicas, write requests will be automatically routed to the primary instance and read requests to each read replica by user-defined weights through the read/write splitting address.

Proxy load balancing balances requests among multiple read replicas using a load-based scheduling policy. To enable proxy load balancing, contact customer service to apply for the required permissions.

Supported Regions

The single-proxy function is available in the CN-Hong Kong, AP-Bangkok, and AP-Singapore regions. If your instance is deployed in any other region, contact customer service to apply for the required permissions.

To enable the multi-proxy function, contact customer service to apply for the required permissions.

Supported Versions

  • 5.6: 5.6.51.7 or later
  • 5.7: 5.7.37.2 or later
  • 8.0: all minor versions

If your kernel version is not supported, upgrade the minor version.

Scenario

  • Read/write splitting enables read and write requests to be automatically routed. If your application requires more proxies, you can request additional proxy nodes with just a few clicks.
  • Read requests are distributed to your read replicas based on weights to balance your database traffic and improve resource utilization.
  • A proxy routes read requests of your application only to the read replicas you specify for the proxy.

Differences Between the Single-Proxy and Multi-Proxy Functions

The single-proxy function allows you to create only one proxy instance for one DB instance. Write requests are automatically routed to the primary instance and read requests to read replicas by user-defined weights through the only read/write splitting address.

The multi-proxy function allows you to create multiple proxy instances (up to four) for one DB instance. It enables you to isolate workloads.

  • Read/write proxy: The proxy connects to the primary instance and read replicas. It distributes read requests to the primary instance and read replicas by read weights and automatically routes write requests to the primary instance.
  • Read-only proxy: The proxy does not connect to the primary instance. It cannot route read requests to the primary instance, and will report an error when receiving a write request.

Different applications are connected to different proxies, and proxies are associated with specific read replicas. You can control where read requests from different applications are forwarded, which lets you keep application workloads isolated from each other.

One RDS for MySQL read replica can connect to different proxies. However, you are advised to configure only one proxy that can allocate requests to the read replica.