当前位置:网站首页>Who says redis can't save big keys

Who says redis can't save big keys

2022-06-09 13:42:00 Huawei cloud developer Alliance

Abstract : Recommended GaussDB(for Redis) Get it done " Big key" Storage , Fundamentally solve the community version Redis Use risk .

This article is shared from Huawei cloud community 《 Hua Wei Yun GaussDB(for Redis) Uncover secrets 18 period : Who says Redis Cannot save large key》, author : gaussian Redis The official blog .

One 、 Community Edition Redis The big key Pain points

GaussDB(for Redis) Expert Xiaoqiang has been a little busy recently , Because many account managers come to him to consult the community version Redis The big key problem , And all of them are eager for knowledge :

Xiaoqiang slaps his thigh : You really asked the right person !

According to the current network experience , The production environment is large key As a result of Redis Accidents are common , The typical one is capacity expansion failure 、 Request blocking 、OOM Downtime, etc . Inadequate early business planning 、 Message queue consumption is not timely 、 Failure to clean up invalid data in time and other reasons may lead to big key hidden danger .

Community Edition Redis Big key Hidden dangers are common in the following three scenarios

  1. Memory consumption is uneven , Big key There are OOM risk
  2. Some data needs to be moved during capacity expansion , Big key It takes a long time , It will lead to access blocking and even data loss
  3. Delete or expire large key when , Business access is blocked for a long time , Even lead to master-slave synchronization interruption

Community Edition Redis The architecture is not suitable for reliable storage key, The industry can only recommend prevention 、 Disassemble or timely clean up large key. From a customer perspective , In fact, some scenes need to be big key Of , Such as enterprise ERP System , Massive currency exchange rate storage, etc . At this time, even if it is properly split , Also can not avoid larger HASH key There is .

Two 、 Hua Wei Yun GaussDB(for Redis) The big Key Solution

Xiaoqiang always believes that , A good product should try to leave the complexity to itself , Leave simplicity to users . therefore , Xiaoqiang asks everyone about big key The problem account managers are Amway better Solution —— Use Huawei cloud enterprise level KV database GaussDB(for Redis).

Big key scenario ,GaussDB(for Redis) It's better than the community version Redis Where is the excellence ? The following from 3 In depth analysis from three angles :

1. gaussian Redis Support big key Storage , Don't worry about fragmentation OOM

  • Community Edition Redis Big storage key This will lead to uneven consumption of fragmented memory , As the overall data volume of the cluster rises , Big key At any time, there are OOM risk .

  • gaussian Redis Support big key Reliable storage , And will not lead to fragmentation OOM. It should be noted that , Although Gauss Redis Suitable for reliable storage of large key, But from the perspective of network links , The business should avoid large key Perform such as hgetall And so on .

2. gaussian Redis At large key The scene also supports second level lossless capacity expansion

  • Community Edition Redis During the expansion , Due to data relocation , At this time, the painting style is like this :

chart : Community Edition Redis At large key Scene expansion , High risk

It can be summarized as : Have big key, Open source Redis Please expand the capacity carefully !

  • gaussian Redis Support second level capacity expansion , And support to upgrade the specification 、 Add nodes 、 Add storage capacity 3 Flexible capacity expansion by means of , Excellent operation and maintenance experience .‍

chart : gaussian Redis At large key The scenario can be safely expanded

As can be seen from the above figure , gaussian Redis By calculation 、 Architecture separation storage , There is no need to move any data during capacity expansion , So speed 、 The stability is far better than the community version Redis. Have big key, gaussian Redis You can safely expand the capacity !

3. gaussian Redis Delete / Overdue large key when , Business 0 Blocking

  • Community Edition Redis Big key The deletion of / Expiration will lead to severe access blocking . Measured delete / One big overdue hash key( contain 1000w Elements ), Community Edition Redis Access is blocked for a whole 14 second .

chart : Community Edition Redis At large key Delete the scenario blocking service access

Although the Community Edition Redis Provides “ asynchronous ” Of unlink The command can alleviate the big key Blocking problem , but unlink Not strictly asynchronous , For example, for zset type (skiplist code ) And all string key Can only block deletion , The risk is out of control .

  • gaussian Redis It has fundamentally solved the problem of "big..." key Delete / Hidden danger of overdue operation . In Gauss Redis in , Yes whatever Data is deleted / Be overdue , Both are executed successfully and immediately 0 Blocking . This is because the bottom layer adopts the real “ Mark deletion ”, So it doesn't affect business access at all . Measured delete / One big overdue hash key( contain 1000w Elements ), gaussian Redis only millisecond .

3、 ... and 、 summary

According to the above comparative evaluation , It can be seen that compared with the community version Redis The actual performance of , gaussian Redis More suitable for large key Reliable storage scenarios for . In addition to being able to solve business problems key Outside the pain point , gaussian Redis The stability of 、 reliability 、 Security and other aspects have also been comprehensively improved .

Huawei partners and developers conference 2022 The fire is coming , Heavy content can't be missed !

【 Wonderful activities 】

March forward courageously · Be an all-around Developer →12 Technology live broadcast ,8 High energy output of the great technical treasure , And the code room 、 Many rounds of mysterious tasks such as knowledge competition are waiting for you to challenge . Break through immediately , Open the ultimate prize ! Click to embark on the promotion of all-round developers !

【 Technical topics 】

The future has to ,2022 Technical exploration → Huawei's cutting-edge technologies in various fields 、 Heavy open source project 、 Innovative application practice , Standing at the entrance of the intelligent world , Explore how the future shines into reality , Full of dry goods, click to learn

Click to follow , The first time to learn about Huawei's new cloud technology ~​​​​​​​

原网站

版权声明
本文为[Huawei cloud developer Alliance]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/160/202206091233245827.html