Path-based micro-service stability scoring method
By defining the influence coefficient, failure coefficient and difficulty coefficient in the microservice cluster, calculating the risk coefficient and stability, identifying and managing key services, the problem of increasing the difficulty and stability of microservice governance is solved, and the stability of the microservice cluster is achieved. Scoring and governance, reducing the difficulty of governance and improving stability and maintainability.
Patent Information
- Application Number
- CN202410755725.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-12
- Publication Date
- 2024-09-17
AI Technical Summary
In a microservice cluster, a single microservice failure will cause dependent service anomalies, which increases the difficulty and complexity of microservice governance. It is difficult to effectively evaluate and improve the stability of microservices with existing technology.
By defining the influence coefficient, failure coefficient and difficulty coefficient of the service, the risk coefficient and stability of the microservice are calculated, and path modeling is used to decompose dependencies, and a path-based microservice stability scoring method is provided for identification and governance. Key services, reducing governance difficulty and improving stability.
It realizes the quantification and ranking of microservice stability, reduces the difficulty of microservice governance, improves the stability of microservice clusters and the timeliness and maintainability of governance, and promotes the sustainable development of distributed software.
Smart Images

Figure CN118656281A
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of microservices and distributed systems, and in particular to a path-based microservice stability scoring method. Background Art
[0002] The characteristic of microservice architecture is distributed deployment. The complete functions provided by a certain function are completed by multiple microservices, and each service has a dependency relationship. Microservices are suitable for massive business scenarios and support high QPS and TPS. The stability of a single service only needs to focus on one service, while the microservice cluster architecture needs to observe the working conditions of hundreds or thousands of microservice nodes in the cluster. If a microservice fails, other services that depend on this microservice will also work abnormally. Therefore, if the stability of services in the microservice cluster can be scored, and the focus is on the stability of these key services, and governance measures are used to increase the stability of these services, the difficulty of governing the entire microservice cluster can be reduced, and the stability of the entire microservice cluster can be quickly improved.
[0003] Based on this, the present invention discloses a path-based microservice stability scoring method to solve the problem of microservice governance difficulties. Summary of the invention
[0004] The purpose of the present invention is to provide a path-based microservice stability scoring method to solve the problems raised in the above background technology.
[0005] To achieve the above object, the present invention provides the following technical solution: a path-based microservice stability scoring method, comprising the following steps:
[0006] Step S1, define the service impact coefficient formula: the impact coefficient of service a is recorded as f(a), which represents the impact degree of related dependent services if service a is abnormal;
[0007] Step S2, define the failure coefficient formula of the service: the failure coefficient of service a is recorded as g(a), which means that if service a is abnormal, it is caused by itself or the dependent service;
[0008] Step S3, define the service difficulty coefficient formula: complexity is used to represent the difficulty coefficient of microservice governance. The difficulty coefficient is defined by manual method. Specifically, h(a) represents the difficulty of service a, and three levels are defined by manual judgment: h(a) = 3, indicating high complexity; h(a) = 2, indicating medium complexity; h(a) = 1, indicating low complexity;
[0009] Step S4: Calculate the influence coefficient, the failure coefficient, and the difficulty coefficient. The calculation process is as follows:
[0010] (1) The service dependencies are collected as a set of two-tuples. Specifically, (a, b) means that service a depends on service b. For a set U containing n services, S(a) and T(a) are calculated based on the set of two-tuples, where S(a) is the set of 1-layer direct dependent services of the impact coefficient that depends on a, and T(a) is the set of 1-layer direct dependent services of the failure coefficient that depends on a;
[0011] (2) Data initialization, Initialize f(a) = g(a) = 1, h(a) is manually specified;
[0012] (3) Perform a calculation process, wherein the calculation process is to first calculate f(a) according to the formula of step S1, and then calculate g(a) according to the formula of step S2;
[0013] (4) Repeat the calculation process m times, setting m = k + 1;
[0014] Step S5, calculate the risk coefficient of the microservice: the risk coefficient formula of the microservice is L(a)=f(a)*g(a)*h(a), L(a) is the risk coefficient of service a, where the larger the value, the higher the risk and the worse the stability; the lower the value, the lower the risk and the better the stability;
[0015] Step S6, calculating the stability of the microservice: the stability formula of the microservice is R(a)=ω / L(a), where ω is a preset parameter, and the larger the value, the higher the stability;
[0016] Step S7: Improve the stability of microservices.
[0017] Preferably, the specific calculation process of the service influence coefficient formula in step S1 is:
[0018] Suppose services b1 and b2 directly depend on service a; service b3 depends on service b2; service b4 depends on service b3; service b5 depends on service b4, and services b3, b4, and b5 indirectly depend on service a. Only 1 layer of direct dependency and k layers of indirect dependency are calculated. When calculating f(a), indirect dependencies greater than k layers are not considered.
[0019] The first layer of direct dependency service set of dependency a is denoted as S1, the second layer of dependency is the first layer of indirect dependency, this service set is denoted as S2, and so on, the k+1th layer of dependency is the kth layer of indirect service dependency set, which is denoted as S k+1 , where b1∈S1, b2∈S1, b3∈S2, b4∈S3, b5∈S4, …;
[0020] The calculation formula of the influence coefficient f(a) of service a is: In the formula, α0, α1…, α k+1It is the preset influence parameter of each layer, α t >α t+1 , t∈[0,k], the influence effect decreases layer by layer.
[0021] Preferably, the specific calculation process of the failure coefficient formula of the service in step S2 is:
[0022] Suppose service a directly depends on c1 and c2; service c2 depends on service c3; service c3 depends on service c4; service c4 depends on service c5. Service a indirectly depends on services c3, c4, and c5. Only one layer of direct dependency and k layers of indirect dependency are calculated. Indirect dependencies greater than k layers are not considered when calculating g(a).
[0023] The first layer of direct dependency service set of dependency a is denoted as T1, the second layer of dependency is the first layer of indirect dependency, this service set is denoted as T2, and so on, the k+1th layer of dependency is the kth layer of indirect service dependency set, which is denoted as T k+1 , where c1∈T1, c2∈T1, c3∈T2, c4∈T3, c5∈T4, …; the failure coefficient g(a) of service a is calculated as: Where, β0, β1…, β k+1 is the preset fault parameter for each layer, β t >β t+1 , t∈[0,k], the fault effect decreases layer by layer.
[0024] Preferably, the stability of the microservices in step S7 is improved specifically for services with high risk coefficients. If service a has a high risk coefficient and low stability, the stability is improved by the following three methods:
[0025] (a) Govern by impact coefficient. Check the service set S(a) affected by this service, find the service with the largest risk coefficient, govern this service, reduce its external dependence, and reduce the difficulty coefficient of this service according to (c);
[0026] (b) Govern according to the failure coefficient. Check the service set T(a) that this service depends on, find the service with the largest failure coefficient, govern this service, reduce the dependence of this service on other services, and reduce the difficulty coefficient of this service according to (c);
[0027] (c) Manage by difficulty level, check and adjust the code and technical solutions of service a to reduce the difficulty level of this service.
[0028] Compared with the prior art, the beneficial effects of the present invention are as follows: the present invention provides a path-based microservice stability scoring method to solve the governance problems of microservices and distributed systems. The method models the microservice dependency path and decomposes it into an impact coefficient, a failure coefficient, and a difficulty coefficient, thereby calculating the risk coefficient and stability. The risk coefficient is inversely proportional to the stability.
[0029] The advantage of this method is that it quantifies and ranks the stability of microservices, calculates the stability based on the dependency path, and manages the stability of a single microservice based on this, thereby improving the stability of the entire microservice cluster.
[0030] In summary, the path-based microservice stability scoring method has the advantages of data quantification, identification of the main contradictions of the system, and identification of the three reasons for the difficulty of service governance. It reduces the difficulty of microservice governance, enhances the timeliness and maintainability of service governance, and promotes the sustainable development of distributed software. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 It is a schematic diagram of the method flow of the present invention;
[0032] Figure 2 A schematic diagram of the structure of the service of the present invention;
[0033] Figure 3 A schematic diagram of a fault structure of the service of the present invention. DETAILED DESCRIPTION
[0034] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0035] In the description of the present invention, it should be noted that the terms "vertical", "up", "down", "horizontal", etc. indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention.
[0036] In the description of the present invention, it is also necessary to explain that, unless otherwise clearly specified and limited, the terms "set", "install", "connect", and "connect" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0037] See also Figure 1-3The present invention provides a technical solution: a path-based microservice stability scoring method, comprising the following steps:
[0038] Step S1, define the service impact coefficient formula: the impact coefficient of service a is recorded as f(a), which represents the impact degree of related dependent services if service a is abnormal;
[0039] Step S2, define the failure coefficient formula of the service: the failure coefficient of service a is recorded as g(a), which means that if service a is abnormal, it is caused by itself or the dependent service;
[0040] Step S3, define the service difficulty coefficient formula: complexity is used to represent the difficulty coefficient of microservice governance. The difficulty coefficient is defined by manual method. Specifically, h(a) represents the difficulty of service a, and three levels are defined by manual judgment: h(a) = 3, indicating high complexity; h(a) = 2, indicating medium complexity; h(a) = 1, indicating low complexity;
[0041] Step S4: Calculate the influence coefficient, the failure coefficient, and the difficulty coefficient. The calculation process is as follows:
[0042] (1) The service dependencies are collected as a set of two-tuples. Specifically, (a, b) means that service a depends on service b. For a set U containing n services, S(a) and T(a) are calculated based on the set of two-tuples, where S(a) is the set of 1-layer direct dependent services of the impact coefficient that depends on a, and T(a) is the set of 1-layer direct dependent services of the failure coefficient that depends on a;
[0043] (2) Data initialization, Initialize f(a) = g(a) = 1, h(a) is manually specified;
[0044] (3) Perform a calculation process, wherein the calculation process is to first calculate f(a) according to the formula of step S1, and then calculate g(a) according to the formula of step S2;
[0045] (4) Repeat the calculation process m times, setting m = k + 1;
[0046] Step S5, calculate the risk coefficient of the microservice: the risk coefficient formula of the microservice is L(a)=f(a)*g(a)*h(a), L(a) is the risk coefficient of service a, where the larger the value, the higher the risk and the worse the stability; the lower the value, the lower the risk and the better the stability;
[0047] Step S6, calculating the stability of the microservice: the stability formula of the microservice is R(a)=ω / L(a), where ω is a preset parameter, and the larger the value, the higher the stability;
[0048] Step S7: Improve the stability of microservices.
[0049] Furthermore, the specific calculation process of the service influence coefficient formula in step S1 is:
[0050] Suppose services b1 and b2 directly depend on service a; service b3 depends on service b2; service b4 depends on service b3; service b5 depends on service b4, and services b3, b4, and b5 indirectly depend on service a. Only one layer of direct dependency and k layers of indirect dependency are calculated. When calculating f(a), indirect dependencies greater than k layers are not considered. For example, Figure 2 k = 3;
[0051] The first layer of direct dependency service set of dependency a is denoted as S1, the second layer of dependency is the first layer of indirect dependency, this service set is denoted as S2, and so on, the k+1th layer of dependency is the kth layer of indirect service dependency set, which is denoted as S k+1 , where b1∈S1, b2∈S1, b3∈S2, b4∈S3, b5∈S4, …;
[0052] The calculation formula of the influence coefficient f(a) of service a is: In the formula, α0, α1…, α k+1 It is the preset influence parameter of each layer, α t >α t+1 , t∈[0,k], the influence effect decreases layer by layer.
[0053] like Figure 2 For example, f(a)=α0+f(b1)α1+f(b2)α1+f(b3)α2+f(b4)α3+f(b5)α4.
[0054] Furthermore, the specific calculation process of the failure coefficient formula of the service in step S2 is:
[0055] Suppose service a directly depends on c1 and c2; service c2 depends on service c3; service c3 depends on service c4; service c4 depends on service c5. Service a indirectly depends on services c3, c4, and c5. Only one layer of direct dependency and k layers of indirect dependency are calculated. When calculating g(a), indirect dependencies greater than k layers are not considered. For example, Figure 3 In, k = 3;
[0056] The first layer of direct dependency service set of dependency a is denoted as T1, the second layer of dependency is the first layer of indirect dependency, this service set is denoted as T2, and so on, the k+1th layer of dependency is the kth layer of indirect service dependency set, which is denoted as T k+1 , where c1∈T1, c2∈T1, c3∈T2, c4∈T3, c5∈T4, …; the failure coefficient g(a) of service a is calculated as: Where, β0, β1…, β k+1is the preset fault parameter for each layer, β t >β t+1 , t∈[0,k], the fault effect decreases layer by layer.
[0057] like Figure 3 For example, g(a)=β0+g(c1)β1+g(c2)β1+g(c3)β2+g(c4)β3+g(c5)β4.
[0058] Furthermore, in step S7, the stability of microservices is improved specifically for services with high risk coefficients. If service a has a high risk coefficient and low stability, the stability can be improved by the following three methods:
[0059] (a) Govern by impact coefficient. Check the service set S(a) affected by this service, find the service with the largest risk coefficient, govern this service, reduce its external dependence, and reduce the difficulty coefficient of this service according to (c);
[0060] (b) Govern according to the failure coefficient. Check the service set T(a) that this service depends on, find the service with the largest failure coefficient, govern this service, reduce the dependence of this service on other services, and reduce the difficulty coefficient of this service according to (c);
[0061] (c) Manage by difficulty level, check and adjust the code and technical solutions of service a to reduce the difficulty level of this service.
[0062] The present invention provides a path-based microservice stability scoring method to solve the governance problems of microservices and distributed systems. The method models the microservice dependency path and decomposes it into an impact coefficient, a failure coefficient, and a difficulty coefficient, thereby calculating the risk coefficient and stability, and the risk coefficient and stability are inversely proportional; by quantifying and ranking the stability of microservices, the stability is calculated according to the dependency path, and based on this, the stability of a single microservice can be governed, thereby improving the stability of the entire microservice cluster; in summary, the path-based microservice stability scoring method has the advantages of data quantification, identification of the main contradictions of the system, and identification of three reasons for the difficulty of service governance, which reduces the difficulty of microservice governance, enhances the timeliness and maintainability of service governance, and promotes the sustainable development of distributed software.
[0063] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A path-based microservice stability scoring method, characterized in that: The following steps are involved: Step S1, define the service impact coefficient formula: the impact coefficient of service a is recorded as f(a), which represents the impact degree of related dependent services if service a is abnormal; Step S2, define the failure coefficient formula of the service: the failure coefficient of service a is recorded as g(a), which means that if service a is abnormal, it is caused by itself or the dependent service; Step S3, define the service difficulty coefficient formula: complexity is used to represent the difficulty coefficient of microservice governance. The difficulty coefficient is defined by manual method. Specifically, h(a) represents the difficulty of service a, and three levels are defined by manual judgment: h(a) = 3, indicating high complexity; h(a) = 2, indicating medium complexity; h(a) = 1, indicating low complexity; Step S4: Calculate the influence coefficient, the failure coefficient, and the difficulty coefficient. The calculation process is as follows: (1) The service dependencies are collected as a set of two-tuples. Specifically, (a, b) means that service a depends on service b. For a set U containing n services, S(a) and T(a) are calculated based on the set of two-tuples, where S(a) is the set of 1-layer direct dependent services of the impact coefficient that depends on a, and T(a) is the set of 1-layer direct dependent services of the failure coefficient that depends on a; (2) Data initialization, Initialize f(a) = g(a) = 1, h(a) is manually specified; (3) Perform a calculation process, wherein the calculation process is to first calculate f(a) according to the formula of step S1, and then calculate g(a) according to the formula of step S2; (4) Repeat the calculation process m times, setting m = k + 1; Step S5, calculate the risk coefficient of the microservice: the risk coefficient formula of the microservice is L(a)=f(a)*g(a)*h(a), L(a) is the risk coefficient of service a, where the larger the value, the higher the risk and the worse the stability; the lower the value, the lower the risk and the better the stability; Step S6, calculating the stability of the microservice: the stability formula of the microservice is R(a)=ω / L(a), where ω is a preset parameter, and the larger the value, the higher the stability; Step S7: Improve the stability of microservices.
2. According to a path-based microservice stability scoring method according to claim 1, it is characterized by: The specific calculation process of the service influence coefficient formula in step S1 is: Suppose services b1 and b2 directly depend on service a; service b3 depends on service b2; service b4 depends on service b3; service b5 depends on service b4, and services b3, b4, and b5 indirectly depend on service a. Only 1 layer of direct dependency and k layers of indirect dependency are calculated. When calculating f(a), indirect dependencies greater than k layers are not considered. The first layer of direct dependency service set of dependency a is denoted as S1, the second layer of dependency is the first layer of indirect dependency, this service set is denoted as S2, and so on, the k+1th layer of dependency is the kth layer of indirect service dependency set, which is denoted as S k+1 , where b1∈S1, b2∈S1, b3∈S2, b4∈S3, b5∈S4, …; The calculation formula of the influence coefficient f(a) of service a is: In the formula, α0, α1…, α k+1 It is the preset influence parameter of each layer, α t >α t+1 , t∈[0,k], the influence effect decreases layer by layer.
3. According to a path-based microservice stability scoring method according to claim 1, it is characterized in that: The specific calculation process of the failure coefficient formula of the service in step S2 is: Suppose service a directly depends on c1 and c2; service c2 depends on service c3; service c3 depends on service c4; service c4 depends on service c5. Service a indirectly depends on services c3, c4, and c5. Only one layer of direct dependency and k layers of indirect dependency are calculated. Indirect dependencies greater than k layers are not considered when calculating g(a). The first layer of direct dependency service set of dependency a is denoted as T1, the second layer of dependency is the first layer of indirect dependency, this service set is denoted as T2, and so on, the k+1th layer of dependency is the kth layer of indirect service dependency set, which is denoted as T k+1 , where c1∈T1, c2∈T1, c3∈T2, c4∈T3, c5∈T4, …; the failure coefficient g(a) of service a is calculated as: Where, β0, β1…, β k+1 is the preset fault parameter for each layer, β t >β t+1 , t∈[0,k], the fault effect decreases layer by layer.
4. The path-based microservice stability scoring method according to claim 1 is characterized in that: In step S7, the stability of microservices is improved specifically for services with high risk coefficients. If service a has a high risk coefficient and low stability, the stability can be improved by the following three methods: (a) Govern by impact coefficient. Check the service set S(a) affected by this service, find the service with the largest risk coefficient, govern this service, reduce its external dependence, and reduce the difficulty coefficient of this service according to (c); (b) Govern according to the failure coefficient. Check the service set T(a) that this service depends on, find the service with the largest failure coefficient, govern this service, reduce the dependence of this service on other services, and reduce the difficulty coefficient of this service according to (c); (c) Manage by difficulty level, check and adjust the code and technical solutions of service a to reduce the difficulty level of this service.
