ABSTRACTIntroductionMicroservices architecture is one of the most popular design approaches in software development. The granularity smell of microservices is a topic of great interest, which often leads to a degradation in the quality of the microservices architecture, so it needs to be eliminated through architecture refactoring. Existing research on architecture refactoring to address granularity smells in microservices is limited, with a lack of consideration for the semantic information of business logic, and suggestions for microservice refactoring rely too much on manual experience and lack standardized descriptions.ObjectivesThis paper aims to provide a novel approach for refactoring granularity smells in microservice architectures, addressing the existing shortcomings in considering semantic information of microservice business logic, the reliance on empirical experience for refactoring suggestions, and the lack of standardized suggestions for refactoring.MethodsThis paper introduces a novel method for refactoring granularity smells in microservices architecture based on business topic clusters, named ASRMG. This method extracts business topic clusters from the business logic code of interfaces, thereby defining the cohesion and coupling semantics of the system. It then employs an enhanced genetic algorithm for refactoring the microservices system, using a refactoring pattern database to automate the generation of fine‐grained refactoring suggestions.ResultsExperiments conducted on five open‐source microservices systems of varying scales and domains achieved a 99.24% elimination rate of granularity smells, with cohesion metrics improving by an average of 60.19% and coupling metrics reducing by an average of 15.32%, indicating a significant enhancement in the quality of microservice architecture.ConclusionThis paper introduces a novel method for refactoring and evaluating microservice systems, named ASRMG. ASRMG extracts business topic clusters from the code of microservice systems and refines the evaluation method for refactored microservice, and proposes an automated method for generating refactoring suggestions for granularity smells, enhancing the efficiency and quality of architecture smell refactoring.
Read full abstract