当前位置:网站首页>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;- 节省内存的数据访问,设置共享对象节省内存。
边栏推荐
猜你喜欢

C # basic learning (XIII) | breakpoint debugging

mysql 主从数据库同步失败的原因

golang bilibili直播弹幕姬

hudi记录

【微信小程序】条件渲染 列表渲染 原来这样用?

Utilisation de foreach en Qt

QT中foreach的使用

Principle, advantages and disadvantages of three operating modes of dc/dc converter under light load

1148_ Makefile learning_ Targets, variables, and wildcards in makefile
![[qt] qmap usage details](/img/ee/6e71a3dc5b90d2d1b7f7d3f6b56221.png)
[qt] qmap usage details
随机推荐
X书6.97版本shield-unidbg调用方式
WPF initialized event in The reason why binding is not triggered in CS
【十分钟】manim安装 2022
简单自定义MVC优化
TiDB 6.0:讓 TSO 更高效丨TiDB Book Rush
QT中foreach的使用
ZABBIX trigger explanation
zabbix 触发器详解
PHP two-dimensional array randomly fetches a random or fixed number of one-dimensional arrays
专升本高数(四)
【实战技能】如何撰写敏捷开发文档
Jvxetable sub table record loading completion event
OP-diode-限制摆幅
发现mariadb数据库时间晚了12个小时
 与空格的区别
[untitled]
How to realize remote collaborative office, keep this strategy!
The MariaDB database was found 12 hours late
1152_ Makefile learning_ Pattern matching rules
Gulang bilibilibili Live Screen Jackie
