In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the knowledge of "how to use hash instead of string to save memory". In the operation of practical cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Https://blog.csdn.net/javarrr/article/details/93380853
When a hash object can meet both of the following conditions, the hash object uses ziplist encoding:
The string length of the keys and values of all key-value pairs saved by the hash object is less than 64 bytes.
The number of key-value pairs saved by hash objects is less than 512; the underlying layer of ziplist-encoded data is to use compressed lists as the underlying data structure.
Https://www.jianshu.com/p/dee0f1edc4e4
The reason for provincial memory is that when you create a new hash object, it starts with ziplist (also known as small hash). This ziplist is not really a hash table, but ziplist can save some of the metadata storage overhead needed by hash itself compared to a normal hash implementation. Although the addition, deletion and lookup of ziplist are all O (n), the number of field of general objects is not too large. So using ziplist is also fast, that is to say, the average of adding and deleting is still O (1). If the size of field or value exceeds a certain limit, redis will automatically replace ziplist with the normal hash implementation internally, which can be controlled by specifying the hash-zipmap-max-entries parameter in the configuration file. When hash-zipmap-max-entries is set to 1000, the performance is better, and the HSET command will cause CPU consumption to become very large after 1000.
This is the end of "how to use hash instead of string to save memory". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.