A micro-service partitioning method, device, electronic equipment and readable medium

By acquiring the functional logs of the microservice model, extracting classification identifiers, and calculating phrase similarity, the problem of accuracy in business processing by functional modules in the microservice architecture was solved, and stable operation in complex scenarios was achieved.

CN116150359BActive Publication Date: 2026-06-12CHINA TELECOM CORP LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA TELECOM CORP LTD
Filing Date
2022-12-19
Publication Date
2026-06-12

Smart Images

  • Figure CN116150359B_ABST
    Figure CN116150359B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a micro-service division method and device, electronic equipment and readable medium, by obtaining the function log of the micro-service model, based on the micro-service model, the classification identifier of the function corresponding to the vertical function subclass is extracted from the function log, the domain keyword of the vertical function subclass is obtained based on the function log, the domain identifier of the vertical function subclass is determined from the function log based on the classification identifier, a plurality of domain phrases are extracted from the domain identifier, a phrase pair is selected from the plurality of domain phrases, the similarity between the phrase pair is calculated, the domain phrases in the phrase pair are distinguished based on the similarity, the domain phrase corresponding to the domain identifier and containing the domain keyword is determined as the domain bounded context of the vertical function subclass, the business domain corresponding to the micro-service in the micro-service model is determined through the domain bounded context, thereby determining the domain to which the function module of the micro-service of the micro-service model belongs, and determining each sub-domain bounded context in the domain.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, and in particular to a microservice partitioning method, a microservice partitioning apparatus, an electronic device, and a computer-readable medium. Background Technology

[0002] With the rapid development of computer technology, information networks have become a crucial guarantee for social development. The continuous improvement of the network society has led to the increasing prevalence of network applications. The large-scale application of artificial intelligence technology, within microservice architectures, utilizes DDD (Domain-Driven Design) + SOA (Service-Oriented Architecture) microservices with event-driven CQRS (Command Query Responsibility Segregation) read-write separation to handle complex business logic. It replaces the data table model with an aggregation model and replaces sequential message-driven models with concurrent event-driven models, truly achieving flexible expansion centered on business entities. The revolutionary aspect of DDD lies in the fact that domain keywords contain business characteristics. Traditional transactional programming models only care about data; these data objects, besides simple setter / getter methods, lack any business methods. The biggest advantage of DDD is that the first step in encountering requirements is to consider the domain model, rather than breaking it down into data and behavior, then implementing the data with a database and the behavior with services, ultimately resulting in a separation of the requirements. DDD makes you consider the business language first, not the data. This difference in focus leads to a different programming worldview. When a model acquires business information, accurately determining the corresponding functional modules within the microservice architecture to process that business information is a problem that those skilled in the art urgently need to solve. Summary of the Invention

[0003] This invention provides a microservice partitioning method, apparatus, electronic device, and computer-readable storage medium to solve the problem of how to accurately determine the corresponding functional modules in the microservice architecture to process the business when the model obtains the business.

[0004] This invention discloses a method for microservice partitioning, wherein a preset microservice model is divided into multiple horizontal layers, and each horizontal layer contains multiple vertical functional subclasses; the method includes:

[0005] Obtain the function logs of the microservice model, and based on the microservice model, extract the category identifiers of the functions corresponding to the vertical function subclasses from the function logs;

[0006] Based on the functional logs, the domain keywords of the vertical functional subclasses are obtained;

[0007] Based on the classification identifier, the domain identifier of the vertical functional subclass is determined from the functional log;

[0008] Extract multiple domain phrases from the domain identifier, and select phrase pairs from the multiple domain phrases;

[0009] Calculate the similarity between the phrase pairs to distinguish domain phrases in the phrase pairs based on the similarity.

[0010] The domain phrase containing the domain keyword corresponding to the domain identifier is determined as the domain bounding context of the vertical functional subclass, and the business domain corresponding to the microservice in the microservice model is determined through the domain bounding context.

[0011] Optionally, the step of obtaining the function logs of the microservice model and extracting the classification identifiers of the vertical function subclasses from the function logs based on the microservice model includes:

[0012] For a vertical functional subclass in a horizontal layer, based on the microservice model, keywords corresponding to the functions of the vertical functional subclass are extracted from the functional logs;

[0013] The classification identifier of the vertical functional subclass is determined based on the keywords, and the classification identifier contains the first association relationship between the vertical functional subclass and other vertical functional subclasses.

[0014] Optionally, the step of obtaining the domain keywords of the vertical functional subclass based on the functional log includes:

[0015] Statistical analysis was performed on the keywords.

[0016] Based on the frequency of occurrence of the keywords, the domain keywords of the vertical functional subclass are determined.

[0017] Optionally, the step of determining the domain identifier of the vertical functional subclass from the functional log based on the classification identifier includes:

[0018] Based on the first association relationship and the functional log, obtain the second association relationship between the vertical functional subclass and other vertical functional subclasses;

[0019] The domain identifier of the vertical functional subclass is generated using the second association relationship.

[0020] Optionally, the step of extracting multiple domain phrases from the domain identifier and selecting phrase pairs from the multiple domain phrases includes:

[0021] Multiple domain phrases are extracted based on the domain identifier, and the domain phrases are saved to a preset domain phrase set;

[0022] The domain phrases in the domain phrase set are statistically analyzed, and the target domain phrase is determined by the frequency of their occurrence.

[0023] Synonyms of the target domain phrases are selected from the domain phrase set to form phrase pairs; optionally, the step of calculating the similarity between the phrase pairs includes:

[0024] Convert the phrase pairs into word vectors;

[0025] The similarity between the word vectors is calculated using a preset formula.

[0026] Optionally, the function log is the data transmission log generated by the microservice during the operation of the microservice model.

[0027] This invention also discloses a microservice partitioning apparatus, characterized in that a preset microservice model is divided into multiple horizontal layers, each of which contains multiple vertical functional subclasses; the apparatus includes:

[0028] The acquisition module is used to acquire the functional logs of the microservice model, and based on the microservice model, extract the classification identifiers of the functions corresponding to the vertical functional subclasses from the functional logs;

[0029] The domain keyword module is used to obtain the domain keywords of the vertical functional subclass based on the functional logs;

[0030] The domain identification module is used to determine the domain identifier of the vertical functional subclass from the functional log based on the classification identifier;

[0031] A selection module is used to extract multiple domain phrases from the domain identifier and select phrase pairs from the multiple domain phrases;

[0032] A calculation module is used to calculate the similarity between the phrase pairs in order to distinguish domain phrases in the phrase pairs based on the similarity.

[0033] The determination module is used to determine the domain phrase containing the domain keyword corresponding to the domain identifier as the domain bounding context of the vertical functional subclass, and to determine the business domain corresponding to the microservice in the microservice model through the domain bounding context.

[0034] This invention also discloses an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;

[0035] The memory is used to store computer programs;

[0036] When the processor executes a program stored in the memory, it implements the method described in the embodiments of the present invention.

[0037] This invention also discloses one or more computer-readable media storing instructions that, when executed by one or more processors, cause the processors to perform the methods described in this invention.

[0038] The embodiments of the present invention have the following advantages: In the embodiments of the present invention, by obtaining the functional logs of the microservice model, based on the microservice model, the classification identifiers of the vertical functional subclasses are extracted from the functional logs, the domain keywords of the vertical functional subclasses are obtained based on the functional logs, the domain identifiers of the vertical functional subclasses are determined from the functional logs based on the classification identifiers, multiple domain phrases are extracted from the domain identifiers, phrase pairs are selected from the multiple domain phrases, the similarity between the phrase pairs is calculated, and the domain phrases in the phrase pairs are distinguished based on the similarity. The domain phrases containing the domain keywords corresponding to the domain identifiers are determined as the domain bounded contexts of the vertical functional subclasses. The business domains corresponding to the microservices in the microservice model are determined through the domain bounded contexts, thereby determining the domain to which each functional module of each microservice in the microservice architecture belongs and determining the bounded contexts of each subdomain in that domain. Thus, when a business is obtained, the corresponding functional module in the microservice architecture can be accurately determined to process the business, so that the microservice architecture can still operate stably in complex multi-level scenarios. Attached Figure Description

[0039] Figure 1 This is a flowchart illustrating the steps of a microservice partitioning method provided in an embodiment of the present invention;

[0040] Figure 2 This is a schematic diagram of a microservice model architecture provided in an embodiment of the present invention;

[0041] Figure 3 This is a flowchart of another microservice partitioning method provided in this embodiment of the invention;

[0042] Figure 4 This is a structural block diagram of a microservice partitioning device provided in an embodiment of the present invention;

[0043] Figure 5This is a block diagram of an electronic device provided in an embodiment of the present invention;

[0044] Figure 6 This is a schematic diagram of a computer-readable medium provided in an embodiment of the present invention. Detailed Implementation

[0045] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0046] Reference Figure 1 The diagram illustrates a flowchart of a microservice partitioning method provided in an embodiment of the present invention. The preset microservice model is divided into multiple horizontal layers, and each horizontal layer contains multiple vertical functional subclasses. Specifically, it may include the following steps:

[0047] Step 101: Obtain the function log of the microservice model, and extract the classification identifier of the function corresponding to the vertical function subclass from the function log based on the microservice model;

[0048] In one example, such as Figure 2As shown, this is a pre-defined microservice model. The microservice model architecture includes multiple horizontal layers: data acquisition layer 201, data operation and maintenance platform 202, algorithm layer 203, component layer 204, and SRE (Site Reliability Engineering) / Devops (Development and Operations) layer 205. Each horizontal layer contains multiple vertical functional subclasses. The vertical functional subclasses in the data acquisition layer 201 include: Environmental Monitoring 2011, Network Monitoring 2012, Host Monitoring 2013, System Monitoring 2014, Security Monitoring 2015, Cloud Resources 2016, and Application Monitoring 2017. The vertical functional subclasses in the data operation and maintenance platform 202 include: Data Cleaning 2021, Data Filtering 2022, Data Standardization 2023, Indicator Calculation 2024, Anomaly Marking 2025, Data Warehouse (CMDB) 2026, Configuration Item Management 2027, Relationship Management 2028, Business Model Topology 2029, and Dictionary and Rule Management 20210. The vertical functional subclasses in the algorithm layer 203 include: Multi-Objective Optimization 2031, NLP (Natural Language Processing)... Processing (Natural Language Processing) Log Algorithm 2032, Neural Network 2033, Hybrid Graph Model 2034, Metric 2035, Trace 2036; Vertical functional subclasses in component layer 204 include: Intelligent Analysis 2041, Service Management 2042, Automated Operation 2043, Knowledge Base 2044, 3D Visualization Engine 2045. Intelligent Analysis 2041 also includes sub-components: Association Analysis 20411, Routing Analysis 20412, Log Analysis 20413, Resource Analysis 20414; Service Management 2042 also includes sub-components: Service Catalog 20421, Work Order Management 2042. 2. Personnel Management 20423, Workplace Management 20424; Automated Operation 2043 also includes sub-components: Automatic Inspection 20431, Batch Operation 20432, Emergency Handling 20433, Customization 20434; Knowledge Base 2044 also includes sub-components: Fault Handling Knowledge Base 20441, Engineer Experience Base 20442; 3D Visualization Engine 2045 also includes sub-components: Graphics Rendering 20451, Application Interface 20452; The vertical functional subclasses in the SRE / Devops layer 205 include: Atomic Capabilities 2051, Capacity Management 2052, Code Management 2053, Automatic Deployment 2054, API (Application Program Interface) / SDK (Software Development Kit) 2055. Those skilled in the art will understand that the above horizontal layers and vertical functional subclasses are merely examples, and this invention does not limit them.

[0049] During the operation of the microservice model, each vertical functional subclass processes its corresponding business according to its function, thereby generating functional logs. These functional logs can be pre-generated by the microservice model. After obtaining the functional logs of the microservice model, the category identifiers corresponding to the vertical functional subclasses in each horizontal layer of the microservice model can be extracted from the functional logs. The category identifiers can be represented in the format "parent class#child class#associated subclass 1, associated subclass 2", where the parent class represents the horizontal layer where the vertical functional subclass is located, the child class represents the category of the vertical functional subclass itself, and associated subclass 1 and associated subclass 2 represent other vertical functional subclasses associated with the vertical functional subclass.

[0050] Step 102: Obtain the domain keywords of the vertical functional subclass based on the functional log;

[0051] After obtaining the functional logs, the business logic that each vertical functional subclass within the horizontal layer can implement is determined by combining the horizontal layer and each vertical functional subclass within it. Domain keywords for each vertical functional subclass are extracted from the functional logs. These domain keywords represent the core functionality of the corresponding vertical functional subclass. In one example, to determine the domain keywords for the environmental monitoring sub-module in the data acquisition layer, the domain keywords for the environmental monitoring sub-module can be represented in the form of "environmental monitoring + environment + monitoring".

[0052] Step 103: Based on the classification identifier, determine the domain identifier of the vertical functional subclass from the functional log;

[0053] After obtaining the classification identifiers, to more accurately distinguish the functions of vertical functional subclasses from other vertical functional subclasses, the relationships between vertical functional subclasses are determined from the functional logs based on the classification identifiers. This allows for the aggregation and generation of domain identifiers for vertical functional subclasses that can jointly complete a certain function or whose functions belong to the same domain. For example, other domain identifiers such as general subdomains and support subdomains can be generated.

[0054] Step 104: Extract multiple domain phrases from the domain identifier, and select phrase pairs from the multiple domain phrases;

[0055] After obtaining the domain identifier of the vertical functional subclass, the data information related to the business of the vertical functional subclass in the domain identifier can be determined. Based on the data information, multiple domain phrases are extracted from the domain identifier. For a domain phrase, the synonyms of the domain phrase are determined, thereby forming a phrase pair.

[0056] Step 105: Calculate the similarity between the phrase pairs to distinguish domain phrases in the phrase pairs based on the similarity.

[0057] After selecting phrase pairs, the similarity between phrase pairs can be calculated using a formula, thereby enabling more accurate differentiation of domain phrases within the phrase pairs based on the similarity score.

[0058] Step 106: Determine the domain phrase containing the domain keyword corresponding to the domain identifier as the domain bounding context of the vertical functional subclass, and determine the business domain corresponding to the microservice in the microservice model through the domain bounding context.

[0059] By more precisely distinguishing phrase pairs, for a given vertical functional subclass, the domain phrases containing domain keywords in its domain identifier can be identified as the domain bounded contexts of that vertical functional subclass. By calculating the similarity between phrase pairs, we analyze whether there is similarity between the domain bounded contexts corresponding to each vertical functional subclass, thus ensuring that the following text of vertical functional subclass A is not the preceding text of vertical functional subclass B. In other words, we ensure that the domain bounded context cannot be both the preceding text of vertical functional subclass A and the following text of vertical functional subclass B. The domain bounded context determines the business domain corresponding to the microservice in the microservice model. Domain bounded context prediction helps to classify the domains corresponding to microservice functions in the microservice model and find their respective bounded contexts. Each microservice in each domain aims to solve a specific problem; the microservice and its related microservice modules should be placed in the bounded context corresponding to that problem subdomain.

[0060] In one example, if the "Activity is online" message is triggered by operations personnel when configuring a microservice, allowing users to participate in the activity, then the domain keyword "activity" can be extracted for this activity. Based on the microservice model architecture, the concept of "activity" can be divided into two models: "Activity Configuration Context" corresponding to the activity configuration subdomain and "Activity Context" corresponding to the activity subdomain. Then, the corresponding microservice is determined based on the "Activity Configuration Context" and "Activity Context" to perform the appropriate business logic.

[0061] In this embodiment of the invention, by acquiring the functional logs of the microservice model, and based on the microservice model, the classification identifiers corresponding to the vertical functional subclasses are extracted from the functional logs. Domain keywords for the vertical functional subclasses are obtained from the functional logs. Based on the classification identifiers, the domain identifiers for the vertical functional subclasses are determined from the functional logs. Multiple domain phrases are extracted from the domain identifiers. Phrase pairs are selected from the multiple domain phrases, and the similarity between the phrase pairs is calculated. Domain phrases within phrase pairs are distinguished based on similarity. The domain phrase containing the domain keywords corresponding to the domain identifier is determined as the domain bounded context of the vertical functional subclass. The business domain corresponding to the microservice in the microservice model is determined through the domain bounded context. This allows for the determination of the domain to which each functional module of each microservice in the microservice architecture belongs, and the determination of the bounded contexts of each subdomain within that domain. Therefore, when a business is acquired, the corresponding functional module in the microservice architecture can be accurately determined to process the business, ensuring that each layer of the microservice architecture can still operate stably in complex multi-level scenarios.

[0062] Reference Figure 3 This diagram illustrates a flowchart of another microservice partitioning method provided in an embodiment of the present invention. The preset microservice model is divided into multiple horizontal layers, and each horizontal layer contains multiple vertical functional subclasses; specifically, it may include the following steps:

[0063] Step 301: For the vertical functional subclass in the horizontal layer, based on the microservice model, extract the keywords of the corresponding functions of the vertical functional subclass from the functional logs;

[0064] During the operation of a microservice model, each vertical functional subclass handles its respective business logic, generating functional logs. These logs can be pre-generated by the microservice model. After obtaining the functional logs, the horizontal layers of the microservice model and the corresponding functions of the vertical functional subclasses within each horizontal layer can be identified. In one example, the horizontal layers may also include the environment layer, management layer, cloud platform, information resource layer, business layer, interface layer, and UI (User Interface) presentation layer. Each vertical functional subclass has its corresponding core functionality. Based on the core functionality of each subclass, keywords corresponding to the core functionality are extracted from the functional logs.

[0065] Step 302: Determine the classification identifier of the vertical functional subclass based on the keywords. The classification identifier contains the first association relationship between the vertical functional subclass and other vertical functional subclasses.

[0066] Based on keywords extracted from functional logs, the functions corresponding to vertical functional subclasses can be identified. In a microservice model, the functions corresponding to vertical functional subclasses are interconnected. Therefore, category identifiers can be set for vertical functional subclasses, which can then be used to determine the horizontal layer to which the vertical functional subclass belongs, the functional category corresponding to the vertical functional subclass, and other vertical functional subclasses associated with it. In one example, the category identifier can be represented by the format "parent class#child class#associated subclass 1, associated subclass 2", where the parent class represents the horizontal layer to which the vertical functional subclass belongs, the child class represents the category of the vertical functional subclass itself, and associated subclass 1 and associated subclass 2 represent other vertical functional subclasses associated with the vertical functional subclass. The association relationships between vertical functional subclasses in the category identifiers can be identified as the first association relationship.

[0067] In an optional embodiment, classification identifiers can be determined using Pareto analysis, also known as ABC (Activity Based Classification), or more formally, ABC inventory control. Pareto analysis is a statistical method for decision-making, used to select a limited number of tasks from a multitude to achieve significant overall results. Pareto analysis utilizes the Pareto principle, which states that doing 20% ​​of the work can produce 80% of the overall effect. This can be expressed using the formula minf(x) = (f1(x), ..., f2(x)). p (x)) T Wherein, for the feasible region S of the variables, the corresponding target feasible region Z = f(S). In this embodiment of the invention, x is a keyword, and for a keyword x*∈S, for any x∈S, we have Then x* is called the absolute optimal solution if there is no x∈S such that If x* is an optimal solution to the multi-objective programming problem, then x* is called an efficient solution to the problem. An efficient solution to a multi-objective programming problem is also called a Pareto optimal solution, and there can be multiple optimal solutions. The determined optimal solution is used as a classification identifier.

[0068] Step 303: Perform statistical analysis on the keywords;

[0069] After obtaining the keywords corresponding to the vertical functional subclasses, you can also count the number of times the keywords appear.

[0070] Step 304: Determine the domain keywords of the vertical functional subclass based on the frequency of occurrence of the keywords;

[0071] The keyword that appears most frequently among the keywords corresponding to the vertical functional subclasses is determined as the domain keyword of the vertical functional subclass.

[0072] Step 305: Based on the first association relationship and the function log, obtain the second association relationship between the vertical function subclass and other vertical function subclasses;

[0073] To more accurately determine the relationships between vertical functional subclasses, after obtaining the first relationship in the classification identifier of the vertical functional subclasses, the relationships can be further analyzed by combining the functional logs, thereby obtaining the second relationship between the vertical functional subclasses and other vertical functional subclasses.

[0074] Step 306: Generate the domain identifier of the vertical functional subclass using the second association relationship;

[0075] After obtaining the second association relationship between vertical functional subclasses and other vertical functional subclasses, the connections between the functions corresponding to the vertical functional subclasses can be determined through the second association relationship. This allows for the aggregation and generation of domain identifiers for vertical functional subclasses that can jointly complete a certain function or whose functions belong to the same domain. For example, other domain identifiers such as general subdomains and supporting subdomains can be generated.

[0076] Step 307: Extract multiple domain phrases based on the domain identifier, and save the domain phrases to a preset domain phrase set;

[0077] After obtaining the domain identifier of the vertical functional subclass, the data information related to the business of the vertical functional subclass can be determined from the domain identifier. Multiple domain phrases can then be extracted from the domain identifier based on this data information. Once the domain phrases are obtained, they can be saved to a preset domain phrase set.

[0078] Step 308: Statistically analyze the domain phrases in the domain phrase set, and determine the target domain phrase by the frequency of occurrence of the domain phrases;

[0079] The frequency of occurrence of domain phrases in the domain phrase set is counted, and the domain phrase with the highest frequency is identified as the target domain phrase.

[0080] Step 309: Select synonyms of the target domain phrases from the domain phrase set to form phrase pairs;

[0081] After identifying the target domain phrases, synonyms of the target domain phrases can be determined from the set of domain phrases, thereby forming phrase pairs based on the synonyms of the target domain phrases.

[0082] Step 310: Calculate the similarity between the phrase pairs to distinguish domain phrases in the phrase pairs based on the similarity.

[0083] After forming phrase pairs, the similarity between phrase pairs can be calculated, and the domain phrases in the phrase pairs can be distinguished more accurately based on the similarity.

[0084] In an optional embodiment of the present invention, step 310 includes:

[0085] Sub-step S11: Convert the phrase pairs into word vectors;

[0086] In this embodiment of the invention, word vectors of domain phrases in phrase pairs are obtained by using the Glove (Global Vectors) model. Glove is a global log bilinear regression model. As the name suggests, this model uses global features of the corpus, namely the co-occurrence frequency matrix of words, and its optimization objective function is log-linear, solved in the form of regression.

[0087] Sub-step S12: Calculate the similarity between the word vectors using a preset calculation formula.

[0088] After obtaining the word vectors, the similarity between the word vectors can be calculated using a preset formula.

[0089] In one example, for word vectors A and B, the Euclidean dot product formula can be used:

[0090]

[0091] Perform calculations, where A i and B i These represent the components of vectors A and B, respectively.

[0092] In one example, for word vectors A and B, the Manhattan distance formula can be used:

[0093]

[0094] Perform calculations, where A i and B i These represent the components of vectors A and B, respectively. Manhattan distance, also known as city block distance, is the sum of the differences between the absolute values ​​of the coordinates of the vectors.

[0095] In one example, for word vectors A and B, the Euclidean distance formula can be used:

[0096]

[0097] Perform calculations, where Ai and B i These represent the components of vectors A and B, respectively. Euclidean distance originates from the formula for the distance between two points in Euclidean space.

[0098] In one example, for word vectors A and B, the Minkowski distance formula can be used:

[0099]

[0100] Perform calculations, where A i and B i These represent the components of vectors A and B, respectively. It's understandable that when p=1, this formula represents the Manhattan distance; when p=2, it represents the Euclidean distance; and in this example, p=3 can be set.

[0101] In one example, for word vectors A and B, the Curtis distance formula can be used:

[0102]

[0103] Perform calculations, where A i and B i These represent the components of vectors A and B, respectively.

[0104] In one example, for word vectors A and B, the Canberra formula can be used:

[0105]

[0106] Perform calculations, where A i and B i These represent the components of vectors A and B, respectively.

[0107] Those skilled in the art will understand that the above calculation formula is merely an example, and the present invention does not limit it. In specific implementation, any one of the calculation methods can be selected.

[0108] Step 311: Determine the domain phrase containing the domain keyword corresponding to the domain identifier as the domain bounding context of the vertical functional subclass, and determine the business domain corresponding to the microservice in the microservice model through the domain bounding context.

[0109] By more precisely distinguishing phrase pairs, for a given vertical functional subclass, the domain phrases containing domain keywords in its domain identifier can be identified as the domain bounded contexts of that vertical functional subclass. By calculating the similarity between phrase pairs, we analyze whether there is similarity between the domain bounded contexts corresponding to each vertical functional subclass, thus ensuring that the following text of vertical functional subclass A is not the preceding text of vertical functional subclass B. In other words, we ensure that the domain bounded context cannot be both the preceding text of vertical functional subclass A and the following text of vertical functional subclass B. The domain bounded context determines the business domain corresponding to the microservice in the microservice model. Domain bounded context prediction helps to classify the domains corresponding to microservice functions in the microservice model and find their respective bounded contexts. Each microservice in each domain aims to solve a specific problem; the microservice and its related microservice modules should be placed in the bounded context corresponding to that problem subdomain.

[0110] In an optional embodiment of the present invention, the function log is the data transmission log generated by the microservice during the operation of the microservice model.

[0111] During the operation of the microservice model, each vertical functional subclass handles its corresponding business according to its own function. Data is transmitted between the vertical functional subclasses, thereby generating functional logs. The functional logs contain information such as source IP, destination IP, device name, application name, and business processing time.

[0112] In this embodiment of the invention, based on a microservice model, keywords corresponding to the functions of vertical functional subclasses within a horizontal layer are extracted from functional logs. A classification identifier for each vertical functional subclass is determined based on these keywords. This classification identifier contains a first association relationship between the vertical functional subclass and other vertical functional subclasses. Keyword statistics are performed, and domain keywords for each vertical functional subclass are determined based on the frequency of keyword occurrences. A second association relationship between the vertical functional subclass and other vertical functional subclasses is obtained based on the first association relationship and the functional logs. A domain identifier for each vertical functional subclass is generated using this second association relationship. Multiple domain phrases are extracted based on these domain identifiers and saved to a preset location. In the domain phrase set, the domain phrases in the set are statistically analyzed. The target domain phrase is determined by the frequency of occurrence of the domain phrase. Synonyms of the target domain phrase are selected from the domain phrase set to form phrase pairs. The similarity between the phrase pairs is calculated to distinguish the domain phrases in the phrase pairs based on the similarity. This determines the domain to which each functional module of each microservice in the microservice architecture belongs and determines the bounded context of each subdomain in that domain. Thus, when a business is obtained, the corresponding functional module in the microservice architecture can be accurately determined to process the business, enabling the microservice architecture to operate stably in complex multi-layered scenarios.

[0113] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.

[0114] Reference Figure 4 This diagram illustrates a structural block diagram of a microservice partitioning device provided in an embodiment of the present invention. The preset microservice model is divided into multiple horizontal layers, and each horizontal layer contains multiple vertical functional subclasses; specifically, it may include the following modules:

[0115] The acquisition module 401 is used to acquire the function logs of the microservice model, and based on the microservice model, extract the classification identifiers of the functions corresponding to the vertical function subclasses from the function logs;

[0116] Domain keyword module 402 is used to obtain domain keywords for the vertical functional subclass based on the functional log;

[0117] Domain identification module 403 is used to determine the domain identifier of the vertical functional subclass from the functional log based on the classification identifier;

[0118] The selection module 404 is used to extract multiple domain phrases from the domain identifier and select phrase pairs from the multiple domain phrases;

[0119] Calculation module 405 is used to calculate the similarity between the phrase pairs, so as to distinguish the domain phrases in the phrase pairs based on the similarity;

[0120] The determination module 406 is used to determine the domain phrase containing the domain keyword corresponding to the domain identifier as the domain bounding context of the vertical functional subclass, and to determine the business domain corresponding to the microservice in the microservice model through the domain bounding context.

[0121] In an optional embodiment of the present invention, the acquisition module 401 includes:

[0122] The keyword submodule is used to extract keywords corresponding to the functions of the vertical functional subclasses in the horizontal layer from the functional logs based on the microservice model.

[0123] The classification identifier submodule is used to determine the classification identifier of the vertical functional subclass based on the keyword. The classification identifier contains a first association relationship between the vertical functional subclass and other vertical functional subclasses.

[0124] In an optional embodiment of the present invention, the domain keyword module 402 includes:

[0125] The statistics submodule is used to perform statistics on the keywords;

[0126] The domain keyword submodule is used to determine the domain keywords of the vertical functional subclass based on the frequency of occurrence of the keyword.

[0127] In an optional embodiment of the present invention, the domain identification module 403 includes:

[0128] The second association submodule is used to obtain the second association relationship between the vertical functional subclass and other vertical functional subclasses based on the first association relationship and the functional log;

[0129] The domain identifier submodule is used to generate the domain identifier of the vertical functional subclass using the second association relationship.

[0130] In an optional embodiment of the present invention, the selection module 404 includes:

[0131] The storage submodule is used to extract multiple domain phrases based on the domain identifier and save the domain phrases to a preset domain phrase set;

[0132] The target domain phrase submodule is used to count the domain phrases in the domain phrase set and determine the target domain phrase by the frequency of occurrence of the domain phrases;

[0133] The selection submodule is used to select synonyms of the target domain phrases from the domain phrase set to form phrase pairs.

[0134] In an optional embodiment of the present invention, the computing module 405 includes:

[0135] The transformation submodule is used to transform the phrase pairs into word vectors;

[0136] The calculation submodule is used to calculate the similarity between the word vectors using a preset calculation formula.

[0137] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.

[0138] In addition, embodiments of the present invention also provide an electronic device, such as... Figure 5As shown, it includes a processor 501, a communication interface 502, a memory 503, and a communication bus 504, wherein the processor 501, the communication interface 502, and the memory 503 communicate with each other through the communication bus 504.

[0139] Memory 503 is used to store computer programs;

[0140] When processor 501 executes the program stored in memory 503, it performs the following steps:

[0141] Obtain the function logs of the microservice model, and based on the microservice model, extract the category identifiers of the functions corresponding to the vertical function subclasses from the function logs;

[0142] Based on the functional logs, the domain keywords of the vertical functional subclasses are obtained;

[0143] Based on the classification identifier, the domain identifier of the vertical functional subclass is determined from the functional log;

[0144] Extract multiple domain phrases from the domain identifier, and select phrase pairs from the multiple domain phrases;

[0145] Calculate the similarity between the phrase pairs to distinguish domain phrases in the phrase pairs based on the similarity.

[0146] The domain phrase containing the domain keyword corresponding to the domain identifier is determined as the domain bounding context of the vertical functional subclass, and the business domain corresponding to the microservice in the microservice model is determined through the domain bounding context.

[0147] Optionally, the step of obtaining the function logs of the microservice model and extracting the classification identifiers of the vertical function subclasses from the function logs based on the microservice model includes:

[0148] For a vertical functional subclass in a horizontal layer, based on the microservice model, keywords corresponding to the functions of the vertical functional subclass are extracted from the functional logs;

[0149] The classification identifier of the vertical functional subclass is determined based on the keywords, and the classification identifier contains the first association relationship between the vertical functional subclass and other vertical functional subclasses.

[0150] Optionally, the step of obtaining the domain keywords of the vertical functional subclass based on the functional log includes:

[0151] Statistical analysis was performed on the keywords.

[0152] Based on the frequency of occurrence of the keywords, the domain keywords of the vertical functional subclass are determined.

[0153] Optionally, the step of determining the domain identifier of the vertical functional subclass from the functional log based on the classification identifier includes:

[0154] Based on the first association relationship and the functional log, obtain the second association relationship between the vertical functional subclass and other vertical functional subclasses;

[0155] The domain identifier of the vertical functional subclass is generated using the second association relationship.

[0156] Optionally, the step of extracting multiple domain phrases from the domain identifier and selecting phrase pairs from the multiple domain phrases includes:

[0157] Multiple domain phrases are extracted based on the domain identifier, and the domain phrases are saved to a preset domain phrase set;

[0158] The domain phrases in the domain phrase set are statistically analyzed, and the target domain phrase is determined by the frequency of their occurrence.

[0159] Synonyms of the target domain phrases are selected from the domain phrase set to form phrase pairs; optionally, the step of calculating the similarity between the phrase pairs includes:

[0160] Convert the phrase pairs into word vectors;

[0161] The similarity between the word vectors is calculated using a preset formula.

[0162] Optionally, the function log is the data transmission log generated by the microservice during the operation of the microservice model.

[0163] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.

[0164] The communication interface is used for communication between the aforementioned terminal and other devices.

[0165] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0166] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0167] like Figure 6 As shown, in another embodiment of the present invention, a computer-readable storage medium 601 is also provided, which stores instructions that, when run on a computer, cause the computer to execute the XX method described in the above embodiments.

[0168] In another embodiment of the present invention, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute the XX method described in the above embodiments.

[0169] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).

[0170] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0171] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0172] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.

Claims

1. A method for microservice partitioning, characterized in that, The pre-defined microservice model is divided into multiple horizontal layers, and each horizontal layer contains multiple vertical functional subclasses; the method includes: Obtain the function logs of the microservice model, and based on the microservice model, extract the category identifiers of the functions corresponding to the vertical function subclasses from the function logs; Based on the functional logs, the domain keywords of the vertical functional subclasses are obtained; Based on the classification identifier, the domain identifier of the vertical functional subclass is determined from the functional log; Extract multiple domain phrases from the domain identifier, and select phrase pairs from the multiple domain phrases; Calculate the similarity between the phrase pairs to distinguish domain phrases in the phrase pairs based on the similarity. The domain phrase containing the domain keyword corresponding to the domain identifier is determined as the domain bounding context of the vertical functional subclass, and the business domain corresponding to the microservice in the microservice model is determined through the domain bounding context.

2. The method according to claim 1, characterized in that, The steps of obtaining the function logs of the microservice model and extracting the classification identifiers of the vertical function subclasses from the function logs based on the microservice model include: For a vertical functional subclass in a horizontal layer, based on the microservice model, keywords corresponding to the functions of the vertical functional subclass are extracted from the functional logs; The classification identifier of the vertical functional subclass is determined based on the keywords, and the classification identifier contains the first association relationship between the vertical functional subclass and other vertical functional subclasses.

3. The method according to claim 2, characterized in that, The step of obtaining the domain keywords of the vertical functional subclass based on the functional log includes: Statistical analysis was performed on the keywords. Based on the frequency of occurrence of the keywords, the domain keywords of the vertical functional subclass are determined.

4. The method according to claim 3, characterized in that, The step of determining the domain identifier of the vertical functional subclass from the functional log based on the classification identifier includes: Based on the first association relationship and the functional log, obtain the second association relationship between the vertical functional subclass and other vertical functional subclasses; The domain identifier of the vertical functional subclass is generated using the second association relationship.

5. The method according to claim 1, characterized in that, The step of extracting multiple domain phrases from the domain identifier and selecting phrase pairs from the multiple domain phrases includes: Multiple domain phrases are extracted based on the domain identifier, and the domain phrases are saved to a preset domain phrase set; The domain phrases in the domain phrase set are statistically analyzed, and the target domain phrase is determined by the frequency of their occurrence. Synonyms of the target domain phrases are selected from the domain phrase set to form phrase pairs.

6. The method according to claim 1 or 5, characterized in that, The step of calculating the similarity between the phrase pairs includes: Convert the phrase pairs into word vectors; The similarity between the word vectors is calculated using a preset formula.

7. The method according to claim 1, characterized in that, The functional logs are the data transmission logs generated by the microservices during the operation of the microservice model.

8. A device for microservice partitioning, characterized in that, The pre-defined microservice model is divided into multiple horizontal layers, and each horizontal layer contains multiple vertical functional subclasses; the device includes: The acquisition module is used to acquire the functional logs of the microservice model, and based on the microservice model, extract the classification identifiers of the functions corresponding to the vertical functional subclasses from the functional logs; The domain keyword module is used to obtain the domain keywords of the vertical functional subclass based on the functional logs; The domain identification module is used to determine the domain identifier of the vertical functional subclass from the functional log based on the classification identifier; A selection module is used to extract multiple domain phrases from the domain identifier and select phrase pairs from the multiple domain phrases; A calculation module is used to calculate the similarity between the phrase pairs in order to distinguish domain phrases in the phrase pairs based on the similarity. The determination module is used to determine the domain phrase containing the domain keyword corresponding to the domain identifier as the domain bounding context of the vertical functional subclass, and to determine the business domain corresponding to the microservice in the microservice model through the domain bounding context.

9. An electronic device, characterized in that, include: The system includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus. The memory is used to store computer programs; When the processor executes a program stored in the memory, it implements the method as described in any one of claims 1-7.

10. One or more computer-readable media having instructions stored thereon that, when executed by one or more processors, cause the processors to perform the method as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Micro-service splitting method based on demand model

    CN114089956A

  • Micro-service system construction method and device based on domain-driven design, and medium

    CN114201144A