当前位置:网站首页>bihash总结
bihash总结
2022-08-03 09:00:00 【懒少】
官方https://s3-docs.fd.io/vpp/22.10/developer/corearchitecture/bihash.html
Vpp uses bounded-index extensible hashing to solve a variety of exact-match (key, value) lookup problems. Benefits of the current implementation:
Very high record count scaling, tested to 100,000,000 records.
Lookup performance degrades gracefully as the number of records increases
No reader locking required
Template implementation, it’s easy to support arbitrary (key,value) types
以上介绍了bihash的优点
Initializing a bihash table
Call the init function as shown. As a rough guide, pick a number of buckets which is approximately number_of_expected_records/BIHASH_KVP_PER_PAGE from the relevant template instance header-file. See previous discussion.
The amount of memory selected should easily contain all of the records, with a generous allowance for hash collisions. Bihash memory is allocated separately from the main heap, and won’t cost anything except kernel PTE’s until touched, so it’s OK to be reasonably generous.
For example:
my_main_t *mm = &my_main;
clib_bihash_8_8_t *h;
h = &mm->hash_table;
clib_bihash_init_8_8 (h, "test", (u32) number_of_buckets,
(uword) memory_size);
bihash初始化时需要传入buckets大小和memory_size
buckets最优值:你预期存储的记录数除以BIHASH_KVP_PER_PAGE ,BIHASH_KVP_PER_PAGE 是bihash中一个page存储记录的个数,默认是4.假如存储50万记录
500000/4=125000
memory_size:最好就是能存储50万记录,存储解决hash冲突的数据结构,存储buckets,意思是给充足点。bihash 一个记录大小 kv 包含key值和value值。
边栏推荐
- LeetCode第三题(Longest Substring Without Repeating Characters)三部曲之二:编码实现
- PostgreSQL的架构
- 【微信小程序】底部有安全距离,适配iphone X等机型的解决方案
- uniapp swiper 卡片轮播 修改指示点样式效果demo(整理)
- 开发工具之版本控制
- QT中线程调用GUI主线程控件的问题
- Laya中关于摄像机跟随人物移动或者点击人物碰撞器触发事件的Demo
- 文章列表的显示 以及创建文章 还有文章详情的基本
- The Transformer, BERT, GPT paper intensive reading notes
- BOM系列之localStorage
猜你喜欢
随机推荐
Using pipreqs export requirements needed for the project. TXT (rather than the whole environment)
Scala parallel collections, parallel concurrency, thread safety issues, ThreadLocal
AD环境搭建
Mysql的in和exists用法区别
Alibaba Cloud SMS Sending
【LeetCode】112.路径总和
dflow入门1——HelloWorld!
swiper分类菜单双层效果demo(整理)
机器学习(公式推导与代码实现)--sklearn机器学习库
【LeetCode】101.对称二叉树
Batch PNG format can be converted to JPG format
chrome F12 network 保留之前请求信息
HCIP练习02(OSPF)
Unity关于编辑器扩展自定义标签,方便扩展Inspector
【收获合辑】k-NN与检索任务的异同+jupyter转pdf
软体按摩机器人驱动器的设计与仿真
CSP-S2019 Day2
10分钟带你入门chrome(谷歌)浏览器插件开发
多媒体数据处理实验3:图像特征提取与检索
C# 一周入门高级编程之《C#-接口》Day Two









