I recently used redis in my project. So I am looking at the redis source code. Next I plan to introduce the overall situation of redis and gradually write the redis source code functions. However, before doing anything, you should consider its advantages and disadvantages. Therefore, write the advantages and disadvantages of redis first.
Redis is a key-value storage system that stores data in the memory. It has the following advantages:
1. Support for Multiple Data Types
These data types include set, zset, list, hash, and string, which are easy to operate. For example, if you are using a friend system to view your friend relationship, if you are using another key-value system, you must splice the corresponding friend into a string and then extract the friend, parse the value, while redis is relatively simple. It directly supports list storage (using two-way linked list or compressed linked list storage ).
2. Persistent Storage
As a memory database, the biggest concern is that data will disappear if the machine crashes. Redi uses RDB and aof for persistent data storage. At the same time, the master and slave data generates an RDB file and uses the buffer zone to add new data updates for corresponding synchronization.
3. Rich features
Pub/sub, key expiration Policy, transaction, and support for multiple databases.
4. Good Performance
Because it is a full-memory operation, the read/write performance is very good, and the frequency can reach 10 W/s. The company has projects that use redis. The current access frequency is 80 w/s. Through proper deployment, everything is OK online.
Redis has the following Disadvantages:
1. Because it is a memory database, the data volume stored on a single machine depends on the memory size of the machine. Although redis itself has a key expiration Policy, it still needs to estimate and save memory in advance. If the memory grows too fast, you need to regularly delete data.
2. For full re-synchronization, RDB files need to be generated and transmitted, which will occupy the CPU of the host and consume the bandwidth of the current network. However, the redis2.8 version already has some re-synchronization functions, but it is still possible to have full re-synchronization. For example, the new standby machine.
3. modify the configuration file, restart it, and load the data in the hard disk into the memory for a long time. In this process, redis cannot
Provide services.
This article from "thinking precipitation" blog, please be sure to keep this source http://joezhengjinhong.blog.51cto.com/7791846/1565754
Advantages and disadvantages of redis