Redis 6.0.1 於 2020 年 5 月 2 日正式發佈了,如 Redis 做者 antirez 所說,這是迄今爲止最「企業」化的版本,也是有史以來改動最大的一個 Redis 版本,同時也是參與開發人數最多的一個版本。node
因此在使用此版本以前,建議各位開發者先進行深刻的測試再考慮投產,畢竟生產壞境無小事。好了,回到本文的重點,接下來咱們來重點看下 Redis 6.0.1 給咱們帶來了那些新功能。git
Redis 6 的更新日誌,主要包含如下五部分的內容:github
除了以上這些版本的更新日誌外,還有 6.0.1 正式版的更新日誌,不過這個正式版的發佈時間只比 Redis 6.0.0 GA 晚了兩天,所以只修復了一些 bug,因此咱們只須要看以上五個日誌便可。redis
官方更新日誌以下:緩存
Redis 6 improves Redis in a number of key areas and is one of the largest Redis releases in the history of the project, so here we'll list only the biggest features in this release:安全
- 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: https://redis.io/topics/client-side-caching
- 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: https://github.com/artix75/redis-cluster-proxy
- A Disque module for Redis was released here: https://github.com/antirez/disque-module
此版本新增的內容最大,以下列表所示:多線程
Hi Redis users, Redis 6 is approaching and will be released 30th of April. New release candidates will be released at the end of March, then another one mid April, to finally reach the GA at the end of April.app
Redis 6 RC2 brings many fixes and new things, especially in the area of client side caching. This is the list of big changes in this release. As usually you can find the full list of commits at the end:less
New features and improvements:dom
- 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 \0 in the middle.
- Make the Redis test more reliable.
- Fix SPOP returning nil (see #4709). WARNING: API change.
Redis 6 RC2 帶來了許多修復和新功能,尤爲是客戶端的緩存功能,此版本的重大更改以下列表。
Dear users, this is a list of the major changes 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 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.
這個版本主要是修復了一些 bug,以下列表所示:
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. * 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)
此版本主要新增的內容以下:
Upgrade urgency CRITICAL: many bugs fixed compared to the last release candidate. Better to upgrade if you see things affecting your environment in the changelog.
Hi all, finally we have Redis 6.0.0 GA! Enjoy this new Redis release. Most of the documentation was updated today so that you can likely find what you are looking for about the new features at redis.io. This is the list of what changed compared to the previoius release candidate:
- 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.
- MIGRATE AUTH2 option, for ACL style authentication support.
- Other random bugfixes.
此日誌更新的主要內容以下:
Redis 6.0.1 正式版的下載地址爲:https://redis.io/
官方的更新日誌(英文):https://raw.githubusercontent.com/antirez/redis/6.0/00-RELEASENOTES
綜合以上全部版本的更新日誌,咱們發現此次 Redis 6.0 帶來的主要功能是:
其中多線程 I/O 是咱們最關注的功能了,有人用它和單線程的版本作了一個性能測試,以下圖所示:
(注:圖片來源於 iTushou.com)
從以上結果能夠看到 GET/SET 命令在多線程版本中的性能相比單線程已經翻倍了。
整體來講,這次 Redis 6.0 帶給咱們的功能仍是不少且比較實用的,只是版本改動很大,所以咱們須要必定的時間和大量的測試驗證以後才建議上線。