Home  >  Article  >  Database  >  What is redis read and write separation

What is redis read and write separation

(*-*)浩
(*-*)浩Original
2019-11-22 14:10:013540browse

What is redis read and write separation

## Redis Reading and Writing Separational advantage

Transparent compatibility (Recommended learning: redis video tutorial )

The read-write separation is the same as the ordinary cluster specifications, and redis-proxy is used for request forwarding. There are certain restrictions on the use of multi-shard commands, but single-shard reads are upgraded from master to slave. Write separation, or upgrading from a cluster to a multi-shard read-write separation cluster can be fully compatible.

The user establishes a connection with redis-proxy, and redis-proxy will identify whether the request sent by the client connection is read or write, and then perform load balancing according to the weight and forward the request to different backends. In the DB node, write requests are forwarded to the master, and read operations are forwarded to the read-only replica (the master also provides reading by default, which can be controlled by weight).

Users only need to purchase an instance with read-write separation specifications and use it directly with any client. The business can start to enjoy the huge performance improvement brought by the read-write separation service without making any modifications. The access cost is almost 0.

High Availability

The high availability module (HA) monitors the health status of all DB nodes and protects the availability of the entire instance. Automatically switches to the new master when the master goes down. If a read-only replica goes down, HA can detect it in time and reinstall a new read-only replica to take the downed node offline.

In addition to HA, redis-proxy can also sense the status of each read-only replica in real time. During the abnormal period of a read-only replica, redis-proxy will automatically reduce the weight of this node. If it is found that a read-only replica has failed continuously for more than a certain number of times, the abnormal node will be temporarily blocked and will not be restored until the exception disappears. Normal weight.

redis-proxy and HA work together to minimize the business's perception of back-end anomalies and improve service availability.

High performance

For business scenarios with more reading and less writing, directly using the cluster version is often not the most appropriate solution. Now reading and writing separation provides more options , the business can choose the most suitable specifications according to the scenario and make full use of the resources of each read-only replica.

Currently, a single shard is sold to the outside world 1 master 1/3/5 read-only replica in various specifications (if you have greater demand, you can submit a work order feedback), providing 600,000 QPS and 192 MB/s services Ability to break through the resource limitations of a single machine while being fully compatible with all commands.

Specification restrictions will be removed in the future, allowing users to freely increase or decrease the number of read-only replicas at any time according to business traffic.

For more Redis-related technical articles, please visit the Introduction to Using Redis Database Tutorial column to learn!

The above is the detailed content of What is redis read and write separation. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn