吉首大学学报(自然科学版) ›› 2024, Vol. 45 ›› Issue (1): 36-41.DOI: 10.13438/j.cnki.jdzk.2024.01.007

• 计算机 • 上一篇    下一篇

基于一致性哈希算法的分布式数据库索引查询优化方法

刘晓梅,董仲博   

  1. (1.烟台职业学院信息工程系,山东 烟台 264000;2.山东航天电子技术研究所,山东 烟台 264000)
  • 出版日期:2024-01-25 发布日期:2024-01-31
  • 作者简介:刘晓梅(1980—)女,山东烟台人,烟台职业学院信息工程系讲师,主要从事数据库研究.

Distributed Database Index Query Optimization Method Based on Consistent Hash Algorithm

LIU Xiaomei,DONG Zhongbo   

  1. (1.Department of Information Engineering,Yantai Vocational College,Yantai 264000,Shandong China;2.Shandong Institute of Aerospace Electronics Technology,Yantai 264000,Shandong China)
  • Online:2024-01-25 Published:2024-01-31

摘要:为了解决分布式数据库索引查询负载不平衡的问题,基于一致性哈希算法设计了分布式数据库索引查询优化方法.根据分布式数据库服务器节点CPU处理能力、带宽和缓存大小,采用动态反馈机制计算各服务器节点的索引查询负载率,通过一致性哈希负载平衡算法将任务分配给各服务器节点,并实时调整负载.以最小总代价为目标,利用多蚁群算法求得最佳查询路径.实验结果显示,基于一致性哈希算法的优化方法整体曲线趋势较平稳,在用户请求数量为4 000条时,最大负载平衡度为1.5%,全程响应时间小于35 ms.这说明该方法能够有效调整分布式数据库的负载分布,且受数据库规模影响较小,具备强大的查询响应能力.

关键词: 一致性哈希, 索引查询, 分布式数据库, 负载平衡, 多蚁群算法, 学习算子

Abstract: In order to solve the problem of imbalanced load in distributed database index queries,a distributed database index query optimization method is designed based on consistent hashing algorithm.Based on the CPU processing capacity,bandwidth,and cache size of distributed database server nodes,a dynamic feedback mechanism is used to calculate the index query load rate of each server node.A consistent hash load balancing algorithm is used to allocate tasks to each server node and adjust the load in real time.Multiple ant colony algorithms is used to find the optimal query path with the goal of minimizing the total cost.The experimental results show that the optimization method based on consistent hashing algorithm is stable and can reduce the load balancing degree to 1.5% when the number of user requests is 4 000,with a full response time of less than 35 ms.This indicates that this method can effectively adjust the load distribution of distributed databases,is less affected by database size,and has strong query response capabilities.

Key words: consistent Hash, index query, distributed database, load balancing, multi-ant colony algorithm, learning operator

公众号 电子书橱 超星期刊 手机浏览 在线QQ