Eight features of redis

Source: Internet
Author: User
Tags redis version redis cluster
1. Fast

Under normal circumstances, redis runs commands very quickly. The official number is that the read/write performance can reach 0.1 million/second. Of course, this also depends on the machine performance, however, we will not discuss the differences in machine performance here. We will analyze what makes redis so fast that it can be roughly summarized into the following three points:

  • All redis data is stored in the memory, so putting the data in the memory is the main reason for redis's fast speed.
  • Redis is implemented in C language. Generally, the program implemented in C language is "closer" to the operating system, and the execution speed is relatively faster.
  • Redis uses a single-threaded architecture to prevent possible competition from multithreading.
2. Data Structure server based on key-value pairs

Almost all programming languages provide dictionary-like functions, such as map in Java and dict in Python. Similar to this method of organizing data, it is called the key-value-based method, unlike many key-value pairs, redis values can be strings and data structures. This not only facilitates development in many application scenarios, it can also improve development efficiency. Redis is short for remote dictionary server. It mainly provides five types of data structures: String, hash, list, set, and ordered set.

3. Rich Functions

In addition to five data structures, redis also provides many additional features:

  • The key expiration function is provided to implement caching.
  • The Publish/subscribe function is provided to implement the message system.
  • Supports Lua script to create new redis commands using Lua.
  • Provides simple transaction functions to ensure transaction features to a certain extent.
  • Provides the pipeline function, so that the client can upload a batch of commands to redis at a time, reducing network overhead.
4. Simple and stable

Redis is simple in three aspects.

  • Redis has few source code.
  • Redis uses a single-threaded model, which not only simplifies the processing model of the redis server, but also simplifies client development.
  • Redis does not need to rely on class libraries in the operating system (for example, memcache needs to rely on system class libraries such as libevent). redis implements its own event processing functions.
    Although redis is simple, it does not mean it is unstable. For example, if you maintain thousands of apsaradb for redis instances, there has been no downtime due to redis bugs.
5. Many client languages

Redis provides a simple TCP communication protocol. Many programming languages can easily access redis, and redis is widely recognized by the community and major companies, therefore, there are many client languages that support redis, almost covering mainstream programming languages, such as Java, PHP, Python, C, C ++, and nodejs.

6. Persistence

Generally, it is not safe to store data in the memory. in case of power failure or machine failure, important data may be lost. Therefore, redis provides two persistence methods: RDB and aof can be used to save memory data to the hard disk () to ensure data durability.

7. Master-slave Replication

Redis provides the replication function to implement multiple redis copies of the same data. The replication function is the basis of distributed redis.

8. High Availability and distributed

Redis version 2.8 officially provides high availability Implementation of redis Sentinel, which can ensure redis node fault discovery and automatic failover. Redis version 3.0 officially provides the distributed implementation of redis cluster, which is the real distributed implementation of redis and provides high availability, read/write and capacity scalability.

Eight features of redis

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.