转眼间Redis已经走过了十个年头,久到它的作者Antires已经弃坑不再维护Redis源代码了。在我们查看Redis6.0新特性前先来回顾下Redis历史版本的历程。
由于篇幅问题,下图仅列举了部分我认为比较重要的特性(注:Codis2和Codis3分别基于2.8、3.2,并不属于Redis特性)
特性的详细细节在此不赘述,我们来看Redis6.0,。Redis6.0版本特性大约可以分为四类,如下表
新特性
|
内核优化
|
应用优化
|
其他
|
ACL权限管控(包括ACL LOG)
|
过期Key回收优化,新增主动配置参数
|
新的module API
|
全面支持SSL协议、并新增TSL协议
|
客户端缓冲(Client side caching)
|
Resp3协议,兼容Resp2并更加简单、高效
|
disque消息队列模块(module)
|
Redis-benchmark支持集群模式
|
多线程 IO(Threaded I/O)
|
优化了INFO命令,使之执行更快
|
新增配置使Del命令如unlink执行
|
重写 Systemd 支持
|
Redis集群代理
|
优化了所有的阻塞命令,复杂度从O(n)到O(1)
|
XINFO STREAM FULL流命令
|
新增配置参数来删除用于在非持久性实例中进行复制的RDB文件
|
支持linux/bsd系统的CPU和线程(包括子线程如aof
dbIO线程)亲和力绑定
|
RDB加载速度优化
|
CLIENT KILL USER username命令
|
无磁盘复制副本(Diskless replication on replicas),从测试版优化,目前无磁盘复制在load rdb仍是测试版。
|
|
集群Slots命令优化
|
|
|
|
Psync2优化,修复了5.0的链式复制不一致问题。
|
|
|
|
defrag优化,从试验版到正式版
|
|
|
详细的版本细节我简略的翻译了些,原文可查看GitHub文档。
6.0.4
* PSYNC2 tests improved.
* Fix a rare active defrag edge case bug leading to stagnation
* Fix Redis 6 asserting at startup in 32 bit systems.
* Redis 6 32 bit is now added back to our testing environments.
* Fix server crash for STRALGO command,
* Implement sendfile for RDB transfer.
* TLS fixes.
* Make replication more resistant by disconnecting the master if we
detect a protocol error. Basically we no longer accept inline protocol
from the master.
* Other improvements in the tests.
1、PSYNC2测试得到了改进。
2、修复了一个罕见的活跃的碎片整理边缘情况导致停滞的错误
3、修复32位系统启动时的redis6断言。
4、Redis6 32位现在添加回我们的测试环境。
5、修复服务器崩溃STRALGO命令,
6、实现RDB数据传输。
7、TLS修复。
8、如果检测协议错误,将通过断开主服务器来增强复制的抵抗力。基本上我们不再接受内联协议从主。
9、测试的其他改进。
6.0.2
* XPENDING should not update consumer's seen-time
* optimize memory usage of deferred replies - fixed
* Fix CRC64 initialization outside the Redis server itself.
* stringmatchlen() should not expect null terminated strings.
* Cluster nodes availability checks improved when there is
high Pub/Sub load on the cluster bus.
* Redis Benchmark: Fix coredump because of double free
* Tracking: send eviction messages when evicting entries.
* rax.c updated from upstream antirez/rax.
* fix redis 6.0 not freeing closed connections during loading.
New features:
* Support setcpuaffinity on linux/bsd
* Client Side Caching: Add Tracking Prefix Number Stats in Server Info
* Add --user argument to redis-benchmark.c (ACL)
1、修复了XPENDING不应该更新用户的查看时间bug
2、优化延迟回复的内存使用
3、修复了Redis服务器本身外部的CRC64初始化。
4、修复了stringmatchlen()不应该期望null结尾的字符串。
6、集群节点可用性检查有所改善
7、集群总线上的高发布/订阅负载。
8、Redis benchmark:修复核心ump因为双免费
9、跟踪:发送驱逐消息时,驱逐条目。
10、从上游antirez/rax更新的rax.c。
11、修正了redis6.0在加载过程中没有释放关闭的连接。
12、支持linux/bsd系统上cpu亲和力绑定(setcpuaffinity)
13、客户端缓存:在服务器信息中添加跟踪前缀数字统计
14、Add——用户参数到redis-benchmark.c (ACL)
6.0.0
* XCLAIM AOF/replicas propagation fixed.
* Client side caching: new NOLOOP option to avoid getting notified about
changes performed by ourselves.
* ACL GENPASS now uses HMAC-SHA256 and have an optional "bits" argument.
It means you can use it as a general purpose "secure random strings"
primitive!
* Cluster "SLOTS" subcommand memory optimization.
* The LCS command is now a subcommand of STRALGO.
* Meaningful offset for replicas as well. More successful partial
resynchronizations.
* Optimize memory usage of deferred replies.
* Faster CRC64 algorithm for faster RDB loading.
* XINFO STREAM FULL, a new subcommand to get the whole stream state.
* CLIENT KILL USER <username>.
* MIGRATE AUTH2 option, for ACL style authentication support.
* Other random bugfixes.
1、XCLAIM AOF/replicas 传播已修复。
2、客户端缓存:新的 NOLOOP 选项以避免收到有关自己执行的更改。
3、ACL GENPASS 现在使用 HMAC-SHA256,并具有一个可选的“位”参数。这意味着您可以将其用作通用的“安全随机字符串”原始!
4、群集“SLOTS”子命令的内存优化。
5、LCS 命令现在是 STRALGO 的子命令。
6、更有意义的复制偏移量。提高了部分重同步的成功率。
7、优化延迟回复的内存使用。
8、更快的 CRC64 法可更快地加载 RDB。
9、XINFO STREAM FULL,一个新的子命令,用于获取整个流状态。
10、新增CLIENT KILL USER <用户名>命令,关闭某个用户的连接。
11、MIGRATE AUTH2 选项,用于 ACL 样式身份验证支持。
12、修正了一些其他错误
Redis 6.0-rc4
* Big INFO speedup when using a lot of of clients.
* Big speedup on all the blocking commands: now blocking
on the same key is O(1) instead of being O(N).
* Stale replicas now allow MULTI/EXEC.
* New command: LCS (Longest Common Subsequence).
* Add a new configuration to make DEL like UNLINK.
* RDB loading speedup.
* Many bugs fixed (see the commit messages at the end of this node)
1、提高了大量客户端连接时使用 INFO 命令的查询速度。
2、在所有阻塞命令上都大大加快了速度:现在阻止同一个key的命令复杂度是 O(1)而不是O(N)。
3、陈旧的副本现在允许 MULTI/EXEC。
4、新命令:LCS(最长公共子序列)。
5、添加新配置以使 DEL 像 UNLINK。
6、RDB 加载加速。
7、修复了许多错误。
Redis 6.0-rc3
* Fix crash due to refactoring for SSL, for the connection code.
* Precise timeouts for blocking commands. Now the timeouts have HZ
resolution regardless of the number of connected clinets. New timeouts
are stored in a radix tree and sorted by expire time.
* Fix rare crash when resizing the event loop because of CONFIG maxclients.
* Fix systemd readiness after successful partial resync.
* Redis-cli ask password mode to be prompted at startup (for additional safety).
* Keyspace notifications added to MIGRATE / RESTORE.
* Threaded I/O bugs fixed.
* Implement new ACL style AUTH in Sentinel.
* Make 'requirepass' more backward compatible with Redis <= 5.
* ACL: Handle default user as disabled if it's off regardless of "nopass".
* Fix a potential inconsistency when upgrading an instance in Redis Cluster
and restarting it. The instance will act as a replica but will actually be
set as a master immediately. However the choice of what to do with already
expired keys, on loading, was made from the POV of replicas.
* Abort transactions after -READONLY error.
* Many different fixes to module APIs.
* BITFIELD_RO added to call the command on read only replicas.
* PSYNC2: meaningful offset implementation. Allow the disconnected master
that is still sending PINGs to replicas, to be able to successfully
PSYNC incrementally to new slaves, discarding the last part of the
replication backlog consisting only of PINGs.
* Fix pipelined MULTI/EXEC during Lua scripts are in BUSY state.
* Re-fix propagation API in modules, broken again after other changes.
1、修复了由于重构 SSL 而导致的连接代码崩溃。
2、用于阻止命令的精确超时。现在超时已达到 HZ 分辨率,无论连接的 clinet 数量如何。新超时存储在基数树中并按到期时间排序。
3、修复了由于 CONFIG maxclients 而调整事件循环大小时发生的罕见崩溃。
4、修正部分重新同步成功后的 systemd 准备情况。
5、Redis-cli 询问密码模式将在启动时提示(以提高安全性)。
6、键空间通知添加了关于MIGRATE/RESTORE命令的内容。
7、修复了线程 I/O 错误。
8、在 Sentinel 中实现新的 ACL 样式 AUTH。
9、使 'requirepass' 与 Redis<=5 更向后兼容。
10、ACL:如果默认用户关闭,则将其视为禁用状态,而不管其是否为“ nopass”。
11、修复了在 Redis 群集中升级实例时可能出现的不一致问题
12、-READONLY 错误后中止事务。
13、对模块 API 的许多不同修复。
14、添加了 BITFIELD_RO 以在只读副本上调用该命令。
15、PSYNC2:有意义的偏移量实现。允许断开连接的主机仍在向副本发送 PING,以便能够成功 PSYNC 以增量方式传递给新的从站,从而丢弃了仅由 PING 组成的复制积压。
16、修正 Lua 脚本处于繁忙状态时流水线的 MULTI/EXEC。
17、重新修复模块中的传播 API,在其他更改后再次中断。
Redis 6.0-rc2
* ACL LOG: log denied commands, keys accesses and authentications.
* Client side caching redesigned. Now we use keys not caching slots.
* Client side caching: Broadcasting mode implemented.
* Client side caching: OPTIN/OPTOUT modes implemented.
* Remove RDB files used for replication in persistence-less instances (option).
Fixes (only selected ones, see commits for all the fixes):
* Different fixes to streams in edge cases.
* Fix duplicated CLIENT SETNAME reply because of RESP3 changes.
* Fix crash due to new active expire division by zero.
* Avoid sentinel changes promoted_slave to be its own replica.
* Fix bug on KEYS command where pattern starts with * followed by x00.
* Threaded I/O: now the main thread is used as well to do I/O.
* Many fixes to modules APIs, and more to come in the next RCs.
* ld2string should fail if string contains in the middle.
* Make the Redis test more reliable.
* Fix SPOP returning nil (see #4709). WARNING: API change.
1、ACL LOG:记录拒绝的命令,密钥访问和身份验证。
2、重新设计了客户端缓存。现在,我们使用keys而不是缓存插槽。
3、客户端缓存:已实现广播模式。
4、客户端缓存:已实现 OPTIN/OPTOUT 模式。
5、新增配置参数来删除用于在非持久性实例中进行复制的RDB文件。
一些bug修复:
6、在边缘情况下对流的不同修复。
7、修正由于 RESP3 更改而导致重复的 CLIENT SETNAME 答复。
8、修正因新的有效到期除以零而导致的崩溃。
9、避免哨兵提升当前的从节点为该从节点的副本。
10、修复了 KEYS 命令中以 * 开头,后跟 x00 的错误。
11、线程 I/O:现在也使用主线程来执行 I/O。
12、对模块API进行了许多修复,而在下一个RC中还会有更多修复。
13、如果字符串中间包含 ,则 ld2string 应该失败。
14、使 Redis 测试更可靠。
15、修复了SPOP返回空的bug
Redis 6.0-rc1
* The modules system now has a number of new APIs that allow module authors
to make things otherwise not possible in the past. It is possible to
store arbitrary module private data in RDB files, to hook on different
server events, capture and rewrite commands executions, block clients on
keys, and so forth.
* The Redis active expire cycle was rewritten for much faster eviction of keys
that are already expired. Now the effort is tunable.
* Redis now supports SSL on all channels.
* ACL support, you can define users that can run only certain commands and/or
can only access only certain keys patterns.
* Redis now supports a new protocol called RESP3, which returns more
semantical replies: new clients using this protocol can understand just
from the reply what type to return to the calling program.
* There is server-side support for client-side caching of key values. This
feature is still experimental and will get more changes during the next
release candidates, but you can already test it and read about it here:
* Redis can now optionally use threads to handle I/O, allowing to serve
2 times as much operations per second in a single instance when
pipelining cannot be used.
* Diskless replication is now supported even on replicas: a replica is now
able, under certain conditions the user can configure, to load the RDB
in the first synchronization directly from the socket to the memory.
* Redis-benchmark now supports a Redis Cluster mode.
* SRANDMEMBER and similar commands have a better distribution.
* Redis-cli improvements.
* Systemd support rewritten.
* A Redis Cluster proxy was released here:
* A Disque module for Redis was released here: