A method and system for managing interface dependencies in a microservice software architecture

By building and managing interface dependency mapping in the microservice software architecture, the problems of high coupling of interfaces, weak restrictions and difficult to control the impact of changes are solved, and higher system stability and user experience are achieved.

CN119149091BActive Publication Date: 2025-02-21SHENZHEN ZHONGZHENG HUIZHI MANAGEMENT CONSULTING CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411615394.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-13
Publication Date
2025-02-21
Estimated Expiration
2044-11-13

AI Technical Summary

Technical Problem

There are problems in the microservice architecture with high interface coupling, weak interface restrictions and difficult to control the impact of interface changes, which lead to difficult to locate communication failures between services and affect system stability and user experience.

Method used

By obtaining the interface code of the interface to be managed in the microservice software architecture, analyzing the interface dependencies, building interface dependencies, and performing security management, compatibility management and health monitoring, to reduce interface coupling and improve management capabilities.

Benefits of technology

It effectively reduces the high coupling of microservice interfaces, enhances the management ability of interface usage restrictions, improves control over the impact of interface changes, and ensures the stability and user experience of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119149091B_ABST
    Figure CN119149091B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of interface management, and discloses an interface dependency management method in a microservice software architecture, including: using interface code to analyze the interface dependency relationship between each interface to be managed in the interface to be managed, and constructing an interface dependency mapping between each interface to be managed in the interface to be managed; performing security management on the interface dependency mapping; detecting whether there is a merge conflict between the interface dependency mapping and the service dependency mapping, so as to complete the compatibility management of the interface dependency mapping and obtain a compatibility management result; performing indicator weighting on the interface dependency index, calculating the health score of the interface dependency mapping using the interface dependency index and the index weight, and performing health monitoring on the interface dependency mapping through the health score; analyzing the emergency effect of the interface dependency mapping under emergency measures, and executing emergency measures to complete the health management of the interface dependency mapping. The present invention can reduce the problems of high coupling, weak interface restrictions and difficult to control abnormalities of microservice interfaces.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to an interface dependency management method and system in a microservice software architecture, belonging to the technical field of interface management. Background Art

[0002] With the development of Internet technology, distributed application architecture has been widely adopted due to its high availability, scalability and flexibility. However, in distributed systems, various services interact through interfaces. Although this loosely coupled design pattern brings many benefits, it also brings challenges to service interface dependency management. Traditional dependency management methods often cannot meet the dynamic changing needs in distributed environments, resulting in difficulty in locating communication failures between services, affecting system stability and user experience. The main problems are as follows: High coupling of interfaces between microservices: Although the microservice architecture splits large monolithic applications, the interface calls between microservices are complicated, which leads to high coupling between microservices; loose management of interface call restrictions: Currently, microservice architectures generally share a centralized service registration and discovery center. The interface exposed by a microservice can be directly called by all microservices and clients under the registration and discovery center, resulting in loose and weak management of interface usage restrictions; Difficult to control the impact of interface changes: Currently, in the microservice architecture, since the interface call restrictions exposed by microservices are not centrally managed, the service interface provider does not know which callers exist for a certain interface. If the interface is modified, it is difficult to control the impact on surrounding microservices. Therefore, the problems of high coupling of microservice interfaces, weak interface restrictions and difficult to control exceptions need to be solved urgently. Summary of the invention

[0003] The present invention provides an interface dependency management method and system in a microservice software architecture, the main purpose of which is to reduce the problems of high coupling, weak interface restrictions and difficult-to-control anomalies of microservice interfaces.

[0004] To achieve the above object, the present invention provides a method for managing interface dependencies in a microservice software architecture, comprising:

[0005] Obtain interface codes of the interfaces to be managed in the microservice software architecture, use the interface codes to analyze interface dependencies between each of the interfaces to be managed, and construct interface dependency mappings between each of the interfaces to be managed based on the interface dependencies;

[0006] Obtaining whitelist users and current users of the interface dependency mapping, collecting historical usage logs of the interface dependency mapping by the whitelist users, identifying current usage logs of the interface dependency mapping by the current user, and performing security management on the interface dependency mapping based on the historical usage logs and the current usage logs to obtain security management results;

[0007] Obtain a new version product of the microservice software architecture, query the service dependency mapping of the new version product, detect whether there is a merge conflict between the interface dependency mapping and the service dependency mapping, so as to complete the compatibility management of the interface dependency mapping and obtain a compatibility management result;

[0008] Collecting interface dependency indicators of the interface dependency mapping, weighting the interface dependency indicators to obtain indicator weights of the interface dependency indicators, calculating a health score of the interface dependency mapping using the interface dependency indicators and the indicator weights, and performing health monitoring on the interface dependency mapping using the health score to obtain a health monitoring result;

[0009] When the health score is lower than a preset score, the emergency measures of the interface dependency mapping are obtained, the emergency effects of the interface dependency mapping under the emergency measures are analyzed, and according to the emergency effects, the emergency measures are executed to complete the health management of the interface dependency mapping and obtain the health management result;

[0010] The interface dependency mapping, the security management result, the compatibility management result, the health monitoring result and the health management result are used as the interface dependency management result of the microservice software architecture.

[0011] Optionally, the analyzing the interface dependency relationship between each of the interfaces to be managed in the interfaces to be managed by using the interface code includes:

[0012] Identifying a code calling relationship between each interface code in the interface code;

[0013] Identifying target codes in the interface codes belonging to the same interface to be managed;

[0014] Querying the code breakpoints of the target code by using the code calling relationship;

[0015] According to the code breakpoint, the interface dependency relationship between each of the interfaces to be managed is generated using the following format:

[0016] ;

[0017] ;

[0018] ;

[0019] ;

[0020] ;

[0021] in, Indicates interface dependencies. Indicates interfaces to be managed, Indicates The target code of the interface to be managed, , Indicates code breakpoints of the target code of the interface to be managed, Indicates interfaces to be managed, Indicates interfaces to be managed, Indicates The target code of the interface to be managed, Indicates The target code of the interface to be managed, Indicates the length of the code call relationship of the interface code, express , , The code calling relationship between them.

[0022] Optionally, the identifying the code calling relationship between each interface code in the interface code includes:

[0023] According to the return statement, assignment statement, control statement and function call statement in the interface code, identifying the direct call relationship between each interface code in the interface code;

[0024] Identifying an indirect calling relationship between each interface code in the interface code from the direct calling relationship;

[0025] The direct calling relationship and the indirect calling relationship are used as code calling relationships.

[0026] Optionally, constructing an interface dependency mapping between each of the interfaces to be managed in the interfaces to be managed based on the interface dependency relationship includes:

[0027] Based on the interface dependency, determining the input end, output end and dependent interface of each of the interfaces to be managed;

[0028] According to the input end, the output end and the dependent interface, a dependency relationship mapping diagram between each of the interfaces to be managed is established;

[0029] The dependency relationship mapping diagram is used as an interface dependency mapping between each of the interfaces to be managed.

[0030] Optionally, the performing security management on the interface dependency mapping based on the historical usage log and the current usage log to obtain a security management result includes:

[0031] The historical usage log is converted into a historical vector using the following formula:

[0032] ;

[0033] in, represents the history vector, Indicates historical usage logs. Represents a natural language processing model based on deep learning;

[0034] Converting the current usage log into a current vector;

[0035] Calculating the vector similarity between the historical vector and the current vector;

[0036] When the vector similarity is greater than a preset similarity, determining that the interface dependency mapping is in a safe state, and maintaining security monitoring of the interface dependency mapping based on the safe state to obtain a first security management result;

[0037] When the vector similarity is not greater than a preset similarity, it is determined that the interface dependency mapping is in an unsafe state, and based on the unsafe state, access is restricted to a current user corresponding to the current usage log to obtain a second security management result.

[0038] Optionally, the detecting whether there is a merge conflict between the interface dependency mapping and the service dependency mapping includes:

[0039] Respectively obtaining the interface dependency code and the service dependency code of the interface dependency mapping and the service dependency mapping;

[0040] The interface dependency code is converted into an interface dependency vector using the following formula:

[0041] ;

[0042] in, Represents the interface dependency vector, Indicates interface dependent code, Represents a code language processing model based on deep learning;

[0043] Converting the service dependency code into a service dependency vector;

[0044] Randomly combining the interface dependency vector and the service dependency vector to obtain a combination vector;

[0045] Constructing a Markov chain library of the combination vectors;

[0046] Calculating the Markov probability corresponding to the combined vector according to the Markov chain library;

[0047] When the Markov probability is greater than a preset probability value, determining that there is no merge conflict between the interface dependency mapping and the service dependency mapping;

[0048] When the Markov probability is not greater than a preset probability value, it is determined that there is a merge conflict between the interface dependency mapping and the service dependency mapping.

[0049] Optionally, the step of weighting the interface dependency indicator to obtain the indicator weight of the interface dependency indicator includes:

[0050] Identify positive indicators and negative indicators in the interface dependency indicators;

[0051] Standardizing the positive indicator and the negative indicator respectively to obtain a standardized indicator;

[0052] The index entropy value of the standardized index is calculated using the following formula:

[0053] ;

[0054] ;

[0055] in, represents the index entropy value, Indicates Under the standardized indicators The proportion of sample values ​​in this indicator. Indicates The number of sample values ​​under the standardized indicators, Indicates Under the standardized indicators Sample values;

[0056] According to the indicator entropy value, the indicator weight of the standardized indicator is calculated using the following formula:

[0057] ;

[0058] in, represents the indicator weight, represents the index entropy value, Indicates the serial number of the standardized indicator, Indicates the number of normalized indicators.

[0059] Optionally, the calculating the health score of the interface dependency mapping by using the interface dependency indicator and the indicator weight includes:

[0060] Obtaining standardized indicators corresponding to the interface dependency indicators;

[0061] According to the standardized index and the index weight, the health score of the interface dependency mapping is calculated using the following formula:

[0062] ;

[0063] in, represents the health score, represents the indicator weight, Indicates Under the standardized indicators Sample values, Indicates the serial number of the standardized indicator, Indicates the number of normalized indicators.

[0064] Optionally, the analyzing the emergency effect of the interface dependency mapping under the emergency measure includes:

[0065] Obtaining an interface dependency indicator corresponding to the interface dependency mapping;

[0066] Splicing the interface dependency indicator and the emergency measures to obtain splicing data;

[0067] The following formula is used to extract features from the spliced ​​data to obtain extracted features:

[0068] ;

[0069] ;

[0070] ;

[0071] ;

[0072] in, represents the extracted features, represents a convolutional neural network, Represents concatenated data, Indicates The output vector, represents the multi-head attention mechanism, Indicates The output vector, represents the concatenation function, represents a gated recurrent unit, represents the vector output by the gated recurrent unit;

[0073] According to the extracted features, the probability of the emergency effect of the interface dependency mapping under the emergency measures is calculated using the following formula:

[0074] ;

[0075] in, represents the probability of emergency effect, represents the fully connected layer, express function, Represents extracted features;

[0076] The emergency effect probability is used to analyze the emergency effect of the interface dependency mapping under the emergency measures.

[0077] In order to solve the above problems, the present invention also provides an interface dependency management system in a microservice software architecture, the system comprising:

[0078] A mapping construction module is used to obtain the interface code of the interface to be managed in the microservice software architecture, analyze the interface dependency relationship between each of the interfaces to be managed in the interfaces to be managed by using the interface code, and construct an interface dependency mapping between each of the interfaces to be managed in the interfaces to be managed based on the interface dependency relationship;

[0079] A security management module, used to obtain whitelist users and current users of the interface dependency mapping, collect historical usage logs of the interface dependency mapping by the whitelist users, identify current usage logs of the interface dependency mapping by the current user, perform security management on the interface dependency mapping based on the historical usage logs and the current usage logs, and obtain security management results;

[0080] A compatibility management module is used to obtain a new version product of the microservice software architecture, query the service dependency mapping of the new version product, detect whether there is a merge conflict between the interface dependency mapping and the service dependency mapping, so as to complete the compatibility management of the interface dependency mapping and obtain a compatibility management result;

[0081] A health monitoring module is used to collect interface dependency indicators of the interface dependency mapping, perform indicator weighting on the interface dependency indicators to obtain the indicator weights of the interface dependency indicators, calculate the health score of the interface dependency mapping using the interface dependency indicators and the indicator weights, perform health monitoring on the interface dependency mapping using the health score, and obtain a health monitoring result;

[0082] A health management module, used for obtaining the emergency measures of the interface dependency mapping when the health score is lower than a preset score, analyzing the emergency effects of the interface dependency mapping under the emergency measures, and executing the emergency measures according to the emergency effects to complete the health management of the interface dependency mapping and obtain a health management result;

[0083] A dependency management module is used to use the interface dependency mapping, the security management result, the compatibility management result, the health monitoring result and the health management result as the interface dependency management result of the microservice software architecture.

[0084] Compared with the problems described in the background technology, the embodiment of the present invention analyzes the interface dependency relationship between each interface to be managed in the interface to be managed by using the interface code, so as to reduce the problem of complicated interface calls between microservices, thereby reducing the high coupling between microservices. Further, the embodiment of the present invention performs security management on the interface dependency mapping based on the historical usage log and the current usage log, so as to reduce the problem of loose and weak interface usage restriction management. Further, the embodiment of the present invention detects whether there is a merge conflict between the interface dependency mapping and the service dependency mapping, so as to be used when there is a new version of the product. Since the new version of the product still needs to run in the original microservice architecture, it is necessary to consider the compatibility between the new version of the product and the old microservice architecture. The embodiment of the present invention weights the interface dependency index to calculate the weight of the interface dependency index. Further, the embodiment of the present invention analyzes the emergency effect of the interface dependency mapping under the emergency measures, so as not to use the previous long short-term memory network to predict the interface dependency index of the future period based on the monitored historical interface dependency index, but to add emergency measures to the historical interface dependency index to predict the interface dependency index of the future period, thereby ensuring the control and processing of abnormal data. Therefore, the interface dependency management method in the microservice software architecture proposed in the present invention can reduce the problems of high coupling of microservice interfaces, weak interface restrictions and difficult to control exceptions. BRIEF DESCRIPTION OF THE DRAWINGS

[0085] Figure 1 A flowchart of a method for managing interface dependencies in a microservice software architecture provided by an embodiment of the present invention;

[0086] Figure 2 A schematic diagram of a module for implementing the interface dependency management method in the microservice software architecture provided by an embodiment of the present invention.

[0087] The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings in conjunction with the embodiments. DETAILED DESCRIPTION

[0088] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0089] The embodiment of the present application provides an interface dependency management method in a microservice software architecture. The execution subject of the interface dependency management method in the microservice software architecture includes but is not limited to at least one of the electronic devices such as a server and a terminal that can be configured to execute the method provided by the embodiment of the present application. In other words, the interface dependency management method in the microservice software architecture can be executed by software or hardware installed in a terminal device or a server device. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc.

[0090] Embodiment 1:

[0091] Reference Figure 1 FIG. 1 is a flow chart of an interface dependency management method in a microservice software architecture provided by an embodiment of the present invention. In this embodiment, the interface dependency management method in the microservice software architecture includes:

[0092] S1. Obtain the interface code of the interface to be managed in the microservice software architecture, use the interface code to analyze the interface dependency relationship between each interface to be managed in the interface to be managed, and based on the interface dependency relationship, construct an interface dependency mapping between each interface to be managed in the interface to be managed.

[0093] In an embodiment of the present invention, the microservice software architecture refers to an application architecture, in which a series of independent services communicate through a lightweight API, the interface to be managed refers to the interface involved in the microservice software architecture, and the interface code refers to a series of codes related to the operation of the interface.

[0094] Furthermore, the embodiment of the present invention uses the interface code to analyze the interface dependency between each of the interfaces to be managed, so as to reduce the complexity of interface calls between microservices, thereby reducing the high coupling between microservices.

[0095] The interface dependency relationship refers to the mutual calling and mutual association relationship between each interface and other interfaces.

[0096] In one embodiment of the present invention, the interface dependency relationship between each interface to be managed in the interface to be managed is analyzed by using the interface code, including: identifying the code calling relationship between each interface code in the interface code; identifying the target code belonging to the same interface to be managed in the interface code; querying the code breakpoint of the target code by using the code calling relationship; and generating the interface dependency relationship between each interface to be managed in the interface to be managed by using the following format according to the code breakpoint:

[0097] ;

[0098] ;

[0099] ;

[0100] ;

[0101] ;

[0102] in, Indicates interface dependencies. Indicates interfaces to be managed, Indicates The target code of the interface to be managed, , Indicates code breakpoints of the target code of the interface to be managed, Indicates interfaces to be managed, Indicates interfaces to be managed, Indicates The target code of the interface to be managed, Indicates The target code of the interface to be managed, Indicates the length of the code call relationship of the interface code, express , , The code calling relationship between them.

[0103] In another embodiment of the present invention, the identifying of the code calling relationship between each interface code in the interface code includes: identifying the direct calling relationship between each interface code in the interface code based on the return statement, assignment statement, control statement and function calling statement in the interface code; identifying the indirect calling relationship between each interface code in the interface code from the direct calling relationship; and using the direct calling relationship and the indirect calling relationship as the code calling relationship.

[0104] Among them, the direct calling relationship includes the relationship of returning from a certain position to other positions in the return statement, the relationship of assigning a certain data to other data in the assignment statement, the relationship of a certain data in the control statement becoming other data under the action of the control function, and the relationship of a certain data calling a certain function in the function call statement. The indirect calling relationship refers to the relationship integrated from multiple direct calling relationships. For example, if the direct calling relationship is A and B, B and C, then the indirect calling relationship is A and C.

[0105] In one embodiment of the present invention, the interface dependency mapping between each of the interfaces to be managed is constructed based on the interface dependency, including: determining the input end, output end and dependent interface of each of the interfaces to be managed based on the interface dependency; establishing a dependency mapping diagram between each of the interfaces to be managed according to the input end, the output end and the dependent interface; and using the dependency mapping diagram as the interface dependency mapping between each of the interfaces to be managed.

[0106] The dependent interfaces refer to other interfaces that have a dependency relationship with the interface to be managed, and the dependency relationship mapping graph refers to a graph structure in which multiple interfaces to be managed are nodes and interface dependency relationships between interfaces are edges.

[0107] S2. Obtain the whitelist users and current users of the interface dependency mapping, collect historical usage logs of the interface dependency mapping by the whitelist users, identify the current usage logs of the interface dependency mapping by the current user, and perform security management on the interface dependency mapping based on the historical usage logs and the current usage logs to obtain security management results.

[0108] In an embodiment of the present invention, the whitelist user refers to a user who is recorded in the microservice architecture in a historical period and has the right to access the microservice, the current user refers to a user who is waiting to be verified whether he has the right to access the microservice in the current period, and the historical usage log and the current usage log both refer to a series of operation logs performed by the user on the system when using the microservice authority.

[0109] Furthermore, the embodiment of the present invention performs security management on the interface dependency mapping based on the historical usage log and the current usage log, so as to reduce the problem of loose and weak management of interface usage restrictions.

[0110] In one embodiment of the present invention, the security management of the interface dependency mapping is performed based on the historical usage log and the current usage log to obtain a security management result, including: converting the historical usage log into a historical vector using the following formula:

[0111]

[0112] in, represents the history vector, Indicates historical usage logs. Represents a natural language processing model based on deep learning;

[0113] The current usage log is converted into a current vector; the vector similarity between the historical vector and the current vector is calculated; when the vector similarity is greater than a preset similarity, the interface dependency mapping is determined to be in a secure state, and security monitoring of the interface dependency mapping is maintained based on the secure state, to obtain a first security management result; when the vector similarity is not greater than a preset similarity, the interface dependency mapping is determined to be in an unsecure state, and access to the current user corresponding to the current usage log is restricted based on the unsecure state, to obtain a second security management result.

[0114] Optionally, the principle of converting the current usage log into the current vector is similar to the principle of converting the historical usage log into the historical vector, and will not be further elaborated here. The vector similarity between the historical vector and the current vector can be calculated by cosine similarity, and the preset similarity can be set to 0.8, or it can be set according to the actual scenario.

[0115] S3. Obtain a new version product of the microservice software architecture, query the service dependency mapping of the new version product, and detect whether there is a merge conflict between the interface dependency mapping and the service dependency mapping to complete the compatibility management of the interface dependency mapping and obtain a compatibility management result.

[0116] In the embodiment of the present invention, the new version product refers to the updated and upgraded version of the software. It should be noted that this new version product still needs to use the microservice architecture, so the compatibility between the new version product and the old microservice architecture needs to be considered.

[0117] Optionally, the principle of querying the service dependency mapping of the new version of the product is similar to the principle of using the interface code to analyze the interface dependency relationship between each interface to be managed in the interface to be managed, and based on the interface dependency relationship, constructing an interface dependency mapping between each interface to be managed in the interface to be managed, and no further elaboration is given here.

[0118] Furthermore, the embodiment of the present invention detects whether there is a merge conflict between the interface dependency mapping and the service dependency mapping, so as to be used when there is a new version of the product. Since the new version of the product still needs to run in the original microservice architecture, it is necessary to consider the compatibility between the new version of the product and the old microservice architecture.

[0119] In one embodiment of the present invention, the detecting whether there is a merge conflict between the interface dependency mapping and the service dependency mapping includes: obtaining the interface dependency code and the service dependency code of the interface dependency mapping and the service dependency mapping respectively; and converting the interface dependency code into an interface dependency vector using the following formula:

[0120] ;

[0121] in, Represents the interface dependency vector, Indicates interface dependent code, Represents a code language processing model based on deep learning;

[0122] The service dependency code is converted into a service dependency vector; the interface dependency vector and the service dependency vector are randomly combined to obtain a combination vector; a Markov chain library of the combination vector is constructed; based on the Markov chain library, the Markov probability corresponding to the combination vector is calculated; when the Markov probability is greater than a preset probability value, it is determined that there is no merge conflict between the interface dependency mapping and the service dependency mapping; when the Markov probability is not greater than the preset probability value, it is determined that there is a merge conflict between the interface dependency mapping and the service dependency mapping.

[0123] Among them, the interface dependency code and the service dependency code refer to a series of background codes related to the interface dependency mapping and the service dependency mapping. The Markov chain library stores a database of a large number of Markov chains and the probabilities corresponding to the Markov chains. A large number of Markov chains and the probabilities corresponding to the Markov chains are calculated through historical data. The preset probability value is set according to the actual scenario.

[0124] Optionally, the principle of converting the service dependency code into a service dependency vector is similar to the principle of converting the interface dependency code into an interface dependency vector, and will not be further elaborated here. The process of calculating the Markov probability corresponding to the combined vector according to the Markov chain library refers to calculating the Bayesian probability of the appearance of the C vector under the premise that the A vector and the B vector appear after combining the combined vector, for example, the A vector with the B vector and the C vector.

[0125] S4. Collect interface dependency indicators of the interface dependency mapping, perform indicator weighting on the interface dependency indicators to obtain indicator weights of the interface dependency indicators, calculate a health score of the interface dependency mapping using the interface dependency indicators and the indicator weights, perform health monitoring on the interface dependency mapping using the health score, and obtain a health monitoring result.

[0126] The embodiment of the present invention performs indicator weighting on the interface dependency indicator to calculate the weight of the interface dependency indicator.

[0127] The interface dependency index refers to the operating status and performance index of the interface when it runs according to the dependency relationship, such as response time, error rate, etc.

[0128] In one embodiment of the present invention, the interface dependency indicator is weighted to obtain the indicator weight of the interface dependency indicator, including: identifying positive indicators and negative indicators in the interface dependency indicator; performing indicator standardization on the positive indicator and the negative indicator respectively to obtain a standardized indicator; and calculating the indicator entropy value of the standardized indicator using the following formula:

[0129] ;

[0130] ;

[0131] in, represents the index entropy value, Indicates Under the standardized indicators The proportion of sample values ​​in this indicator. Indicates The number of sample values ​​under the standardized indicators, Indicates Under the standardized indicators Sample values;

[0132] According to the indicator entropy value, the indicator weight of the standardized indicator is calculated using the following formula:

[0133] ;

[0134] in, represents the indicator weight, represents the index entropy value, Indicates the serial number of the standardized indicator, Indicates the number of normalized indicators.

[0135] In one embodiment of the present invention, the method of calculating the health score of the interface dependency mapping using the interface dependency indicator and the indicator weight includes: obtaining a standardized indicator corresponding to the interface dependency indicator; and calculating the health score of the interface dependency mapping using the following formula according to the standardized indicator and the indicator weight:

[0136] ;

[0137] in, represents the health score, represents the indicator weight, Indicates Under the standardized indicators Sample values, Indicates the serial number of the standardized indicator, Indicates the number of normalized indicators.

[0138] S5. When the health score is lower than a preset score, obtain the emergency measures of the interface dependency mapping, analyze the emergency effects of the interface dependency mapping under the emergency measures, and execute the emergency measures according to the emergency effects to complete the health management of the interface dependency mapping and obtain the health management results.

[0139] In the embodiment of the present invention, the emergency measures refer to measures for processing abnormal data executed when an abnormality is detected in a dependent service, such as automatically executing emergency measures such as fault isolation and traffic scheduling.

[0140] Furthermore, an embodiment of the present invention analyzes the emergency effect of the interface dependency mapping under the emergency measures, so as not to use the previous long short-term memory network to predict the interface dependency indicators of the future time period based on the monitored historical interface dependency indicators, but to add emergency measures to the historical interface dependency indicators to predict the interface dependency indicators of the future time period, thereby ensuring the control and processing of abnormal data.

[0141] The emergency effect refers to the interface dependency index in the future period.

[0142] In one embodiment of the present invention, the analysis of the emergency effect of the interface dependency mapping under the emergency measures includes: obtaining an interface dependency index corresponding to the interface dependency mapping; splicing the interface dependency index and the emergency measures to obtain spliced ​​data; and extracting features from the spliced ​​data using the following formula to obtain extracted features:

[0143] ;

[0144] ;

[0145] ;

[0146] ;

[0147] in, represents the extracted features, represents a convolutional neural network, Represents concatenated data, Indicates The output vector, represents the multi-head attention mechanism, Indicates The output vector, represents the concatenation function, represents a gated recurrent unit, represents the vector output by the gated recurrent unit;

[0148] According to the extracted features, the probability of the emergency effect of the interface dependency mapping under the emergency measures is calculated using the following formula:

[0149] ;

[0150] in, represents the probability of emergency effect, represents the fully connected layer, express function, Represents extracted features;

[0151] The emergency effect probability is used to analyze the emergency effect of the interface dependency mapping under the emergency measures.

[0152] Optionally, the process of executing the emergency measures according to the emergency effects refers to screening emergency effects with good performance from the emergency effects and executing the emergency measures corresponding to the emergency effects.

[0153] S6. Use the interface dependency mapping, the security management result, the compatibility management result, the health monitoring result and the health management result as the interface dependency management result of the microservice software architecture.

[0154] Compared with the problems described in the background technology, the embodiment of the present invention analyzes the interface dependency relationship between each interface to be managed in the interface to be managed by using the interface code, so as to reduce the problem of complicated interface calls between microservices, thereby reducing the high coupling between microservices. Further, the embodiment of the present invention performs security management on the interface dependency mapping based on the historical usage log and the current usage log, so as to reduce the problem of loose and weak interface usage restriction management. Further, the embodiment of the present invention detects whether there is a merge conflict between the interface dependency mapping and the service dependency mapping, so as to be used when there is a new version of the product. Since the new version of the product still needs to run in the original microservice architecture, it is necessary to consider the compatibility between the new version of the product and the old microservice architecture. The embodiment of the present invention weights the interface dependency index to calculate the weight of the interface dependency index. Further, the embodiment of the present invention analyzes the emergency effect of the interface dependency mapping under the emergency measures, so as not to use the previous long short-term memory network to predict the interface dependency index of the future period based on the monitored historical interface dependency index, but to add emergency measures to the historical interface dependency index to predict the interface dependency index of the future period, thereby ensuring the control and processing of abnormal data. Therefore, the interface dependency management method in the microservice software architecture proposed in the present invention can reduce the problems of high coupling of microservice interfaces, weak interface restrictions and difficult to control exceptions.

[0155] Embodiment 2:

[0156] like Figure 2 The figure shows a functional module diagram of an interface dependency management system in a microservice software architecture of the present invention.

[0157] The interface dependency management system 200 in a microservice software architecture described in the present invention can be installed in an electronic device. According to the functions implemented, the interface dependency management system in the microservice software architecture can include a mapping construction module 201, a security management module 202, a compatibility management module 203, a health monitoring module 204, a health management module 205 and a dependency management module 206. The module described in the present invention can also be called a unit, which refers to a series of computer program segments that can be executed by an electronic device processor and can complete fixed functions, which are stored in the memory of the electronic device.

[0158] In the embodiment of the present invention, the functions of each module / unit are as follows:

[0159] The mapping construction module 201 is used to obtain the interface code of the interface to be managed in the microservice software architecture, analyze the interface dependency relationship between each interface to be managed in the interface to be managed by using the interface code, and construct the interface dependency mapping between each interface to be managed in the interface to be managed based on the interface dependency relationship;

[0160] The security management module 202 is used to obtain the whitelist users and the current user of the interface dependency mapping, collect the historical usage logs of the interface dependency mapping by the whitelist users, identify the current usage logs of the interface dependency mapping by the current user, and perform security management on the interface dependency mapping based on the historical usage logs and the current usage logs to obtain a security management result;

[0161] The compatibility management module 203 is used to obtain a new version product of the microservice software architecture, query the service dependency mapping of the new version product, and detect whether there is a merge conflict between the interface dependency mapping and the service dependency mapping, so as to complete the compatibility management of the interface dependency mapping and obtain a compatibility management result;

[0162] The health monitoring module 204 is used to collect interface dependency indicators of the interface dependency mapping, perform indicator weighting on the interface dependency indicators to obtain the indicator weights of the interface dependency indicators, calculate the health score of the interface dependency mapping using the interface dependency indicators and the indicator weights, perform health monitoring on the interface dependency mapping using the health score, and obtain a health monitoring result;

[0163] The health management module 205 is used to obtain the emergency measures of the interface dependency mapping when the health score is lower than the preset score, analyze the emergency effect of the interface dependency mapping under the emergency measures, and execute the emergency measures according to the emergency effect to complete the health management of the interface dependency mapping and obtain the health management result;

[0164] The dependency management module 206 is used to use the interface dependency mapping, the security management result, the compatibility management result, the health monitoring result and the health management result as the interface dependency management result of the microservice software architecture.

[0165] In detail, each module in the interface dependency management system 200 in the microservice software architecture in the embodiment of the present invention is used in the same manner as described above. Figure 1 The technical means are the same as the interface dependency management method in the microservice software architecture described in, and can produce the same technical effects, so I will not go into details here.

[0166] It is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.

[0167] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.

Claims

1. A method for managing interface dependencies in a microservice software architecture, characterized in that: The method comprises: Obtain interface codes of interfaces to be managed in a microservice software architecture, use the interface codes to analyze interface dependencies between each interface to be managed in the interfaces to be managed, and construct interface dependency mappings between each interface to be managed in the interfaces to be managed based on the interface dependencies, wherein using the interface codes to analyze interface dependencies between each interface to be managed in the interfaces to be managed includes: Identifying a code calling relationship between each interface code in the interface code; Identifying target codes in the interface codes belonging to the same interface to be managed; Querying the code breakpoints of the target code by using the code calling relationship; According to the code breakpoint, the interface dependency relationship between each of the interfaces to be managed is generated using the following format: ; ; ; ; ; in, Indicates interface dependencies. Indicates interfaces to be managed, Indicates The target code of the interface to be managed, , Indicates A code breakpoint in the target code of the interface to be managed, Indicates interfaces to be managed, Indicates interfaces to be managed, Indicates The target code of the interface to be managed, Indicates The target code of the interface to be managed, Indicates the length of the code call relationship of the interface code, express , , The code calling relationship between them; Obtaining whitelist users and current users of the interface dependency mapping, collecting historical usage logs of the interface dependency mapping by the whitelist users, identifying current usage logs of the interface dependency mapping by the current user, and performing security management on the interface dependency mapping based on the historical usage logs and the current usage logs to obtain a security management result, wherein the performing security management on the interface dependency mapping based on the historical usage logs and the current usage logs to obtain a security management result includes: The historical usage log is converted into a historical vector using the following formula: ; in, represents the history vector, Indicates historical usage logs. Represents a natural language processing model based on deep learning; Converting the current usage log into a current vector; Calculating the vector similarity between the historical vector and the current vector; When the vector similarity is greater than a preset similarity, determining that the interface dependency mapping is in a safe state, and maintaining security monitoring of the interface dependency mapping based on the safe state to obtain a first security management result; When the vector similarity is not greater than a preset similarity, determining that the interface dependency mapping is in an unsafe state, and restricting access to the current user corresponding to the current use log based on the unsafe state, to obtain a second security management result; Obtain a new version product of the microservice software architecture, query the service dependency mapping of the new version product, detect whether there is a merge conflict between the interface dependency mapping and the service dependency mapping, so as to complete the compatibility management of the interface dependency mapping and obtain a compatibility management result, wherein the detecting whether there is a merge conflict between the interface dependency mapping and the service dependency mapping includes: Respectively obtaining the interface dependency code and the service dependency code of the interface dependency mapping and the service dependency mapping; The interface dependency code is converted into an interface dependency vector using the following formula: ; in, Represents the interface dependency vector, Indicates interface dependent code, Represents a code language processing model based on deep learning; Converting the service dependency code into a service dependency vector; Randomly combining the interface dependency vector and the service dependency vector to obtain a combination vector; Constructing a Markov chain library of the combination vectors; Calculating the Markov probability corresponding to the combined vector according to the Markov chain library; When the Markov probability is greater than a preset probability value, determining that there is no merge conflict between the interface dependency mapping and the service dependency mapping; When the Markov probability is not greater than a preset probability value, determining that there is a merge conflict between the interface dependency mapping and the service dependency mapping; Collecting interface dependency indicators of the interface dependency mapping, weighting the interface dependency indicators to obtain indicator weights of the interface dependency indicators, calculating a health score of the interface dependency mapping using the interface dependency indicators and the indicator weights, and performing health monitoring on the interface dependency mapping using the health score to obtain a health monitoring result; When the health score is lower than a preset score, the emergency measures of the interface dependency mapping are obtained, the emergency effects of the interface dependency mapping under the emergency measures are analyzed, and the emergency measures are executed according to the emergency effects to complete the health management of the interface dependency mapping and obtain a health management result, wherein the analyzing the emergency effects of the interface dependency mapping under the emergency measures includes: Obtaining an interface dependency indicator corresponding to the interface dependency mapping; Splicing the interface dependency indicator and the emergency measures to obtain splicing data; The following formula is used to extract features from the spliced ​​data to obtain extracted features: ; ; ; ; in, represents the extracted features, represents a convolutional neural network, Represents concatenated data, Indicates The output vector, represents the multi-head attention mechanism, Indicates The output vector, represents the concatenation function, represents a gated recurrent unit, represents the vector output by the gated recurrent unit; According to the extracted features, the probability of the emergency effect of the interface dependency mapping under the emergency measures is calculated using the following formula: ; in, represents the probability of emergency effect, represents the fully connected layer, express function, Represents extracted features; Analyzing the emergency effect of the interface dependency mapping under the emergency measures by using the emergency effect probability; The interface dependency mapping, the security management result, the compatibility management result, the health monitoring result and the health management result are used as the interface dependency management result of the microservice software architecture.

2. The interface dependency management method in the microservice software architecture according to claim 1, characterized in that: The identifying the code calling relationship between each interface code in the interface code includes: According to the return statement, assignment statement, control statement and function call statement in the interface code, identifying the direct call relationship between each interface code in the interface code; Identifying an indirect calling relationship between each interface code in the interface code from the direct calling relationship; The direct calling relationship and the indirect calling relationship are used as code calling relationships.

3. The interface dependency management method in the microservice software architecture according to claim 1, characterized in that: The step of constructing an interface dependency mapping between each of the interfaces to be managed in the interfaces to be managed based on the interface dependency relationship includes: Based on the interface dependency, determining the input end, output end and dependent interface of each of the interfaces to be managed; According to the input end, the output end and the dependent interface, a dependency relationship mapping diagram between each of the interfaces to be managed is established; The dependency relationship mapping diagram is used as an interface dependency mapping between each of the interfaces to be managed.

4. The interface dependency management method in the microservice software architecture according to claim 1, characterized in that: The step of weighting the interface dependency indicator to obtain the indicator weight of the interface dependency indicator includes: Identify positive indicators and negative indicators in the interface dependency indicators; Standardizing the positive indicator and the negative indicator respectively to obtain a standardized indicator; The index entropy value of the standardized index is calculated using the following formula: ; ; in, represents the index entropy value, Indicates Under the standardized indicators The proportion of sample values ​​in this indicator. Indicates The number of sample values ​​under the standardized indicators, Indicates Under the standardized indicators Sample values; According to the indicator entropy value, the indicator weight of the standardized indicator is calculated using the following formula: ; in, represents the indicator weight, represents the index entropy value, Indicates the serial number of the standardized indicator, Indicates the number of normalized indicators.

5. The interface dependency management method in the microservice software architecture according to claim 1, characterized in that: The calculating the health score of the interface dependency mapping by using the interface dependency indicator and the indicator weight includes: Obtaining standardized indicators corresponding to the interface dependency indicators; According to the standardized index and the index weight, the health score of the interface dependency mapping is calculated using the following formula: ; in, represents the health score, represents the indicator weight, Indicates Under the standardized indicators Sample values, Indicates the serial number of the standardized indicator, Indicates the number of normalized indicators.

6. An interface dependency management system in a microservice software architecture, characterized in that: Used to execute the interface dependency management method in the microservice software architecture according to any one of claims 1 to 5, the system comprises: A mapping construction module is used to obtain the interface code of the interface to be managed in the microservice software architecture, analyze the interface dependency relationship between each interface to be managed in the interface to be managed by using the interface code, and construct an interface dependency mapping between each interface to be managed in the interface to be managed based on the interface dependency relationship, wherein the interface dependency relationship between each interface to be managed in the interface to be managed by using the interface code includes: Identifying a code calling relationship between each interface code in the interface code; Identifying target codes in the interface codes belonging to the same interface to be managed; Querying the code breakpoints of the target code by using the code calling relationship; According to the code breakpoint, the interface dependency relationship between each of the interfaces to be managed is generated using the following format: ; ; ; ; ; in, Indicates interface dependencies. Indicates interfaces to be managed, Indicates The target code of the interface to be managed, , Indicates A code breakpoint in the target code of the interface to be managed, Indicates interfaces to be managed, Indicates interfaces to be managed, Indicates The target code of the interface to be managed, Indicates The target code of the interface to be managed, Indicates the length of the code call relationship of the interface code, express , , The code calling relationship between them; A security management module is used to obtain whitelist users and current users of the interface dependency mapping, collect historical usage logs of the interface dependency mapping by the whitelist users, identify current usage logs of the interface dependency mapping by the current user, and perform security management on the interface dependency mapping based on the historical usage logs and the current usage logs to obtain a security management result, wherein the security management of the interface dependency mapping based on the historical usage logs and the current usage logs to obtain a security management result includes: The historical usage log is converted into a historical vector using the following formula: ; in, represents the history vector, Indicates historical usage logs. Represents a natural language processing model based on deep learning; Converting the current usage log into a current vector; Calculating the vector similarity between the historical vector and the current vector; When the vector similarity is greater than a preset similarity, determining that the interface dependency mapping is in a safe state, and maintaining security monitoring of the interface dependency mapping based on the safe state to obtain a first security management result; When the vector similarity is not greater than a preset similarity, determining that the interface dependency mapping is in an unsafe state, and restricting access to the current user corresponding to the current use log based on the unsafe state, to obtain a second security management result; A compatibility management module is used to obtain a new version product of the microservice software architecture, query the service dependency mapping of the new version product, detect whether there is a merge conflict between the interface dependency mapping and the service dependency mapping, so as to complete the compatibility management of the interface dependency mapping and obtain a compatibility management result, wherein the detection of whether there is a merge conflict between the interface dependency mapping and the service dependency mapping includes: Respectively obtaining the interface dependency code and the service dependency code of the interface dependency mapping and the service dependency mapping; The interface dependency code is converted into an interface dependency vector using the following formula: ; in, Represents the interface dependency vector, Indicates interface dependent code, Represents a code language processing model based on deep learning; Converting the service dependency code into a service dependency vector; Randomly combining the interface dependency vector and the service dependency vector to obtain a combination vector; Constructing a Markov chain library of the combination vectors; Calculating the Markov probability corresponding to the combined vector according to the Markov chain library; When the Markov probability is greater than a preset probability value, determining that there is no merge conflict between the interface dependency mapping and the service dependency mapping; When the Markov probability is not greater than a preset probability value, determining that there is a merge conflict between the interface dependency mapping and the service dependency mapping; A health monitoring module is used to collect interface dependency indicators of the interface dependency mapping, perform indicator weighting on the interface dependency indicators to obtain the indicator weights of the interface dependency indicators, calculate the health score of the interface dependency mapping using the interface dependency indicators and the indicator weights, perform health monitoring on the interface dependency mapping using the health score, and obtain a health monitoring result; A health management module is used to obtain the emergency measures of the interface dependency mapping when the health score is lower than a preset score, analyze the emergency effect of the interface dependency mapping under the emergency measures, and execute the emergency measures according to the emergency effect to complete the health management of the interface dependency mapping and obtain a health management result, wherein the analysis of the emergency effect of the interface dependency mapping under the emergency measures includes: Obtaining an interface dependency indicator corresponding to the interface dependency mapping; Splicing the interface dependency indicator and the emergency measures to obtain splicing data; The following formula is used to extract features from the spliced ​​data to obtain extracted features: ; ; ; ; in, represents the extracted features, represents a convolutional neural network, Represents concatenated data, Indicates The output vector, represents the multi-head attention mechanism, Indicates The output vector, represents the concatenation function, represents a gated recurrent unit, represents the vector output by the gated recurrent unit; According to the extracted features, the probability of the emergency effect of the interface dependency mapping under the emergency measures is calculated using the following formula: ; in, represents the probability of emergency effect, represents the fully connected layer, express function, Represents extracted features; Analyzing the emergency effect of the interface dependency mapping under the emergency measures by using the emergency effect probability; A dependency management module is used to use the interface dependency mapping, the security management result, the compatibility management result, the health monitoring result and the health management result as the interface dependency management result of the microservice software architecture.

Citation Information

Patent Citations

  • Micro-service performance diagnosis method and system based on dependency graph

    CN115118621A

  • Microservice update system

    US20200348921A1