Databases 11 min read

Redis New Features and Architecture Options Overview

This article reviews Redis 6.0 and 5.0 new features, compares deployment architectures such as cluster, master-replica, and read-write split, and provides Java connection-pool code examples to help engineers select the appropriate Redis setup for performance, reliability, and scalability requirements.

Architect
Architect
Architect
Redis New Features and Architecture Options Overview

Redis 6.0 introduces module APIs, SSL/TLS encryption, the new RESP3 protocol, server‑side client caching, multithreaded I/O, diskless replication, Redis‑benchmark support for cluster mode, Systemd rewrite, and the Disque module.

Redis 5.0 adds the Stream data type, account management, audit logs, snapshot‑based cache analysis, new timer, cluster and dictionary module APIs, LFU/LRU information in RDB files, a C‑based cluster manager, sorted‑set commands ZPOPMIN/ZPOPMAX/BZPOPMIN/BZPOPMAX, active defragmentation v2, HyperLogLog enhancements, improved memory statistics, HELP subcommands for many commands, CLIENT ID and CLIENT UNBLOCK commands, the LOLWUT command, deprecation of the "slave" terminology (except where API compatibility requires it), multiple network‑layer optimizations, Lua improvements, dynamic HZ for balancing idle CPU usage and responsiveness, and extensive core code refactoring.

The article then outlines three primary deployment architectures for Redis: cluster architecture (breaking the single‑thread bottleneck with master‑replica shards), master‑replica architecture (single or double replica for high availability), and read‑write split architecture (providing high availability, high performance, and flexibility for read‑heavy workloads).

For each architecture, reliability aspects, typical usage scenarios, and performance considerations are discussed, including HA failover mechanisms, data persistence, backup and recovery, and the impact of Redis's single‑threaded nature on CPU usage.

A Java code example demonstrates how to create a custom Jedis connection pool for Redis Cluster, configuring timeout, redirection limits, pool size, and authentication details.

import redis.clients.jedis.*;</code><code>import java.util.HashSet;</code><code>import java.util.Set; </code><code>public class main </code><code>private static final int DEFAULT_TIMEOUT = 2000; </code><code>private static final int DEFAULT_REDIRECTIONS = 5;</code><code>private static final JedisPoolConfig DEFAULT_CONFIG = new JedisPoolConfig();</code><code><br/></code><code><br/></code><code>public static void main(String args[]){</code><code>    JedisPoolConfig config = new JedisPoolConfig();</code><code>    // 最大空闲连接数, 根据业务需要设置,不能超过实例规格规定的最大的连接数</code><code>    config.setMaxIdle(200);</code><code>    // 最大连接数, 根据业务需要设置,不能超过实例规格规定的最大的连接数</code><code>    config.setMaxTotal(300);</code><code>    config.setTestOnBorrow(false);</code><code>    config.setTestOnReturn(false);</code><code><br/></code><code>    // 开通直连访问时申请到的直连地址</code><code>    String host = "r-bp1xxxxxxxxxxxx.redis.rds.aliyuncs.com"; </code><code>    int port = 6379;</code><code>    // 实例的密码</code><code>    String password = "xxxxx";</code><code><br/></code><code>    Set<HostAndPort> jedisClusterNode = new HashSet<HostAndPort>();</code><code>    jedisClusterNode.add(new HostAndPort(host, port));</code><code>    JedisCluster jc = new JedisCluster(jedisClusterNode, DEFAULT_TIMEOUT, DEFAULT_TIMEOUT,</code><code>            DEFAULT_REDIRECTIONS,password, "clientName", config);</code><code>}</code><code>}

The article also compares proxy versus direct connection modes for Redis Cluster, lists client library prerequisites (e.g., Jedis, PhpRedis), and provides best‑practice recommendations for read‑write split deployments, such as handling node failures and full‑sync scenarios.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

JavaredisJedisDatabase ArchitectureCluster
Architect
Written by

Architect

Professional architect sharing high‑quality architecture insights. Topics include high‑availability, high‑performance, high‑stability architectures, big data, machine learning, Java, system and distributed architecture, AI, and practical large‑scale architecture case studies. Open to ideas‑driven architects who enjoy sharing and learning.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.