当前位置:网站首页>How does redis view the memory size occupied by a single key
How does redis view the memory size occupied by a single key
2022-04-22 13:19:00 【m0_ sixty-seven million three hundred and ninety-two thousand s】
utilize rdbtools Of redis-memory-for-key Command to view a single key Details of
official github as follows :
https://github.com/sripathikrishnan/redis-rdb-tools
Installing the tool requires python Of pip Package management , So install the environment first :
https://www.runoob.com/w3cnote/python-pip-install-usage.html

After installation , You can use redis-memory-for-key The command ,

Let's first try to see that the type is hash,hash The key is 2 Of redisObject Size occupied

s- host /ip,p- port ,d-database

bytes: Number of bytes occupied
type: Key type
encoding:redisObject The encoding format of , That is, the type of data structure that actually stores data inside
Number of Elements: Number of internal elements
Then insert another k,v. adopt bytes Subtract to get 2 How much memory does it take .

We know redis Of hash In the internal k,v Number <=512 Will use ziplist Compress the list to store data , When the number of elements is greater than 512 For each hour hashtable To store , We can do an experiment , utilize lua towards hash Insert 512 Elements ,
for i=1,512,1 do redis.call('hset', 2,i,i) end;return 1

Then let's look at the size and type of the interior

Then we insert another element

Then check the changes

Find out redis-memory-for-key The command is still relatively accurate . Besides this function ,rdbtools There are also other interesting features , Those interested can go to the official github Look around ...
版权声明
本文为[m0_ sixty-seven million three hundred and ninety-two thousand s]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204221307031774.html
边栏推荐
- Learn shell script (5) -- function, random number, regular expression
- Heterogeneity and stability data of senior management team (including code, calculation process and original data)
- Node debugging guide - inspector protocol
- Alibaba cloud changes its commander and competes for Huawei's territory
- Wong Kwong Yu Kwai tiktok is unable to sleep soundly.
- Ros2 - use of parameters
- Teach you what to beep
- Altium Designer导出Gerber文件的一般步骤
- mysql FUNCTION xxx.charindex does not exist
- When doing correlation analysis, how to exclude singular value outliers to increase the accuracy of correlation analysis
猜你喜欢

RT-Thread配置SPI-Flash(W25Q256)

ROS2——手把手教你编写一个服务

Oracle netsuite customers say | the "core secret script" for more detailed process control of China Film Barco

The design method and type of flexible printed circuit board (PCB) are analyzed in detail

Advertising offensive and defensive war of Internet giants

托宾Q数据-沪深A股上市公司(含行业名称、代码等指标)2003-2020

NoSQL survey Part3: open source failure

Can ainai get out of the dilemma by 35 billion yuan?

linux下redis6.详细安装

抖音快手卧榻之侧,黄光裕难以酣睡
随机推荐
PM4PY - 分析建议怎样的BPMN可以转换成Process Tree
Use opencv's function threshold () to threshold the image based on Otsu - and attach a good blog link to introduce the principle of Otsu
mysql数据库已经成功启动,可是show不是内部或外部命令,该如何解决呢?
redis内存使用info memory命令参数解析
POJ 3259 最短路SPFA + 负环 (模板)
HDU 2680 shortest path Dijkstra + chained forward star + priority queue (template)
How does MySQL sort by default when using the select statement without order by?
关于chartjs 屏幕大小自适应
算法---设计推特(Kotlin)
Get rid of the "small workshop" of AI production: how to build a cloud native AI platform based on kubernetes
C custom button implementation source code
With the help of digital business cloud real estate industry procurement platform solution, realize simple, intelligent and compliant procurement
NoSQL survey Part3: open source failure
Model based RL概述
Alibaba cloud changes its commander and competes for Huawei's territory
The sales volume is cut by half, and there is no blueprint for lantu
封装统一响应结果枚举类(工具模块)
How to realize the conversion between array and list?
Walking in the clouds - above firewood, rice, oil and salt
MySQL8. 0 learning record 08 - data type default