当前位置:网站首页>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值。
边栏推荐
猜你喜欢
RSTP(端口角色+端口状态+工作机制)|||| 交换机接口分析
LINGO 18.0软件安装包下载及安装教程
HCIP练习(OSPF)
【LeetCode】112. Path sum
JMeter接口自动化发包与示例
面渣逆袭:MySQL六十六问,两万字+五十图详解
HCIP练习02(OSPF)
NFT到底有哪些实际用途?
What are pseudo-classes and pseudo-elements?The difference between pseudo-classes and pseudo-elements
LINGO 18.0 software installation package download and installation tutorial
随机推荐
Laya中关于摄像机跟随人物移动或者点击人物碰撞器触发事件的Demo
机器学习(公式推导与代码实现)--sklearn机器学习库
RSTP(端口角色+端口状态+工作机制)|||| 交换机接口分析
HCIP实验(06)
AD环境搭建
多媒体数据处理实验2:PCA
Scala parallel collections, parallel concurrency, thread safety issues, ThreadLocal
合并两个有序链表
dflow入门2——Slices
Guava-字符串工具
flush tables
获取JDcookie的方法
Exception: Dataset not found. Solution
The display of the article list and the basics of creating articles and article details
安装mysql-workbench
Redisson实现分布式锁
STP生成树(端口状态+端口角色+收敛机制 )|||| STP优化技术( uplinkfast技术+Portfast技术+backbonefast技术 )详解
word之个人设置
【TPC-DS】25张表的详细介绍,SQL的查询特征
Alibaba Cloud SMS Sending