当前位置:网站首页>Redis中的Hash设计和节省内存数据结构设计
Redis中的Hash设计和节省内存数据结构设计
2022-06-30 03:22:00 【阿联爱学习】
1,redis中Hash设计
- 冲突避免:拉链法
- 数组扩容:延迟rehash操作,每次复制一个bucket,一般是从h[0]复制给h[1],赋值完之后h[1]在赋值给h[0].
2,redis高效内存设计
- string长度小于44的可以用嵌入式string,可以将stringobjct和sds分配在一起,只需要一次内存分配,超过44的需要一次分配stringobject和ssd。
- ssd设计可以减少len和拼接的开销,也可以存储'/0'字符。
- 压缩链表可以按照不同的数据进行不同编码存储,节省内存空间。
- intset,整型集合,是set的底层数据结构,如何实现set去重呢,intset中的数组是有序数组,重复则不插入,插入新值会涉及到数组移动。
typedef struct intset { uint32_t encoding; uint32_t length; int8_t contents[]; } intset;- 节省内存的数据访问,设置共享对象节省内存。
边栏推荐
- 如果辨别我现在交易的外盘股指期货交易平台是否正规安全?
- Code for generating test and training sets
- Auto. JS learning notes 15:ui interface basics of autojs Chapter 2
- Mysql提取表字段中的字符串
- How does the trading platform for speculation in spot gold ensure capital security?
- WPF initialized event in The reason why binding is not triggered in CS
- TiDB 6.0:讓 TSO 更高效丨TiDB Book Rush
- Tri rapide, index groupé, recherche de la plus grande valeur K dans les données
- Problem record: FEL_ lib. c:26:10: fatal error: libusb. h: There is no such file or directory
- Comparable和Comparator的区别
猜你喜欢
随机推荐
Prompt learning a blood case caused by a space
问题记录:fel_lib.c:26:10: fatal error: libusb.h: 没有那个文件或目录
HOOK Native API
2022 underground coal mine electrical test and underground coal mine electrical simulation test
约瑟夫环 数学解法
Functions in C language
1151_ Makefile learning_ Static matching pattern rules in makefile
1150_ Makefile learning_ Duplicate name target processing in makefile
What are the defaults for Binding. Mode=Default for WPF controls?
Mysqldump principle
The broadcast module code runs normally in autojs4.1.1, but an error is reported in pro7.0 (not resolved)
Differences between comparable and comparator
Wechat applet +php to realize authorized login operation
Customize the buttons of jvxetable and the usage of $set under notes
[qt] qmap usage details
1152_ Makefile learning_ Pattern matching rules
Global and Chinese market of bulk acoustic wave devices 2022-2028: Research Report on technology, participants, trends, market size and share
共124篇!墨天轮“高可用架构”干货文档分享(含Oracle、MySQL、PG)
TiDB 6.0:讓 TSO 更高效丨TiDB Book Rush
产品思维 | 无人机快递的未来值得期待吗?










