Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is Virtual Memory in Redis

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "what is Virtual Memory in Redis". In daily operation, I believe many people have doubts about what is Virtual Memory in Redis. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the doubt of "what is Virtual Memory in Redis?" Next, please follow the editor to study!

The beta version of VM is already included in the 2.0 test version, but in fact this function is quite mature. You can use it by setting the vm-enabled parameter in the configuration file to yes

To put it simply, Redis Virtual Memory is Redis will support some options, through configuration, you can set the maximum use of memory, when beyond this memory, through LRU (Least Recently Used) similar algorithm, save part of the data into the file, only save the frequently used data in memory.

This method is very similar to the xmsiz parameter of TokyoCabinet. In Redis, this configuration is called vm-max-memory

Like TC, Redis does not really store all data larger than vm-max-memory in memory, no matter how small the vm-max-memory setting is, all index data is stored in memory (Redis's index data is keys), that is, when vm-max-memory is set to 0, all value actually exists on disk.

What is Redis's Virtual Memory?

The official Redis documentation makes some recommendations for the use of VM:

When your key is small and your value is large, the effect of using VM is better. Because the memory saved in this way is larger.

When your key is not small, consider using some unusual methods to turn a large key into a large value. For example, you can consider combining key,value into a new value.

It is best to use linux ext3 and other file systems that support sparse files to save your swap files.

Vm-max-threads this parameter, you can set the number of threads to access the swap file, it is best not to exceed the number of cores of the machine. If set to 0, then all operations on the swap file are serial. It may cause a long delay, but there is a good guarantee for data integrity.

With the VM feature, Redis has finally got rid of the nightmare of limited memory capacity, as if we can call it a Redis database, and we can imagine how many new uses can be generated. Of course, I hope this feature will not affect the memory storage performance of Redis's original very good memory storage.

At this point, the study of "what is Virtual Memory in Redis" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report