Read/write splitting instances of Tair are suitable for read-heavy workloads. These instances ensure high availability and high performance, and support a variety of specifications. The read/write splitting architecture allows a large number of clients to concurrently read hot data from read replicas and minimizes O&M costs.
A read/write splitting instance contains a master node, multiple read replicas, multiple proxy nodes, and an high availability(HA) system.
|Component||Read/write splitting instance that uses cloud disks (recommended)||Read/write splitting instance that uses local disks|
|Master node||The master node processes all write requests. It also processes specific read requests together with read replicas.|
|Replica node||No replica nodes are provided. Read replicas are used as replica nodes. If the master
node fails, requests are switched to a random read replica.
Read/write splitting instances cost less than local-disk instances that have the same specifications due to the lack of replica nodes.
|A replica node serves as a cold standby node to back up data and does not provide services. If the master node fails, requests are switched to the replica node.|
|Read replica||Read replicas handle read requests and have the following benefits:
||Read replicas handle read requests and have the following benefits:
|Proxy node||When a client is connected to a proxy node, the proxy node automatically identifies
request types and forwards requests to different nodes based on the node weights.
You cannot change the weights. For example, write requests are forwarded to the master
node, and read requests are forwarded to the master node and read replicas.
|HA system||The HA system monitors the state of each node. If the master node fails, the HA system performs a switchover between the master node and the replica node. If a read replica fails, the HA system creates another read replica to process read requests. During a switchover, the HA system updates the routing and weight information.|
- Alibaba Cloud has developed an HA system for read/write splitting instances. The HA system monitors the states of all nodes of an instance to ensure HA. If the master node fails, the HA system switches the workloads from the master node to the replica node and updates the instance topology. If a read replica fails, the HA system creates another read replica. The HA system synchronizes data and forwards read requests to the new read replica and suspends the failed read replica.
- A proxy node monitors the state of each read replica in real time. If a read replica is unavailable due to an exception, the proxy node reduces the weight of this read replica. If a read replica fails to be connected for a specified number of times, the system suspends the read replica and forwards read requests to available read replicas. The proxy node continues to monitor the state of the unavailable read replica. After the read replica recovers, the proxy node adds it to available replicas and forwards requests to it.
- High performance
The read/write splitting architecture supports chained replication. This allows you to scale out read replicas to increase the read capacity. The replication process is optimized based on the Redis source code to maximize workloads stability during replication and make full use of the physical resources for each read replica.
- High QPS
Standard instances of Tair do not support high queries per second (QPS). If your application is read-heavy, you can deploy multiple read replicas to relieve stress on the master node. This allows you to resolve performance bottlenecks caused by the single-thread architecture. A read/write splitting instance can handle QPS that is up to five times that of a standard instance.Note Latency exists when data is synchronized to read replicas. As such, read/write splitting instances are suitable for business that can tolerate a specific amount of dirty data. In scenarios that require high data consistency, we recommend that you choose the Cluster architecture.
- Compatibility with Redis protocols
Read/write splitting instances of ApsaraDB for Redis are compatible with all open source Redis commands. You can smoothly migrate data from a self-managed Redis database to a read/write splitting instance. You can also upgrade Tair master-replica standard instances to read/write splitting instances.Note Read/write splitting instances have limits on specific commands. For more information, see Limits on the commands supported by read/write splitting instances.
- If a read replica fails, requests are forwarded to other available read replicas. If all read replicas are unavailable, requests are forwarded to the master node. Read replica failures may result in increased workloads on the master node and an increased response time. To process a large number of read requests, we recommend that you use multiple read replicas.
- If an error occurs on a read replica, the HA system suspends the read replica and creates another read replica. This failover process involves resource allocation, data synchronization, and service loading. The amount of time that is required by a switchover depends on the system workloads and data volume. Tair does not guarantee a specific amount of time required for data restoration by using read replicas.
- Full data synchronization among read replicas is triggered in specific scenarios.
For example, it can be triggered when a switchover occurs on the master node. During
full data synchronization, read replicas are unavailable. If your requests are forwarded
to the read replicas, the following error message is returned:
-LOADING Redis is loading the dataset in memory\r\n.