当前位置:网站首页>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;- 节省内存的数据访问,设置共享对象节省内存。
边栏推荐
- The MariaDB database was found 12 hours late
- 4-5 count words and spaces (15 points)
- Huawei interview question: divide candy
- [ten minutes] manim installation 2022
- X Book 6.89 shield unidbg calling method
- C # basic learning (XIII) | breakpoint debugging
- OP diode limit swing
- C#【高级篇】 C# 匿名方法【待补充Lambda表达式。。。】
- TiDB 6.0:让 TSO 更高效丨TiDB Book Rush
- golang bilibili直播彈幕姬
猜你喜欢

发现mariadb数据库时间晚了12个小时

数据库的下一个变革方向——云原生数据库

unity input system 使用记录(实例版)

Tidb 6.0: rendre les GRT plus efficaces 丨 tidb Book Rush

MySQL extracts strings from table fields

1152_ Makefile learning_ Pattern matching rules

Reasons for MySQL master-slave database synchronization failure
![[qt] qmap usage details](/img/ee/6e71a3dc5b90d2d1b7f7d3f6b56221.png)
[qt] qmap usage details

Stc89c52/90c516rd/89c516rd DHT11 temperature and humidity sensor drive code

Implementation of property management system with ssm+ wechat applet
随机推荐
X书6.97版本shield-unidbg调用方式
Openssl3.0 learning 22 provider decoder
Realization of BFS in C language by storing adjacency matrix of graph
What is the metauniverse: where are we, where are we going
C#【高级篇】 C# 匿名方法【待补充Lambda表达式。。。】
Redis高并发分布式锁(学习总结)
Global and Chinese market of ULTRACENTRIFUGES 2022-2028: Research Report on technology, participants, trends, market size and share
Mathematical solution of Joseph Ring
Wechat applet +php to realize authorized login operation
unity input system 使用记录(实例版)
The next change direction of database - cloud native database
The MariaDB database was found 12 hours late
golang bilibili直播弹幕姬
如果辨别我现在交易的外盘股指期货交易平台是否正规安全?
Use of foreach in QT
C#【高级篇】 C# 多线程
华为面试题: 分糖果
1150_ Makefile learning_ Duplicate name target processing in makefile
Use of Arthas
[untitled]
