吉林大学学报(工学版) ›› 2026, Vol. 56 ›› Issue (7): 1984-1995.doi: 10.13229/j.cnki.jdxbgxb.20241348

• 计算机科学与技术 • 上一篇    

云环境下自适应容器弹性扩缩容优化方法

丁宇1(),袁麒景2,才振功2(),左海余2,李晨昊1,杨波威3   

  1. 1.浙江大学 计算机科学与技术学院,杭州 310027
    2.浙江大学 软件学院,宁波 315000
    3.浙江大学 航空航天学院,杭州 310027
  • 收稿日期:2024-12-23 出版日期:2026-07-01 发布日期:2026-08-12
  • 通讯作者: 才振功 E-mail:12021191@zju.edu.cn;cstcaizg@zju.edu.cn
  • 作者简介:丁宇(1982-),男,博士研究生. 研究方向:云计算.E-mail: 12021191@zju.edu.cn
  • 基金资助:
    国家重点研发计划项目(2024YFB4505900)

Adaptive container auto-scaling optimization method in cloud environments

Yu DING1(),Qi-jing YUAN2,Zhen-gong CAI2(),Hai-yu ZUO2,Chen-hao LI1,Bo-wei YANG3   

  1. 1.College of Computer Science and Technology,Zhejiang University,Hangzhou 310027,China
    2.College of Software Technology,Zhejiang University,Ningbo 315000,China
    3.College of Aeronautics and Astronautics,Zhejiang University,Hangzhou 310027,China
  • Received:2024-12-23 Online:2026-07-01 Published:2026-08-12
  • Contact: Zhen-gong CAI E-mail:12021191@zju.edu.cn;cstcaizg@zju.edu.cn

摘要:

针对云服务中容器弹性扩缩容过程中,在满足服务质量要求的前提下实现整体资源利用率提升与成本降低的问题,提出了一种双向长短期记忆网络、极值理论与动态利用率算法相结合的自适应容器弹性扩缩容优化方法DEBI-HPA,该方法能根据负载变化动态地调整Pod数量,有效地估计负载超高位,并自适应地调整目标利用率,以提高服务质量和资源利用率,降低资源成本。在负载不高时采用预测式扩缩容来应对未来可能持续增长的负载,而在负载已经处于超高位的情况下,采用响应式的扩缩容,能在低负载情况下保证足够Pod数以供缓冲,在高负载情况下大幅度提高资源利用率。本文与原生的Kubernetes横向扩缩容策略进行了对比,实验结果表明:在不同负载情况下此算法可使资源利用率最高提升约30%,节约资源成本最高约47%,与已有通过预测模型进行扩缩容的研究方法(ARIMA-HPA、LSTM-HPA策略)相比,该算法能将资源利用率提升约18%,资源使用成本降低约37%。本文方法仅使用常见的预测模型也能达到比较好的扩缩容效果,降低了对预测模型效果的依赖性,为云环境下的容器扩缩容提供了新的解决方案。

关键词: 弹性扩缩容, 极值理论, 动态目标利用率, 自适应算法, 双向长短期记忆网络

Abstract:

This paper introduces DEBI-HPA, an adaptive container auto-scaling method for cloud services that integrates Bi-directional Long Short-Term Memory (BiLSTM), extreme value theory, and dynamic utilization ratios. DEBI-HPA dynamically adjusts the number of Pods based on workload changes, accurately estimates extreme load levels, and adaptively sets target utilization ratios, thereby enhancing service quality, resource utilization, and cost efficiency. It employs predictive scaling during low-load periods to anticipate growth and reactive scaling under high loads to ensure efficient resource allocation. Experimental results demonstrate that DEBI-HPA outperforms Kubernetes' native Horizontal Pod Autoscaler (HPA) by increasing resource utilization by up to 30% and reducing costs by up to 47%. Compared to other predictive scaling methods like ARIMA-HPA and LSTM-HPA, DEBI-HPA improves resource utilization by approximately 18% and lowers costs by about 37%. Additionally, DEBI-HPA achieves effective scaling with common prediction models, reducing dependency on model accuracy. This method offers a novel and robust solution for container auto-scaling in cloud environments.

Key words: auto-scaling, extreme value theory, dynamic target utilization, adaptive algorithm, bidirectional LSTM

中图分类号: 

  • TP399

图1

HPA工作原理"

图2

HPA Pod扩容流程图"

图3

HPA扩容时序图"

图4

LSTM模型基本结构[24]"

图5

BiLSTM模型结构"

表1

Gγ分布尾部形态[28]"

尾部形状范围示例
厚重尾部 P(X>x)x-1yy>0Frechet
指数尾部 P(X>x)e-xy=0Gamma
有界尾部 PX>x0,xτy<0Uniform

图6

自适应弹性扩缩容策略整体流程图"

图7

负载周期性较强的数据集"

图8

负载波动平缓的数据集"

图9

负载波动频繁且无明显周期的数据集"

图10

周期性负载情况下各策略Pod数变化"

图11

平缓负载情况下各策略Pod数变化"

图12

波动频繁且无明显周期负载情况各策略Pod数变化"

表2

周期性负载情况下不同扩缩容策略总体资源占用面积"

模型名称S
HPA42 930
BiLSTM-HPA37 200
EVT-BiLSTM-HPA31 860

表3

平缓负载情况下不同扩缩容策略总体资源占用面积"

模型名称S
HPA35 520
BiLSTM-HPA28 620
EVT-BiLSTM-HPA22 290

表4

波动频繁且无明显周期负载情况下不同扩缩容策略总体资源占用面积"

模型名称S
HPA37 260
BiLSTM-HPA28 500
EVT-BiLSTM-HPA25 860

图13

周期性负载情况下各算法Pod数量变化"

图14

平缓负载情况下各算法Pod数量变化"

图15

波动频繁且无明显周期负载情况Pod数量变化"

图16

不同策略下Pod数变化及对应负载变化"

表5

周期性负载情况不同扩缩容模型平均资源利用率和资源占用面积"

模型名称平均资源利用率/%S
HPA33.5442 930
ARIMA-HPA34.5041 730
LSTM-HPA35.6439 302
BiLSTM-HPA38.7037 200
EVT-BiLSTM-HPA45.1931 860
DEBI-HPA64.3322 380

表6

平缓负载情况不同扩缩容模型平均资源利用率和资源占用面积表"

模型名称平均资源利用率/%S
HPA30.8135 520
ARIMA-HPA33.0733 090
LSTM-HPA35.8730 510
BiLSTM-HPA38.2328 620
EVT-BiLSTM-HPA49.0922 290
DEBI-HPA52.4820 850

表7

波动频繁且无明显周期负载情况不同扩缩容模型平均资源利用率和资源占用面积表"

模型名称平均资源利用率/%S
HPA29.7837 260
ARIMA-HPA32.4234 230
LSTM-HPA33.2133 420
BiLSTM-HPA38.9428 500
EVT-BiLSTM-HPA42.9125 860
DEBI-HPA48.3823 790
[1] Community Kubernetes. kubernetes horizontal pod autoscaler[EB/OL]. [2024-05-06]. .
[2] Google Kubernetes Engine. Google kubernetes engine vertical pod autoscaler [EB/OL]. [2024-05-06]. .
[3] Google Kubernetes Engine. Google kubernetes engine multidimensional pod autoscaler[EB/OL]. [2024-05-06]. .
[4] AL-HAIDARI F, Sqalli M, Salah K. Impact of cpu utilization thresholds and scaling size on autoscaling cloud resources[C]∥IEEE 5th International Conference on Cloud Computing Technology and Science. IEEE, 2013, 2: 256-261.
[5] Iqbal W, Dailey M, Carrera D. SLA-driven adaptive resource management for web applications on a heterogeneous compute cloud[C]∥IEEE International Conference on Cloud Computing. Springer, Berlin, Heidelberg, 2009: 243-253.
[6] Lim H C, Babu S, Chase J S, et al. Automated control in cloud computing: challenges and opportunities[C]∥Proceedings of the 1st workshop on Automated control for datacenters and clouds, 2009: 13-18.
[7] Lim H C, Babu S, Chase J S. Automated control for elastic storage[C]∥Proceedings of the 7th international conference on Autonomic computing, New York: ACM, 2010: 1-10.
[8] Hasan M Z, Magana E, Clemm A, et al. Integrated and autonomic cloud resource scaling[C]∥IEEE network operations and management symposium. Piscataway: IEEE, , 2012: 1327-1334.
[9] Baresi L, Guinea S, Leva A, et al. A discrete-time feedback controller for containerized cloud applications[C]∥Proceedings of the 2016 24th ACM SIGSOFT International Symposium on Foundations of Software Engineering.New York, NY: ACM Press, 2016: 217-228.
[10] 倪海峰. 基于Kubernetes的云平台HPA算法的优化与实现[D]. 上海: 上海交通大学电子信息与电气工程学院, 2018.
Ni Hai-feng. Design and implementation of container autoscaling algorithm platform based on Kubernetes [D].Shanghai: School of Electronic Information and Electrical Engineering, Shanghai Jiao Tong University, 2018.
[11] 田野. 面向容器的云计算资源自动伸缩问题研究[D].上海: 上海交通大学电子信息与电气工程学院,2018.
Tian Ye. Study on auto scaling framework for container in cloud computing[D]. Shanghai: School of Electronic Information and Electrical Engineering,Shanghai Jiao Tong University, 2018.
[12] 张松霖. 基于Kubernetes的容器资源弹性伸缩策略研究[D].太原: 太原理工大学电气与动力工程学院,2020.
Zhang Song-ling. Research on flexible scaling strategy of container resources based on Kubernetes[D]. Taiyuan: College of Electrical and Power Engineering, Taiyuan University of Technology, 2020.
[13] 罗良杰. 基于负载预测的容器弹性伸缩技术研究[D].武汉: 武汉纺织大学计算机与人工智能学院,2021.
Luo Liang-jie. Research on container elastic scaling technology based on load prediction [D]. Wuhan: School of Computer Science and Artificial Intelligence, Wuhan Textile University, 2021.
[14] 张树波, 吴天阳, 潘茂林, 等. 基于强化学习的预测式容器自动伸缩算法A-SARSA[C]∥第17届IEEE国际万维网服务会议, 北京, 2020: 423-430.
[15] Imdoukh M, Ahmad I, Alfailakawi M G. Machine learning-based auto-scaling for containerized applications[J]. Neural Computing and Applications, 2020, 32(13): 9745-9760.
[16] Barrett E, Howley E, Duggan J. Applying reinforcement learning towards automating resource allocation and application scalability in the cloud[J]. Concurrency and Computation: Practice and Experience, 2013, 25(12): 1656-1674.
[17] Tesauro G, Jong N K, Das R, et al. A hybrid reinforcement learning approach to autonomic resource allocation[C]∥IEEE International Conference on Autonomic Computing. Piscataway: IEEE, 2006: 65-73.
[18] Rao J, Bu X P, Xu C Z, et al. Vconf: a reinforcement learning approach to virtual machines auto-configuration[C]∥Proceedings of the 6th international conference on Autonomic computing. New York: ACM, 2009: 137-146.
[19] 张磊. 深入剖析Kubernetes[M].北京:人民邮电出版社, 2021.
[20] Taherizadeh S, Grobelnik M. Key influencing factors of the Kubernetes auto-scaler for computing-intensive microservice-native cloud-based applications[J]. Advances in Engineering Software, 2020, 140: 102734.
[21] 徐虎博, 史东辉. 基于ARIMA和LSTM模型的建筑安全事故预测[J]. 软件工程, 2023, 26(3): 9-14.
Xu Hu-Bo, Shi Dong-hui. Prediction of construction safety accidents based on ARIMA and LSTM models[J]. Software Engineering, 2023, 26(3): 9-14.
[22] 吴忠强, 卢雪琴. 基于深度迁移学习和LSTM网络的微电网故障诊断[J].计量学报,2023,44(4): 582-590.
Wu Zhong-qiang, Lu Xue-qin. Microgrid fault diagnosis based on deep transfer learning and LSTM network[J]. Journal of Measurement, 2023, 44(4): 582-590.
[23] 李志兵, 肖健梅, 王锡淮. 基于多粒度NRS和改进Bi-LSTM的电力系统暂态稳定评估[J]. 电气工程学报, 2023, 18(3): 232-241.
Li Zhi-bing, Xiao Jian-mei, Wang Xi-huai. Transient stability assessment of power system based on multi-granularity neighborhood rough set and improved bi-directional long-short-term memory network [J]. Journal of Electrical Engineering, 2023, 18(3): 232-241.
[24] Hochreiter S, Schmidhuber J. LSTM can solve hard long time lag problems[J]. Advances in neural information processing systems, 1996,9(8), 1735-1780.
[25] Fréchet M. Sur la loi de probabilité de l'écart maximum[J]. Annales Societatis Mathematicae Polonae, 1927, 6(1): 93-116.
[26] 史道济. 实用极值统计方法[M]. 天津: 天津科学技术出版社,2006.
[27] 高宇. 大数据系统异常检测与资源预估算法研究[D].哈尔滨:哈尔滨工业大学计算机科学与技术学院, 2020.
Gao Yu. Research on methods of anomaly detection and resource estimation for big data systems [D]. Harbin: School of Computer Science and Technology, Harbin Institute of Technology, 2020.
[28] Coles S, Bawa J, Trenner L, et al. An Introduction to Statistical Modeling of Extreme Values[M]. Springer, 2001, 208.
[29] Guo J, Chang Z H, Wang S, et al. Who limits the resource efficiency of my datacenter: an analysis of alibaba datacenter traces[C]∥Proceedings of the International Symposium on Quality of Service, 2019: 1-10.
[30] Pickands III J. Statistical inference using extreme order statistics[J]. the Annals of Statistics, 1975, 1(1): 119-131.
[31] Grimshaw S D. Computing maximum likelihood estimates for the generalized Pareto distribution[J]. Technometrics, 1993, 35(2): 185-191.
[32] Cloud Alibaba. Alibaba cluster trace program-Microservices trace 2022[EB/OL].[2024-12-23].
[33] Jananee M, Nimala K. Allocation of cloud resources based on prediction and performing auto-scaling of workload[C]∥International Conference on Artificial Intelligence and Knowledge Discovery in Concurrent Engineering. Chennai, India: IEEE, 2023: 1-7.
[1] 丁海兰,祁坤钰. 基于TextRank算法和相似度的中文文本主题句自动提取[J]. 吉林大学学报(工学版), 2025, 55(3): 1001-1008.
[2] 刘照霞,付锐,牛世峰. 基于极值理论与智能网联信息的超车风险评估[J]. 吉林大学学报(工学版), 2025, 55(3): 925-937.
[3] 彭铎,刘明硕,谢堃. 观测站参数误差下联合多特征融合注意力机制的TDOA/FDOA多机无源定位算法[J]. 吉林大学学报(工学版), 2025, 55(11): 3751-3761.
[4] 任高明, 夏靖波, 乔向东, 杨仝. 基于LRU淘汰机制的自适应大流检测算法[J]. 吉林大学学报(工学版), 2014, 44(4): 1159-1164.
[5] 孙琦,赵晓晖,顾海军 . 特征向量自适应估计算法及在谱估计中的应用[J]. 吉林大学学报(工学版), 2006, 36(05): 766-0771.
[6] 徐昱琳, 薛立. 在线消除准-周期干扰的自适应算法[J]. 吉林大学学报(工学版), 2004, (3): 422-426.
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
No Suggested Reading articles found!