Man-machine collaborative single system micro-service splitting method

Through the human-computer collaboration method, multi-objective optimization algorithm and user preference information are used to generate microservice splitting solutions that meet users' expectations, solving the problem that the microservice splitting results in the existing technology do not meet user requirements, and improving splitting accuracy and user satisfaction.

CN119225953APending Publication Date: 2024-12-31NORTHWESTERN POLYTECHNICAL UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411173422.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-26
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

The existing microservice splitting method cannot effectively consider the knowledge of developers and domain experts, resulting in the splitting results that do not meet the user's requirements, especially when faced with logically unrelated classes, automation tools will disperse or combine them. improper.

Method used

Using human-computer collaboration method, by obtaining the coupled information of software components, using a multi-objective optimization algorithm to generate an initial splitting scheme, extracting common features, obtaining user preference information, and updating coupling information until the preset conditions are met, generating a meeting user expectations. Microservice splitting solution.

Benefits of technology

It realizes the generation of high-quality microservice splitting solutions to meet the needs of users, reduces the coupling between microservices, and improves the accuracy and user satisfaction of splitting.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119225953A_ABST
    Figure CN119225953A_ABST
Patent Text Reader

Abstract

The invention discloses a man-machine collaborative single system micro-service splitting method, and relates to the field of software splitting methods, and the method comprises the steps: obtaining components of software and coupling information between the components; combining the components according to the coupling information among the components by utilizing a multi-objective optimization algorithm to obtain a plurality of initial splitting schemes; classifying the plurality of initial splitting schemes, and extracting public features of each type of initial splitting scheme; obtaining preference information of the user according to the public features; correspondingly updating the coupling information according to the preference information; and reusing the multi-objective optimization algorithm, combining the components according to the coupling information among the components until a preset condition is met, and obtaining a splitting scheme. According to the method, multiple splitting schemes are generated by adopting a multi-objective optimization algorithm, the preference information of the user is obtained by utilizing the public characteristics of the same type of splitting schemes, and the coupling information between the components is updated according to the preference information of the user, so that the high-quality micro-service splitting scheme which meets the expectation of the user is obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of software splitting methods, and in particular to a human-machine collaborative monolithic system microservice splitting method. Background Art

[0002] The basic idea of ​​microservice architecture is to split the traditional monolithic system according to business, data and other aspects, and divide it into a series of microservices with clear boundaries and independent design, development, deployment, and operation and maintenance. Each microservice has its own data storage, can be deployed and run independently, and cooperate with each other through lightweight communication protocols. In the current context of rapid development of the Internet and ever-changing software requirements, the microservice architecture has the advantages of high scalability and maintainability to cope with ever-changing software requirements.

[0003] However, compared with the monolithic architecture, the microservice architecture has many advantages when developing large programs, but it is not perfect and has many disadvantages. For example, the complexity of the microservice architecture software increases with the number of services, which also brings about data consistency problems between services, system distribution problems, and the complexity of deployment and testing between multiple services. At the same time, after splitting the monolithic system into microservices, the original modules are coupled, and their communication is still in-memory communication, which is extremely fast. When it becomes coupled communication between microservices, it becomes communication between networks, which brings communication delays to the system. How to design microservices well and reduce coupling between microservices has become a challenge. A good microservice partitioning scheme can weigh the pros and cons well, but how to choose a suitable microservice partitioning scheme is a difficulty in microservice development.

[0004] Due to the lack of a systematic methodology for microservice splitting and design, the current microservice reconstruction of monolithic systems in the industry is mainly completed by experienced software architects relying on their personal subjective experience. Some people have also proposed automated microservice splitting methods, but the existing automated microservice splitting methods do not take into account the knowledge of developers and domain experts when deciding to group certain software entities together (or not). For example, when faced with a group of classes that do not provide any services, existing automated refactoring tools will scatter them in different packages because there is no coupling relationship between these classes, while developers with practical experience will combine them in one package even if they are logically unrelated. Therefore, the splitting results obtained by the existing splitting methods do not meet the requirements of domain experts and developers. Summary of the invention

[0005] The main purpose of this application is to provide a human-machine collaborative monolithic system microservice splitting method, aiming to solve the problem that the existing splitting methods cannot meet the requirements of user domain experts and developers.

[0006] To achieve the above-mentioned objectives, the present application provides a human-machine collaborative monolithic system microservice splitting method, comprising: obtaining software components and coupling information between components; using a multi-objective optimization algorithm to combine the components according to the coupling information between the components to obtain multiple initial splitting schemes; classifying the multiple initial splitting schemes and extracting common features of each type of initial splitting scheme; obtaining user preference information based on the common features; updating the coupling information according to the preference information; reusing the multi-objective optimization algorithm to combine the components according to the updated coupling information between the components until the preset conditions are met to obtain the splitting scheme.

[0007] Optionally, based on the common characteristics, the user's preference information is obtained, including: determining the initial splitting scheme selected by the user, sorting all the initial splitting schemes in the category to which the initial splitting schemes belong according to the common characteristics of the initial splitting schemes, and obtaining the sorting result; obtaining the user's preference information for the initial splitting scheme ranked first, and updating the sorting result according to the preference information.

[0008] Optionally, obtaining the user's preference information for the first-ranked initial splitting solution includes: obtaining the user's score for the positional relationship between any component and other components in the first-ranked initial splitting solution.

[0009] Optionally, the method for extracting common features of each type of initial splitting scheme includes: converting all initial splitting schemes in each type of initial splitting scheme into corresponding matrices, and accumulating all matrices to obtain an accumulated matrix; the maximum cell value, the minimum cell value, and the corresponding row and column coordinates in the accumulated matrix except for the diagonal elements are common features.

[0010] Optionally, all initial splitting schemes in the category to which the initial splitting schemes belong are sorted according to the common features of the initial splitting schemes, including: comparing the maximum cell value, the minimum cell value and the corresponding row and column coordinates in each matrix with the common features, and sorting all initial splitting schemes in the category to which the initial splitting schemes belong according to the similarity with the common features.

[0011] Optionally, the objective functions in the multi-objective optimization algorithm are coupling degree and cohesion degree.

[0012] Optionally, the coupling information includes dynamic coupling information and static coupling information.

[0013] Optionally, classifying the multiple initial splitting schemes includes: using a K-means clustering algorithm to classify the multiple initial splitting schemes based on an optimization objective.

[0014] Optionally, the multi-objective optimization algorithm includes a multi-objective genetic algorithm, a multi-objective particle swarm optimization algorithm or a multi-objective whale algorithm.

[0015] The present invention also provides a human-machine collaborative single system microservice splitting device, including: a component acquisition module, used to obtain software components and coupling information between components; an initial splitting module, used to use a multi-objective optimization algorithm to combine components according to the coupling information between components to obtain multiple initial splitting schemes; a classification module, used to classify multiple initial splitting schemes and extract common features of each type of initial splitting scheme; a preference information acquisition module, used to obtain user preference information based on the common features; an update module, used to update the coupling information according to the preference information; a splitting module, used to reuse the multi-objective optimization algorithm, and combine the components according to the updated coupling information between the components until the preset conditions are met to obtain the splitting scheme.

[0016] Compared with the prior art, the present invention has the following beneficial effects: The human-machine collaborative monolithic system microservice splitting method of the present invention adopts a multi-objective optimization algorithm to generate multiple splitting schemes, uses the common features of the same type of splitting schemes to obtain the user's preference information, and updates the coupling information between components based on the user's preference information, thereby obtaining a high-quality microservice splitting scheme that meets the user's expectations. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 A flowchart of a method for splitting a single system into microservices for human-machine collaboration is provided for this application; Figure 2 This is a K-means clustering result diagram of the non-dominated solution in the human-machine collaborative monolithic system microservice splitting method of this application; Figure 3 This is a schematic diagram of matrix conversion in a human-machine collaborative monolithic system microservice decomposition method of this application; Figure 4 The structure diagram of a human-machine collaborative monolithic system microservice splitting device of the present application is shown in FIG. The realization of the purpose, functional features and advantages of the present application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0018] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in this application. Obviously, the described embodiments are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0019] The present invention provides a method for splitting microservices of a human-machine collaborative monomer system, such as Figure 1 As shown, the specific steps include: Step S1, obtaining software components and coupling information between components; Among them, coupling information includes dynamic coupling information and static coupling information. Specifically, from the perspective of granularity, the software entities in the monolithic system include methods, classes, and modules. Software entities of different granularities have different coupling information, such as calls between methods, implementation of interfaces to classes, inheritance between classes, and associations between classes; from the perspective of information sources, the source code, execution log files, and executable programs of the monolithic system all contain coupling information. For different information sources, the present invention uses a combination of dynamic and static technologies to collect coupling information of the monolithic system.

[0020] Step S2, using a multi-objective optimization algorithm, combining the components according to the coupling information between the components to obtain multiple initial splitting schemes; Furthermore, the objective function in the multi-objective optimization algorithm is a microservice software quality metric, for example, coupling and cohesion. Following the object-oriented design principle of software engineering, the software system should meet the functional indicator requirements of high cohesion and low coupling. Coupling and cohesion can be calculated based on coupling information. It is worth noting that the method of calculating coupling and cohesion for dynamic coupling information and static coupling information is the same.

[0021] Step S3, classifying multiple initial splitting schemes and extracting common features of each type of initial splitting schemes; specifically, the following steps may be included: Step S31, a K-means clustering algorithm may be used to classify multiple initial splitting schemes based on the optimization objective; Step S32, converting all initial splitting schemes in each type of initial splitting scheme into corresponding matrices, and accumulating all matrices to obtain an accumulated matrix; the maximum unit value, the minimum unit value, and the corresponding row and column coordinates in the accumulated matrix except the diagonal elements are common features.

[0022] Step S4, obtaining user preference information based on the common features; Since the initial splitting schemes belonging to the same class have similar splitting features (common features), users can independently choose the categories of interest to interact. The functions of extracting common features include: clustering is based on the fitness function, but the fitness function is relatively abstract to users. Mining out the common features of the initial splitting schemes belonging to the same category reflected in the specific splitting methods is conducive to users' understanding of different splitting schemes, so as to make more accurate feedback; the user's choice of cluster represents the exploration area of ​​interest to the user. Extracting the common features of the cluster and using them as constraints for population evolution can make the algorithm converge to a solution that satisfies the user more quickly; the solutions in the same cluster are sorted based on the common features to determine the priority order of their interaction with the user.

[0023] Step S4 may specifically include the following steps: Step S41, determining the initial splitting scheme selected by the user, and sorting all the initial splitting schemes in the category to which the initial splitting schemes belong according to the common features of the initial splitting schemes to obtain a sorting result; the specific method may be: The maximum unit value, the minimum unit value and the corresponding row and column coordinates in each matrix are compared with the common features, and all the initial splitting schemes in the category to which the initial splitting scheme belongs are sorted according to the similarity with the common features. It is worth noting that after sorting, there may be multiple initial splitting schemes whose maximum unit value, minimum unit value and corresponding row and column coordinates are the same as the common features, so the first-ranked initial splitting scheme may include multiple initial splitting schemes, and any one of the initial splitting schemes can be selected to perform step S42.

[0024] Step S42, obtaining the user's preference information for the first-ranked initial splitting solution, and updating the ranking result according to the preference information; Specifically, the user's score on the positional relationship between any component in the first-ranked initial splitting solution and other components is obtained, and the ranking result is updated according to the score.

[0025] In the present invention, the positional relationship between any component and other components is the splitting feature of the splitting scheme. The score of the splitting feature is used to determine the user's preference information. Compared with determining the user's preference information based on the overall score of the splitting scheme, the user's preference can be determined more accurately, thereby ensuring the accuracy of the splitting.

[0026] Furthermore, step S42 may be looped for multiple times to obtain more accurate preference information, and different components may be selected in each loop.

[0027] Step S5, updating the coupling information according to the preference information; Step S6, return to step S2, until the preset conditions are met and a splitting plan is obtained.

[0028] The preset conditions are determined based on user satisfaction. As long as a splitting solution that satisfies the user is obtained, the loop can be stopped to obtain the final splitting solution.

[0029] The multi-objective optimization algorithm mentioned in the present invention can be a multi-objective genetic algorithm, a multi-objective particle swarm optimization algorithm or a multi-objective whale algorithm, etc., and the genetic algorithm NSGA-II is taken as an example for specific description below.

[0030] Example 1 Step S10, obtaining software components and coupling information between components; Step S20, using the genetic algorithm NSGA-II, according to the coupling information between the components, the components are combined to obtain a non-dominated solution set, and the non-dominated solution set includes multiple initial splitting schemes; wherein the software components are represented as genes, and the individual gene combination represents a possible splitting method; The specific steps include: Step S201, randomly generating a set of initial software splitting schemes as an initial population; Step S202, for each splitting scheme (individual), calculate its fitness value according to cohesion and coupling; Step S203, selection: selecting a better individual as a parent generation according to the fitness value to generate a child generation; Step S204, crossover: performing a crossover operation on the selected parent individuals to generate a new splitting scheme; Step S205, mutation: mutating individuals with a certain probability to introduce new split possibilities; Step S206, returning to step S202 to iterate, continuously optimizing the splitting scheme in the population, and in the iterative process, recording the local optimal solutions that appear to obtain a non-dominated solution set; Step S30, using the K-means clustering algorithm, classify the solutions in the non-dominated solution set based on the optimization objective. The classification results are as follows: Figure 2 As shown in the figure, each broken line represents a non-dominated solution, the horizontal axis is the four fitness functions, the vertical axis is the corresponding score, and the color indicates the cluster to which the solution belongs; all solutions in each category are converted into corresponding matrices, see Figure 3 , and accumulate all matrices to obtain an accumulated matrix, and take the maximum unit value, minimum unit value, and corresponding row and column coordinates of the accumulated matrix except the diagonal elements as common features; Step S40, compare the maximum unit value, the minimum unit value and the corresponding row and column coordinates in each matrix with the common features, and take the solution with the same common features as the first-ranked solution; obtain the user's score for the positional relationship between any component in the first-ranked solution and other components, and update the ranking result according to the score; obtain the user's score for the positional relationship between another component in the first-ranked solution and other components, and update the ranking result according to the score; obtain the user's score for the positional relationship between a component (different from the previous two components) and other components in the first-ranked solution, and update the ranking result according to the score; In this embodiment, for each split feature, the user needs to answer from seven different preference levels, and the seven preference levels correspond to seven scores from -3 to 3, and the obtained score is -3 to 3.

[0031] Step S5, updating the coupling information according to the preference information; Step S6, return to step S2, until a splitting solution that satisfies the user is obtained, which is the final splitting solution.

[0032] The present invention also provides a human-machine collaborative monolithic system microservice splitting device, such as Figure 4 As shown, it includes a component acquisition module 10, an initial splitting module 20, a classification module 30, a preference information acquisition module 40, an update module 50 and a splitting module 60; the component acquisition module 10 is used to obtain the components of the software and the coupling information between the components; the initial splitting module 20 is used to use a multi-objective optimization algorithm to combine the components according to the coupling information between the components to obtain multiple initial splitting schemes; the classification module 30 is used to classify the multiple initial splitting schemes and extract the common features of each type of initial splitting scheme; the preference information acquisition module 40 is used to obtain the user's preference information according to the common features; the update module 50 is used to update the coupling information according to the preference information; the splitting module 60 is used to reuse the multi-objective optimization algorithm to combine the components according to the coupling information between the components until the preset conditions are met to obtain the splitting scheme.

[0033] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A method for splitting a monolithic system into microservices for human-machine collaboration, characterized in that: include: Obtaining software components and coupling information between the components; Using a multi-objective optimization algorithm, the components are combined according to coupling information between the components to obtain multiple initial splitting schemes; Classifying multiple initial splitting schemes and extracting common features of each type of the initial splitting schemes; According to the common features, obtaining user preference information; updating coupling information according to the preference information; The multi-objective optimization algorithm is reused, and the components are combined according to the updated coupling information between the components until the preset conditions are met to obtain a splitting plan.

2. According to the method for splitting microservices of a human-machine collaborative monomer system according to claim 1, it is characterized in that: The obtaining the user's preference information according to the common features includes: Determine the initial splitting scheme selected by the user, and sort all the initial splitting schemes in the category to which the initial splitting scheme belongs according to the common features of the initial splitting schemes to obtain a sorting result; Obtain the user's preference information for the first-ranked initial splitting solution, and update the ranking result according to the preference information.

3. According to the method for splitting microservices of a human-machine collaborative monomer system according to claim 1, it is characterized in that: The obtaining of the user's preference information for the first-ranked initial splitting solution includes: Get the user's rating of the position relationship between any component in the first-ranked initial splitting solution and other components.

4. According to the method for splitting microservices of a human-machine collaborative monomer system according to claim 2, it is characterized in that: The method for extracting common features of each type of initial splitting scheme comprises: Convert all initial splitting schemes in each type of initial splitting scheme into corresponding matrices, and accumulate all matrices to obtain an accumulated matrix; The maximum unit value, the minimum unit value, and the corresponding row and column coordinates in the accumulation matrix except the diagonal elements are common features.

5. According to the method for splitting microservices of a human-machine collaborative monomer system according to claim 4, it is characterized in that: The sorting of all initial splitting schemes in the category to which the initial splitting schemes belong according to the common features of the initial splitting schemes comprises: The maximum unit value, the minimum unit value and the corresponding row and column coordinates in each matrix are compared with the common features, and all initial splitting schemes in the category to which the initial splitting scheme belongs are sorted according to the similarity with the common features.

6. The method for splitting microservices of a human-machine collaborative monomer system according to claim 1, characterized in that: The objective functions in the multi-objective optimization algorithm are coupling degree and cohesion degree.

7. The method for splitting microservices of a human-machine collaborative monomer system according to claim 1, characterized in that: The coupling information includes dynamic coupling information and static coupling information.

8. The method for splitting microservices of a human-machine collaborative monomer system according to claim 1, characterized in that: The classifying of the multiple initial splitting schemes comprises: The K-means clustering algorithm is used to classify multiple initial splitting schemes based on the optimization objective.

9. The method for splitting microservices of a human-machine collaborative monomer system according to claim 1, characterized in that: The multi-objective optimization algorithm includes a multi-objective genetic algorithm, a multi-objective particle swarm optimization algorithm or a multi-objective whale algorithm.

10. A human-machine collaborative monolithic system microservice splitting device, characterized in that: include: Component acquisition module, used to obtain software components and coupling information between components; An initial splitting module is used to combine the components according to coupling information between the components using a multi-objective optimization algorithm to obtain multiple initial splitting schemes; A classification module, used to classify multiple initial splitting schemes and extract common features of each type of initial splitting scheme; A preference information acquisition module, used to acquire the user's preference information according to the common features; An updating module, used for updating coupling information according to the preference information; The splitting module is used to reuse the multi-objective optimization algorithm to combine the components according to the coupling information between the components until the preset conditions are met to obtain a splitting plan.