歡迎光臨
每天分享高質量文章

Redis 5.0 正式釋出!一網打盡所有新特性!

精品專欄

 

作為一統快取江山的redis,正式釋出了5.0穩定版(stable),激不激動,開不開森?Github連結:https://github.com/antirez/redis/releases/tag/5.0.0 ,讓我們一起看看它帶來了哪些振奮人心的新特性:

官方列舉特性如下:

  1. ======================================================

  2. Redis 5.0.0     Released Wed Oct 17 13:28:26 CEST 2018

  3. ======================================================

  4. what's new in Redis 5:

  5. 1. The new Stream data type. https://redis.io/topics/streams-intro

  6. 2. New Redis modules APIs: Timers, Cluster and Dictionary APIs.

  7. 3. RDB now store LFU and LRU information.

  8. 4. The cluster manager was ported from Ruby (redis-trib.rb) to C code

  9.    inside redis-cli. Check `redis-cli --cluster help` for more info.

  10. 5. New sorted set commands: ZPOPMIN/MAX and blocking variants.

  11. 6. Active defragmentation version 2.

  12. 7. Improvemenets in HyperLogLog implementations.

  13. 8. Better memory reporting capabilities.

  14. 9. Many commands with sub-commands now have an HELP subcommand.

  15. 10. Better performances when clients connect and disconnect often.

  16. 11. Many bug fixes and other random improvements.

  17. 12. Jemalloc was upgraded to version 5.1

  18. 13. CLIENT UNBLOCK and CLIENT ID.

  19. 14. The LOLWUT command was added. http://antirez.com/news/123

  20. 15. We no longer use the "slave" word if not for API backward compatibility.

  21. 16. Differnet optimizations in the networking layer.

  22. 17. Lua improvements:

  23.     - Better propagation of Lua scripts to replicas / AOF.

  24.     - Lua scripts can now timeout and get in -BUSY state in the replica as well.

  25. 18. Dynamic HZ to balance idle CPU usage with responsiveness.

  26. 19. The Redis core was refactored and improved in many ways.

Redis開源社群版新特性

下麵我們對一些重要特性進行更深入的瞭解。

Streams

全新的資料型別:Streams。官方把這個當做是最重要的改進(The most important user facing improvement is without doubts the introduction of the new general purpose data type after years: the streams. )。而且官方提到在發版本的幾個小時前還在修複streams的問題,所以官方也不敢保證release版本是否有一些比較嚴重的BUG(T T),官方還是建議大家在生產環境不要使用streams,這樣可能會有更好的體驗,扎心了(People not using the streams can have probably a better production-ready experience with Redis 5)。

筆者接下來還會單獨撰文剖析Streams,敬請關註。

cluster manager with c

redis終於還是拋棄了ruby,維護過redis3.x和redis4.x的都知道,主要依賴redis-trib.rb指令碼,redis5.0徹底拋棄了它,將叢集管理功能全部整合到完全用C寫的redis-cli中。可以透過命令 redis-cli--cluster help檢視幫助資訊。

LOLWUT

redis5.0新增的一個命令,官方對它的描述是:a piece of art inside a database command,翻譯過來可以資料庫命令中的一件藝術品(老外真幽默)。

這個方法原始碼註釋如下: This file implements the LOLWUT command. The command should do something fun and interesting, and should be replaced by a new implementation at each new version of Redis。原始碼連結:https://github.com/antirez/redis/blob/5.0.0/src/lolwut5.c,有興趣的同學可以看看redis作者在5.0版本中實現了些什麼好玩的東西。

有興趣的同學還可以延伸閱讀:http://antirez.com/news/123

Lua改進

lua指令碼能更好的傳播到replicas/AOF。replicas也就是以前的slave,大家都知道redis的slave事件前段時間鬧的沸沸揚揚,現在redis官方都改稱replicas了,並且申明除非為了API向後相容,否則不再使用slave這個詞(We no longer use the "slave" word if not for API backward compatibility.)。

lua指令碼現在還能支援超時,並且可以在replica中進入BUSY狀態。

動態HZ

以前redis版本的hz都是固定的,5.0將hz動態化是為了平衡空閑CPU的使用率和響應能力。


其他一些比如HyperLogLog實現改進,RDB檔案新增儲存LFU和LRU資訊,sorted set新增兩個命令ZPOPMIN/MAX,Jemalloc升級到5.1等特性就不一一解讀了。

Redis Enterprise Software新特性

Redis開源許可從AGPL 遷移到將 Apache v2.0 與 Commons Clause 相結合的許可證,下麵介紹的這些特性不再是開源軟體,而是原始碼可用(source available)。

備註:Commons Clause 的初衷是為了抵禦一些不良行為。如那些使用原始碼,卻不對開原始碼維護做出補償的公司。” ---- Commons Clause 開發者兼 FOSSA 創始人 Kevin Wang。

support docker

現在官方版本正式支援在Docker容器上部署和執行Redis叢集了。有了官方的映象,你能非常容易並快速部署幾個容器來執行一個可擴充套件的,高可用的Redis叢集。想要瞭解更多請戳連結:https://redislabs.com/redis-enterprise-documentation/getting-started/docker/。

Redis Labs’ Modules

Redis Labs開發了3個模組,並且被Redis企業軟體(簡稱RS)認證,這些模組是: RediSearch:這個模組將RS變成了一個基於記憶體的分散式全文索引和搜尋引擎,感覺好牛逼的樣子(ES表示不服)。 ReJSON:透過模組名稱就知道,JSON作為Redis的內建資料型別。  ReBloom: RS具有可擴充套件的Bloom過濾器,並且是一個資料型別。Bloom過濾器是一種機率性的資料結構,在快速判斷某些元素是否被包含在一個集合這方便表現的非常好。

參考

https://redislabs.com/redis-enterprise-documentation/overview/new-features-redis-enterprise/

https://raw.githubusercontent.com/antirez/redis/5.0/00-RELEASENOTES

    作者公眾號,歡迎關註!!

    

MySQL的索引是什麼?怎麼最佳化?

在一個千萬級的資料庫查尋中,如何提高查詢效率?

你真的瞭解try{ return }finally{}中的return?

推薦四十多條純乾貨 Java 程式碼最佳化建議

一個致命的 Redis 命令,導致公司損失 400 萬!!

美團三面:一個執行緒OOM,行程裡其他執行緒還能執行麼?

設計樣式六大原則,你真的懂了嗎?

6 個實體詳解如何把 if-else 程式碼重構成高質量程式碼

END


>>>>>> 加群交流技術 <<<<<<

贊(0)

分享創造快樂

© 2024 知識星球   網站地圖