Updated on 2024-11-29 GMT+08:00

Redis Enhanced Open Source Features

Comprehensive Cluster Management Functions

MRS provides comprehensive Redis cluster management. On Manager, you can create Redis clusters based on the Redis instance groups to improve system processing capabilities and reliability.

  • Wizard-based creation of Redis clusters
    Figure 1 Creating a Redis cluster

    MRS supports creation of Redis clusters in master/slave mode. The system automatically calculates the number of Redis instances to be installed on nodes and determines the master/slave relationship.

  • Cluster scaling-out/scaling-in

    When large-scale data processing is required, you can add one or multiple master/slave instances in the Redis cluster by a few clicks. The system automatically completes data migration and balancing for the scaling-out.

  • Balance

    Data in Redis clusters may not be evenly distributed if the scaling-out fails or some instances are offline. MRS Manager provides the balance function to implement automatic balancing of cluster data, ensuring stable operation of clusters.

  • Performance monitoring and alarming

    The system provides performance monitoring of Redis clusters and intuitive curves to help users learn Redis cluster status and throughput of instances.

    The system provides diverse alarms, such as alarms for cluster offline, persistency failures, uneven slot distribution, master/slave instance switchover, cluster HA deterioration, and inconsistent memory size between master and slave instances, for Redis clusters. Diverse alarms facilitate the Redis cluster monitoring and management.

Cluster Reliability Guarantee

The cluster management tool redis-trib.rb provided by the Redis community enables the master and slave instances to be created in fixed sequence and cannot ensure cluster HA. If the master and slave instances are created on the same host, a failure of one host causes unavailability of the entire cluster.

When creating a Redis cluster, MRS automatically calculates the number of instances based on the selected instance range and deploys the cluster based on the host-level HA principle. This principle is also ensured during scaling-out and scaling-in. If any host in a cluster is faulty, a master/slave instance switchover is performed, ensuring continuous cluster running.

If the cluster HA cannot be ensured when some nodes or instances are faulty at the same time, alarms will be generated prompting that rectification is required.

Data Import and Export Tool

A Redis cluster has 16,384 slots. The crc16 code of different keys is calculated to determine the slots for storing the keys. This mechanism ensures load balancing of master instances. As a result, different slots store different key values. If two clusters have different topology structures, the keys for different instances are different. This makes data migration or data restoration from backup extremely difficult.

MRS provides a dedicated data import and export tool, which can be used to export data from the Redis cluster and restore data in the original cluster, new cluster, and heterogeneous cluster (cluster with different numbers of nodes).

Comprehensive Security Features

The community Redis provides the simple password authentication mechanism, and the password in the configuration file is not encrypted. This mechanism is insecure for enterprise-class applications. MRS provides comprehensive security features and adds authentication, authorization, and audit mechanisms.

A client can send data to or request data from a server only after the authentication is successful. Authentication is also performed between the servers in a cluster to prevent requests from forged instances. In addition, Redis commands are classified into read, write, and management commands. Users are assigned different permissions to prevent unauthorized operations.

The audit mechanism logs some risky Redis operations, such as changing the cluster topology and clearing Redis data.

Performance Enhancement

Redis is a high-performance distributed database. However, deployment of Redis instances on a command OS causes limited throughout when the number of concurrent requests from clients increases even if the server has sufficient resources. In addition, the Redis cluster performance cannot be linearly improved with the cluster scaling-out. MRS has incorporated OS enhancement, including CPU binding, NIC queue binding, and OS parameter optimization, ensuring high Redis performance, especially linear performance improvement of Redis clusters.

Figure 2 Performance comparison of a single instance
Figure 3 Performance comparison of clusters

Enhanced Replacement Algorithm

Redis is a cache system. When the memory usage of Redis reaches the configured maximum value, data replacement occurs. Native Redis supports three replacement policies: Least Recently Used (LRU), Random, and Time to Live (TTL). However, the purpose of replacing cold data and retaining hot data cannot be well achieved in practical use.

MRS Redis enhances the replacement algorithm and introduces the Smart placement policy. This policy is used to replace data based on key hot statistics, ensuring that only the coldest data is eliminated each time as possible. In simulated service tests, the hot data hit rate of the Smart replacement policy is always greater than 99%, and the hot data replacement rate is about 3% to the maximum (the hot data hit rate and replacement rate of the native LRU policy are 85% and 35%, respectively). Due to the improvement of hot data hit rate, the service request throughput is increased.

Cluster Pipeline

The Redis server supports pipeline commands sent from clients. That is, the Redis server can receive and process multiple commands at one time, shortening the network transmission duration and increasing the number of requests processed by the Redis server per second. However, the Jedis community provides only the single-instance pipeline mode. The clients encapsulate Jedis to ensure that the pipeline mode can also be applied in clusters and the use method of such pipeline mode is the same as that of the single-instance pipeline mode.