计算机科学 ›› 2026, Vol. 53 ›› Issue (11A): 251100111-1023.doi: 10.11896/jsjkx.251100111
钟林辉1, 李卓宇1, 郑燚1, 孙文彬1, 李方云1, 黄淇轩2, 陈尚阳1
ZHONG Linhui1, LI Zhuoyu1, ZHENG Yi1, SUN Wenbin1, LI Fangyun1, HUANG Qixuan2, CHEN Shangyang1
摘要: 微服务架构是一种典型的分布式架构风格,强调服务通过通信机制进行交互,将单体应用向微服务架构转换可以提升系统的可维护性与可扩展性。然而,现有的自动识别微服务方法存在基于类粒度划分导致的细粒度功能关联捕捉不足,以及相似性计算忽视多维度特征等问题。为此,提出面向方法粒度的微服务自动识别与优化方法,通过融合语义、术语和结构三维度信息,提升划分精度。在语义层面,利用CodeT5+模型生成语义向量,计算余弦相似度;在术语层面,提取方法名、参数等构建向量并计算相似性;在结构层面,分析调用关系与参数依赖,采用Jaccard系数衡量关联性。基于此构建相似度矩阵,使用层次聚类生成初步划分方案。进一步引入遗传算法进行多目标优化,最大化消息级内聚性和结构模块化质量,有效降低服务间耦合。同时设计类重组策略,将相关方法合并或垂直拆分,提升功能独立性。实验结果表明,该方法在准确率、内聚性和模块化质量方面优于传统方法,实现了高效、精准的自动化微服务划分。
中图分类号:
| [1] 刘江鹏.基于项目驱动的微服务架构实验教学设计[J].信息系统工程,2025(10):165-168. [2] HUSSEIN S,LAHAMI M,TORJMEN M.Assessing the quality of microservice and monolithic architectures:systematic literature review[J].Operational Research in Engineering Sciences:Theory and Applications,2024,7(2):417-446. [3] GYSEL M,KÖLBENER L,GIERSCHE W,et al.Service cutter:A systematic approach to service decomposition[C]//Ser-vice-Oriented and Cloud Computing:5th IFIP WG 2.14 European Conference(ESOCC 2016).Springer,2016:185-200. [4] SAIDANI I,OUNI A,MKAOUER M W,et al.Towards automated microservices extraction using muti-objective evolutionary search[C]//Service-Oriented Computing:17th International Conference(ICSOC 2019).Springer,2019:58-63. [5] SELLAMI K,OUNI A,SAIED M A,et al.Improving microservices extraction using evolutionary search[J].Information and Software Technology,2022,151:106996. [6] CARVALHO L,GARCIA A,COLANZIT E,et al.On the performance and adoption of search-based microservice identification with tomicroservices[C]//2020 IEEE International Confe-rence on Software Maintenance and Evolution(ICSME).IEEE,2020:569-580. [7] TRABELSI I,MOHA N,GUÉHÉNEUC Y G,et al.Magnet:Method-based approach using graph neural network for microservices identification[C]//2024 IEEE 21st International Conference on Software Architecture(ICSA).IEEE,2024:1-11. [8] LI Q,LI B,MERCATI P,et al.RAMBO:Resource allocation for microservices using Bayesian optimization[J].IEEE Computer Architecture Letters,2021,20(1):46-49. [9] PENDYALA K V N S,BUYYA R.An Infrastructure Cost Optimised Algorithm for Partitioning of Microservices[J].arXiv:2408.06570,2024. [10] KINOSHITA T,KANUKA H.Enhancing Automated Micro-service Decomposition via Multi-Objective Optimization[J].IEEE Access,2024,12:55697-55710. [11] GrammarT5:Grammar-integrated pretrained encoder-decoder neu-ral model for code[C]//IEEE/ACM 46th International Confe-rence on Software Engineering.2024:1-13. [12] BORGEAUD S,MENSCH A,HOFFMANN J,et al.Improving language models by retrieving from trillions of tokens[C]//International Conference on Machine Learning.PMLR,2022:2206-2240. [13] RAHIMI I,GANDOMI A H,CHENF,et al.A review on constraint handling techniques for population-based algorithms:from single-objective to multi-objective optimization[J].Archives of Computational Methods in Engineering,2023,30(3):2181-2209. [14] ABDULLAH J M,RASHID T A,MAAROOFB B,et al.Multi-objective fitness-dependent optimizer algorithm[J].Neural Computing and Applications,2023,35(16):11969-11987. [15] SHAPIRO J.Genetic algorithms in machine learning[M]//Advanced Course on Artificial Intelligence.Berlin:Springer,1999:146-168. [16] DEB K,AGRAWAL S,PRATAP A,et al.A fast elitist non-dominated sorting genetic algorithm for multi-objective optimization:NSGA-II[C]//Parallel Problem Solving from Nature PPSN VI:6th International Conference.Berlin:Springer,2000:849-858. |
|
||