Research on Microservice Identification Technology Based on API Correlation
摘要
Microservices are a new approach to software architecture design that enables complex monolithic applications to be constructed as a set of independent and loosely coupled chunks of services. A critical step in migrating monolithic architectures to microservices-based systems is the identification of the microservices contained in the target application. At this stage, most monolithic applications are highly cohesive and tightly coupled, which makes microservice decomposition difficult. Traditional microservice identification methods rely heavily on a priori knowledge or the intuitive experience of designers. Different identification methods require different data sources as a basis for extracting microservices, making it difficult to develop a uniform specification. This paper proposes a method to automatically identify microservices from a single system through the study of RESTful APIs, by introducing API topic semantic information similarity and response message information similarity as the criteria for microservice classification. The system consists of three parts: (1) Bert-whitening (Su et al., Whitening sentence representations for better semantics and faster retrieval, 2021) and Jaccard’s algorithm (Bennett et al., Proceedings of KDD cup and workshop, San Jose, CA, 2007) were used to calculate the overall similarity of the API, including the candidate topic similarity and the response message similarity. (2) constructing an API similarity graph with APIs as nodes and the overall similarity as the weight. (3) Spectral clustering algorithm is used to calculate scores and identify candidate microservices based on contour coefficients. A comparison with existing microservice classification methods proves the superiority of the method through experiments on six microservice open source projects and the results of the impact of hyperparameters on the quality of the experiments.