Redis 6.0.1 于 2020 年 5 月 2 日正式发布了,如 Redis 作者 antirez 所说,这是迄今为止最“企业”化的版别,也是有史以来改动最大的一个 Redis 版别,一起也是参加开发人数最多的一个版别。
所以在运用此版别之前,主张各位开发者先进行深化的测验再考虑投产,究竟生产坏境无小事。好了,回到本文的要点,接下来咱们来要点看下 Redis 6.0.1 给咱们带来了那些新功用。
所O p O ~ /以在运用此版别之前,主张各位开发者先进行深化的测验再考虑M 8 % V [ 9 5 u p投产,究竟生产坏境无小事。好了,回到本文的要点,接下来咱们来| { k w 2 5要点看下 Redis 6.0.1 给咱们带来U 7 9 P I 0了那些新功用。
Redis 新功用介绍
Redis 6 的更新日志,首要包括以下五部分的^ + c c # o内容:
- Redis 6.0-RC1 版新功用介绍;
- Redis 6.0-RC2版新功用介绍;
- Redis 6.0-RC3 版新功用介绍;
- Redis 6.0-RS + ; q q C a OC4 版P V ] t w ;新功y D C 8用介绍;
- Redis 6.0.0 GW ? 5A 版新功用介绍。
除了以上这些版别的更新日志外,还有 6.0.1 正式版的更新日志,不过这个正式版的发布时刻只比 Redis 6.0.0 GA 晚了两天,因而只l { i 6 0 = 2 m B批改了一些 bug,所以咱们只需求看以上五个日志即可。
1.Redis 6.0-rc1 更新日志
官方更新日志如下:
Redis 6 improves Redis in a number of key areas and is one ofd 5 Q 1 1 + $ S the largest
Redis releases in the history of the project, so here we’ll la c | x d P _ist only
the biggest features in this rS ; Kelease:
- The modules system now ha# ` | s B Q & `s a numb( O 8 U ; ter of new APIs that allow modu0 V & gle authors
to make thingsd m 1 ^ Q q ~ otherwise not possible in the past. It is possible to
store arbitrarp G + V # Q }y module private data in RDB fU [ ; m : Jiles, to hook on different
server even7 O ) : 2 ` % ?ts, 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 foS q C _ | Dr client-side caching of key values. T S G 6 e Jhis
feature is still experimental and will get more changes during the next
release candidates, bu7 W Y . | D l it you can already test it and read about it here:
redis.io/topics/clie…- Redis can now optionally use th ; mreads to handle I/O, allowing to sI v D U Jerve
2 times as muc[ V 5 Z h ] G Yh operations per second in a single instance when
pipelining cannot be used.- Diskless replication is now supported even on re! @ Hplicas: aQ 8 $ replica is now
ag s { y / !ble, under certain conditions the user can configure, to load the RDB
in the first sy2 * D S ~nchronization directly from the socket to the memory.- Redis-benchmark now supports a Redis Cluster mode.
- SRANDMEMBER and similar co= n N F 0 [ H Smmands haveL + V W B a better distribution.
- Redis-cli improvements.
- Systemd support rewritten.
- A Redis Cluster proxy was released here:
github.com/artix75/redS t ) u…- A Disque_ W S o J & I I module for Redis was releasedb b @ W here:
github.com/antireE r u u C : xz/dis…
此版别新增的内容最大,如下I r B 4 ; Y 5 R列表所示:
- 很多新模块(mf a [ ` 1 toduleC $ g 1 ; (s)API
- 更好的过期循环(expire cJ X r Vycle)
- SSL
- ACLs8 B = k 权限控制
- RESP3 协议
- 客户端缓存(Client side cachiw ` E Qng)
- 多线程_ 4 J = @ f 3 c IO(Tm Y x S t } S ; Uhread] Q 0 s % # P jed I/O)
- 无盘仿制副本(Di: % l Vskless replication on replicas)
- Redis-benchmark 的集群支持和 redis-cli 优化
- 重写 Systemd 支持(Systemd support rewrite)
- Redis 集群署理与 Redis 6 一起发布(但在不同的 rep2 z E 5 T 4o/ o & $ #)
- Disque 模块与 Redis 6 一起发布
2.Redis 6.0-rc2 更b = 9 j P新日志
Hi Redis users, Redis 6 is approaching and will be released 30th of April.
New release cand@ O q ? / 1 ) ~idates will be released at the eN H | = / D m #nd of March, then another
one mid April, to finally reach the GA at the 4 9 Je end of Am / 9 * N M ? )pril.Redis 6 RC2 bri – !ngY ` D w ~s many fixes and new things, especially in the areaZ E 2 g i = of
clien1 { j j ~ =t side caching. Thg H { S : d 7is is the list of big changes in this release. As
usually you can find the full list of commits at the end:New features and improvementst s = @:
- ACL LOG: log denied commands, keys accesses and authentications.
- Client sih F C G F A z 3de caching redn H i E Z [ A O eesigned. Now we use keys not caching slots.
- Cli ` [ g 1 l Qent side caching3 5 ^: Broadcasting mode implemented.
- Client side caching:a 5 Z & C + O OPTIN/OPTOUT modes implemented.
- Remove RDB files used for replication in persists $ 0ence-less instances (option).
Fixes (only selected ones, see commits for all the fixes):
- Diff N w 3 ce| 9 s _rent fY i ] A [ixes to streams in edge cases.
- Fix duplicated CLIEY s D a LNT SETNAME reply because of RESP3 changes.
- FiF 2 } ^ i / i . Ax crash due to new active expire division by zero.
- Avoid sentinel changes pG P # 2 / 9 q R +romoted_slave to be its own replica.
- Fix bug on KEYS command where pattern starts with * followed bk – J ? !y x00.
- Threaded I/O: now the main thres d $ t N #ad is used as well to do I/O.
- Many fixes to modules APIs, and more to come in the next RCs.
- ld2string s= ) M ~ W T V Zhould fail if string contains in the middle.
- Make the Redis test more reliable.
- Fix SPOP returningc q % u ~ p T nil (see #4709). WARNING_ Y 1 Z 6 B: API change.
Redis 6 RC2 带来了许多批改和新功用,尤其是客户端的缓存功用,此版别的重大x . T T S更改如下列表。
- ACL Ly S J r k %OG:记录回– q i u x V绝的指令,密钥访问和身份验证。
- 从头规划了客户端缓存。现在,咱们运用密钥而不是缓存插槽。
- 客户端缓存:已完成广播形式。
- 客户端缓存:已e X – ~完成 OPTIN/OPTOUT 形式。
- 删除用于在非[ k C ; v持久性实例中进行仿制的 Rb c aDB 文件(可选)。
- 批改程序(仅选定的批改程序,请参阅一切批改程序的提交):
- 在边际情况下对流的不同批改。
- 批改因为 RESP3 更改而导致重复的 CLIENT SETNAME 答复。
- 批改因新的有效到期除以零而导致的溃散。
- 避免将岗兵更改提升为自己的副本。
- 批改了 KEYS 指令中以 * 最初,后跟 x00 的过错。
- 线程 I/O:现在也运用主线程来执行 I/O。
- 对模块API进行了许多批改,而在下一个RC中还会有更多批改。
- 假如字符串中心包括 ,则 ld2string 应该失败。
- 使 Redis 测验更牢靠。
3.M I ) q y o x . HRedis 6.0-rc3 更新日志
Dear users, this is a list of thK ~ / m ` qe major chad 3 N L $ N lnges in this release, please check
the list of commits for detail:
- Fix crash due to refactoring for SSL, for the connection code.
- Precise timeouts for blocking commands. Now the t# 2 | Oimeouts have HZ
resolution re| * ` gardlesB ; 9 % [ : w p Bs of the numbr G * C Q * y oer of con1 a = ~ x 3 nected 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 res_ ] + t t x T f Hync.
- Redis_ g 7 ) u #-cli ask password mode to be prompted at startup (for additional safety).
- Keyspace notifications addedp N _ to MIGRATE / RESTORE.
- Threaded I/O bugs fixed.
- Implement new ACL style AC R { b _ S O XUTH in Sentinel.
- Make ‘requirepass’ more backward compatible with Redis <= 5.
- ACL: Handle default user as disabled if it’s off rega, b 2rdless of “nopass”.
- Fix a potential inconsistency when upgrading an instance iv ] T ! L p Un Redis Cl{ t {uster
and restarting it. The instance will act as a replica but will actually bL Y k V l ke
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.
- MaB L $ M c 3 k 1 xny different fixes to module APIs.
- BITFIELD_RO added to call the comman# ! 9 ] Hd on read only replicas.
- PSYNC2: meaningful offsec 0 : 4 . { ot implemenz + N c W 0tation. Allow the disconnected master
that is still sending PINGs to replicas, to! b d 8 T D 4 + be able to successfully
PS= # 8 6 5 + A UYNC incrementally to new slaves, discarding the last part of the
replication bo i + wacklog consisting only of PINGs.- Fix pipelined MULTI/EXEC during Lua scripts are in B* B 8 8 0 – * 2USY state.
- Re-fix propagationq d Y 9 API in modules, broken againy } q v | h i d l after other c. ! y $ C Rhanges.
这个版别首要是批改了一些 bug,如下列表所示:
- 批改了因为重构M _ F s A { F SSL 而导致的连接代码溃散。
- 用于阻挠指令的精确超时。现在超时已达到 HZ 分辨率,不论连接的 clinet 数量怎么。新超时存储在基数树中并按到期时刻排序。
- 批改了因为 CONFIG maxclients 而调整事情循环Y ` ( a X S大小时发生的稀有溃散。
- 批改部分从头同步成功后的 systemd 准备情况。
- Redis-cli 询问密码形式将在启动时提示(以提高安全性)。
- 键空间通知已增加到 MIG; W ]RATE) q P ; # I =/RESTORE。
- 批改了线: @ m ) | ~ c J程 I/O 过错。
- 在 Sent5 p g Ninel 中完成新的 ACL 款式 AUTH。
- 使 ‘requirepass’ 与 Redis<=5 更向后兼容。
- ACL:假如默许用户关闭,则将其视为禁用状况,而不论其是否N Y x Z b ! 6 d为“ nopass”。
- 批改了在 Redis 群会集升级实例时或许呈现的不一致问题; 7 ( I % X % v o
- -READONLY 过错后中止业务。
- 对模块 API 的许多不同批改。
- 增加了 BITFIELD_RO 以在只读副本上调用该指令。
- PSYNC2:有意义的偏移量完成。答应断开连接的主机仍在q B y –向副本发送 PING,以便能够成功 PSYNC 以增量方法传递给新的从: * $ 7站,从而丢弃了仅由 PING 组成的仿制积压。
- 批改 Lua 脚本处于繁忙状况时流水线的 MULTI/EXEC。
- 从头批改模块中的传播 API,在其他更改后再次中断。
4.Redis 6.0-rc4 更新日志
Hi all, this the latest release candidate of Redis 6. This is likely to
be very similar to what you’ll see in Redis 6 GA. Please test it and
report any issue :-)Main changes in this release:
* Big INFO speedup when using a lot of of clients.
* B; T ! h * iig speedup on all the blocking commands: n/ x m 7ow blocking
on the same key is O(1) instead of being O(N).
* Stale replicas now a/ 2 :llow MULTI/EXEC.
* New c2 | #ommand: LCS (Longest Common S} h k _ 5 : X r 5ubsK d ) w eequence).
* 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)
此版别首要新增的内容如下:
- 提高了大量客户端连接时运用 INFO 指令的查询速度。
- 在一切阻挠指令上都大大加快了速度:现在能够阻挠在同一键上是 O(1a T )而不是 O(N)。
- 陈旧的副本现在答应 MULTI/EXEC。
- 新指令:LCS(最长公共子序列)。
- 增加新装备以d % O p J使 DEL 像 UNLINK。
- RDB 加载加快。
- 批改了许多过错。
5.Redis 6.0.0 GA 更新日志
H3 0 5 ki all, finally we have Redis 6.0.0 GA! Enjoy this new Redis release.
Most of the documentation was u+ _ N [ %pdateg E j * 9 * z Gd today so that you can likely
find what you are lookinp R S A Rg for about the nn +ew feate R o [ ) Vures at redib & ! S F Q y .s.io.
Thu 4 [ x b y Cis is the list of what changed compared to the previoius release candidate:
- XCLAIM AOF/replicas propagation fixed.
- Client side caching: new NOLOOP option tot H q ! avoid getting notified about
changes performed by ourselves.- ACL GEa U g 7NPASS now uses HMAC-SHA256 and have an optional “bits” argument.
IH G P @ # N Nt means you can use it as a general purpose “secure random strings”
primitive!- ClX E 1 ^ Nuster “SLK x QOTS” sc @ – U ) 9 [ pubcommand memory optimization.
- The LCS cx , v 6 # i { Uommand9 R * q is now a subcommand of STRALGO.
- Meaningful offset for replicas as well. More suc0 D ocessful partial
resynchronizations.- Optimize memory usage of deferred replies.
- Faster CRC64 algorithm[ – q – V 8 for faster RDB loading.
- XINFO ST3 [ n T { V s L jREAM FULL. 6 / p B ~ } b, a new subcommand to get the whole stream state.
- CLIENT KIL= 5 B aL USER .
- MIGRATE AUTH2 option, for ACL style authentication support.
- Other random bugfixes.
此日W C o N ! B志更新的首要内容如下:
- XCLAIM AOF/replicas 传V v – N ) T Q播已批改。
- 客户端缓存:新的 NOLOOP 选项以避免收到有关自己执行的更改。
- ACL GENPASS 现在运用 HMAC-SHA256,并具有一个可选z b z Q 4 X的“位”参数。这意味着您能够将其用作通用K z $ L c的“安全随机字符串”原始!
- 群集“SLOTS”子指令的内存优化。
- LCS 指令现在是 STRALGO 的子指令。
- 副本的有意义的偏移量。更成功的部分从头同步。
- 优化延迟回复的内存运用。
- 更快的 CRC64 法可8 [ s % H更快地加载 RDB。
- XINFO STREAM FULL,一个新的子指令,用于获取整个流状况。
- CLIENT KIS & d ^ 8 , $LL USER <用户名a ~ r – 3 S>。
- MIGRATE AUTH2 选项,用于 ACL 款式身份验证支持。
- 批改了一些其他过错。
Rl R x 7 7 E w j ]edis 6.0.1 正式版的下载地址为:redis.io/
官方的更新日志(英文):raw.githubusercontent.com/antirez/red…
总结
综合以上一切版别的更新日志咱们发现,这次 Redis 6.0 带来的首要功用是:
- 供给了很多的新模块(modules)API
- 供给了客户端缓存功用
- 多线程 I/O 才能
- 提升了 RDB 日志的加载速度
- 修改了若干 bug 和一些优化
其间多线程I/O 才能是咱们最重视的功用了,有人用它和单线程的版别做个一个性能对比,如下图所示:
(注:图片来源于 iTushou.coB | Z y : Zm)
从以上成果能够看到 GET/SET 指令在多线程版别中的性能比较单线程现已翻倍了。
总体来说,此次 RedJ 0 Z v L : r ? mis 6.0 带给咱们的功用仍是很大并且很有用的,仅仅版别改动太大,咱们需求等待时刻的验证和大量的测验之后才主张上线至生产环境。
最终的话
原创不易,假如觉得本文对你有用,请顺手点击一个「赞」,这是对作者最大的支持与鼓舞,谢谢你。
参阅 & 道谢
R3 W K [ 7 N Yedis 官方文档
重视大众号「Java中文社群」回复“干货”,获取 50 篇原创干货 Top 榜。