《计算机应用》唯一官方网站

• •    下一篇

基于一致性哈希的区块链存储优化策略

刘明灏1,洪建磊1,王成翔1,赵金东2   

  1. 1. 山东省烟台市烟台大学
    2. 烟台大学计算机与控制工程学院
  • 收稿日期:2024-12-31 修回日期:2025-02-05 接受日期:2025-02-11 发布日期:2025-03-21 出版日期:2025-03-21
  • 通讯作者: 赵金东

Blockchain Storage Optimization Strategy based on Consistent Hashing

  • Received:2024-12-31 Revised:2025-02-05 Accepted:2025-02-11 Online:2025-03-21 Published:2025-03-21

摘要: 摘 要: 为了解决区块链数据量剧增带来的存储问题,提出一种改进的一致性哈希算法,以实现区块链存储扩展。针对Hyperledger Fabric在企业级应用中节点存储负载不均和数据倾斜的问题,基于一致性哈希算法提出了改进方案——基于虚拟节点分配与动态权重策略的哈希算法(Hash algorithm based on Virtual Node allocation and Dynamic Weight Strategy,VNDWS)。首先,采用虚拟节点分配机制,为每个节点动态分配多个虚拟节点,使数据在哈希环中均匀分布,减少负载不均;其次,应用动态权重机制,基于节点存储能力和网络延迟等性能指标实时调整权重,使高性能节点承担更多数据负载,从而优化数据分配和存储效率。仿真实验结果表明,与传统区块链Fabric网络和传统一致性哈希算法相比,VNDWS算法分别降低了48.31和6.39个百分点的节点存储消耗,而数据查询效率分别提升了96.25%和21.95%。VNDWS算法在存储扩展方面能有效降低节点存储消耗并提高查询效率。

关键词: 关键词: 区块链, 存储扩展, 一致性哈希, 虚拟节点, 动态权重

Abstract: In order to address the storage problem caused by the rapid growth of blockchain data, an improved consistent hashing algorithm was proposed to achieve blockchain storage scalability. To address the problem of uneven node storage load and data skew in Hyperledger Fabric for enterprise applications, an improved solution based on consistent hashing was proposed— the Hash Algorithm based on Virtual Node Allocation and Dynamic Weight Strategy (VNDWS). Firstly, a virtual node allocation mechanism was adopted to dynamically assign multiple virtual nodes to each node, ensuring an even distribution of data across the hashing ring and reducing load imbalance. Secondly, a dynamic weight mechanism was applied to adjust weights in real-time based on performance indicators such as node storage capacity and network latency, enabling high-performance nodes to handle larger data loads, and thereby optimizing data distribution and storage efficiency. Simulation results showed that compared with the traditional blockchain Fabric network and the conventional consistent hashing algorithm, the VNDWS algorithm reduced node storage consumption by 48.31% and 6.39%, respectively, while improving data query efficiency by 96.25% and 21.95%. The VNDWS algorithm effectively reduces node storage consumption and enhances query efficiency in terms of storage scalability.

Key words: Keywords: blockchain, storage expansion, consistent hashing, virtual node, dynamic weight

中图分类号: