1. From the storage medium, its data is stored in the memory, which is quite fast. Similar to hashmap, it also exists in the memory.
2. The storage of set key values is very simple, which means fast.
3. reids are single-threaded and single-process. There is no resource competition problem, and multi-thread will have resource competition problems.
4. multiplexing. What is multiplexing? Multiple network connections, network requests, and a single thread are used to process many requests. Because they are single-threaded, when a large number of requests come, they are put in the list queue in order, first-Come requests are processed first, similar to the pipeline principle. Because it is operated in the memory, even a single thread will be very fast.
5. redis adopts the RESP protocol, which is called the simplest command.
Set age 5 --> Break this command into the following commands:
* 3 --> indicates that there are three groups.
$3 --> indicates the length of the first group.
Set --> indicates the specific command
$3 --> indicates the length of the second group.
Age --> specific commands
$1 --> third group Length
5 --> specific value or command
What are the reasons for redis's high performance?