Microservice deployment method oriented to heterogeneity based on greedy algorithm

Through a heterogeneous microservice deployment method based on greedy algorithms, the problem of insufficient passive defense mechanism and deployment in the microservice architecture is solved, and efficient microservice heterogeneous deployment and system resistance to attacks is achieved.

CN119892840AActive Publication Date: 2025-04-25HARBIN INST OF TECH
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202510049469.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-13
Publication Date
2025-04-25
Estimated Expiration
2045-01-13

AI Technical Summary

Technical Problem

In microservice architecture, the existing technology lacks research and application of passive defense mechanisms, and the deployment problem during microservice updates has not been effectively solved, making it difficult for the system to resist or delay attacks when attacked.

Method used

Using a heterogeneous microservice deployment method based on greedy algorithms, by calculating the remaining resources of each node and numbering in order of resources from more to less, microservices are attempted to deploy microservices according to the order of node ranking until the residual deployment of each microservice function is μ or marked as no longer deployed on all nodes, and then the remaining microservice instances are deployed using the traditional greedy algorithm.

Benefits of technology

A method of quantitatively evaluating the heterogeneity of microservice systems is realized, and the deployment capability of microservice heterogeneity under resource limitations is improved. It can adapt to different needs and ensure that the system has strong resistance and ability to delay attacks when attacked.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119892840A_ABST
    Figure CN119892840A_ABST
Patent Text Reader

Abstract

The invention discloses an isomerism-oriented micro-service deployment method based on a greedy algorithm, and the method comprises the following steps: S1, calculating the residual resource quantity of each node, and numbering according to the sequence of the residual quantity from large to small; s2, trying to deploy one micro-service in each micro-service function in sequence on the node according to the ranking sequence of the nodes, and if deployment of a certain micro-service on a certain node fails, not deploying the micro-service function to which the micro-service belongs on the node; s3, returning to the step S1 until the residual deployment amount of each micro-service function is mu, or marking each micro-service function to be no longer deployed at all nodes; s4, using a traditional greedy algorithm to deploy remaining micro-service instances; and S5, ending deployment, and judging whether a result accords with a constraint or not. According to the invention, a plurality of micro-service instances with different functions can be deployed in a plurality of nodes according to requirements, and high micro-service isomerism can be obtained under the condition of strong resource limitation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of computer services, and relates to a microservice deployment method, and in particular to a heterogeneity-oriented microservice deployment method based on a greedy algorithm. Background Art

[0002] Microservice technology has become the mainstream architecture model in the field of software development and deployment. Compared with the traditional monolithic architecture, the microservice architecture breaks down a complete application into multiple independent service modules, so that each module can be independently developed, deployed and expanded. This loosely coupled architecture greatly improves the flexibility, maintainability and scalability of the system. Each microservice is only developed and built around a specific business and interacts through lightweight communication mechanisms (such as HTTP / REST, gRPC, message queues, etc.).

[0003] With the widespread use of microservice technology, the security of microservices has become a very important issue. The security of microservice architecture mainly involves external access security, inter-service communication security, etc. The defense mechanism against attacks can be divided into two types, namely active defense and passive defense. Active defense is a preventive security strategy. Its core idea is to take measures to prevent potential threats before an attack occurs; passive defense focuses on identification, response and recovery after an attack. At present, the research on active defense has been quite in-depth, such as the use of authentication and authorization systems (OAuth, JWT, etc.), and has been widely used in practice. However, the research and application of passive defense are still insufficient.

[0004] In addition, thanks to the characteristics of the microservice architecture, each module can be developed and deployed independently, and the number of deployments is flexible. This also brings about deployment issues when microservices are updated, that is, how and how many of the original old versions of microservices should be replaced when deploying a new version of the microservice.

[0005] Based on the above research background, it can be found that a passive defense strategy is needed to protect the microservice system, ensuring that the system still has a certain ability to resist or delay attacks when active defense fails. At the same time, the passive defense strategy can take advantage of the fact that microservices can deploy multiple different versions of microservices at the same time. One of the goals of passive defense is to reduce the loss after being attacked. If the microservices are highly homogenized, even if they use the same image, software version, etc., the vulnerabilities they have are also the same, which will allow attackers to easily destroy the entire microservice system through lateral attacks. Summary of the invention

[0006] In order to solve the problems existing in the background technology, the present invention provides a heterogeneity-oriented microservice deployment method based on a greedy algorithm. The present invention is applicable to the situation where there are different versions of microservices providing the same function. By modeling the node resources and the resources occupied by the microservices, a real-time deployment plan is generated in combination with the deployment method proposed by the present invention.

[0007] The objective of the present invention is achieved through the following technical solutions:

[0008] A heterogeneity-oriented microservice deployment method based on a greedy algorithm includes the following steps:

[0009] Step S1, calculate the remaining resources of each node, and number them in order from most to least remaining, recorded as vector α, whose subscript corresponds to the node number, and its stored value corresponds to the ranking;

[0010] Step S2: According to the order of node ranking α, try to deploy one microservice in each microservice function on the node in turn. If a microservice deployment on a node fails, the microservice function to which the microservice belongs will no longer be deployed on the node;

[0011] Step S3: After executing step S2, return to step S1 until the remaining deployment amount of each microservice function is μ, or each microservice function is marked as no longer deployed on all nodes;

[0012] Step S4: Use the traditional greedy algorithm to deploy the remaining microservice instances, that is, deploy the remaining microservices one by one in the direction with the greatest comprehensive heterogeneity;

[0013] Step S5: End the deployment and determine whether the result meets the constraints.

[0014] Compared with the prior art, the present invention has the following advantages:

[0015] 1. The present invention provides a method for quantitatively evaluating the heterogeneity of a microservice system, and uses species uniformity in biology to define the heterogeneity of a microservice system.

[0016] 2. The present invention proposes a deployment scheme algorithm that can deploy multiple microservice instances with different functions in multiple nodes as needed, and obtain higher microservice heterogeneity under strong resource constraints.

[0017] 3. The deployment method of the present invention can adapt to different needs by adjusting the residual deployment amount μ. When the structures of the nodes are similar (that is, the difference in the amount of resources between the nodes is small), it is suitable to use a smaller μ to obtain faster speed while ensuring heterogeneity; when the structures of the nodes are greatly different (for example, in a cloud-edge environment), it is suitable to use a larger μ to obtain a better solution.

[0018] 4. The deployment method of the present invention can complete the calculation in real time. After testing, the calculation speed of the deployment method is significantly faster than that of the pure greedy algorithm, and the quality of its solution is close to that of the solutions obtained by the greedy algorithm and the Cp solver. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 Flowchart of computational methods for synthesizing heterogeneity in microservice systems;

[0020] Figure 2 Flowchart of the heterogeneity-oriented microservice deployment method based on the greedy algorithm. DETAILED DESCRIPTION

[0021] The technical solution of the present invention is further described below in conjunction with the accompanying drawings, but is not limited thereto. Any modification or equivalent replacement of the technical solution of the present invention without departing from the spirit and scope of the technical solution of the present invention should be included in the protection scope of the present invention.

[0022] The present invention provides a method for calculating the comprehensive heterogeneity of a microservice system. Figure 1 As shown, the method comprises the following steps:

[0023] Step 1: Microservice Function Set S i All microservices that provide microservice functionality i i,j The set is represented as:

[0024]

[0025] Among them, |S i |The number of microservice types representing microservice function i, N func Represents the number of microservice function sets.

[0026] Step 2: Microservices i,j Belongs to the microservice function set S i , which has multiple attributes, including software attributes: software version v i,j 、Container imagei i,j , programming language i,j , Resource attributes: processor usage p i,j 、Memory usage m i,j , Disk space usage d i,j , expressed as:

[0027] s i,j = <v i,j ,i i,j ,l i,j ,p i,j ,m i,j ,d i,j >

[0028] Step 3: The user initiates a request to the microservice function set S i The system distributes the request to microservices i,j in an instance of .

[0029] Step 4: Nodes can deploy multiple different or the same microservices i,j , which also has resource attributes: processor resource amount p Nk 、Memory resource amount m Nk , Disk space resources d Nk , expressed as:

[0030] N k = <p Nk ,m Nk ,d Nk >

[0031] Step 5: Calculate the heterogeneity of microservices by referring to the calculation method of species evenness. Species evenness is defined based on the Shannon-Wiener Diversity Index, where:

[0032] The Shannon-Wiener index H' borrows the method of information theory to describe the heterogeneity of the community. Its form is as follows:

[0033]

[0034] Among them, S' represents the total number of species, p i Represents the proportion of the i-th species in the total. When there is only one species in the community, H' reaches its minimum value of 0, and when there are more than one species in the community and the number of individuals of the species is equal, H' reaches its maximum value of lnS'.

[0035] The species uniformity is essentially the normalized Shannon-Wiener index J:

[0036]

[0037] Based on the definition of species evenness, |S i |The number of types of microservices representing microservice function i, θ i,j represents the proportion of microservice j in the total number of examples, |s i,j | represents the number of instances of microservice j that provides microservice function i, Sum i Represents the total number of instances of microservice function i. The definition of species evenness is extended to measure the heterogeneity of microservices of a certain function:

[0038]

[0039] Among them, η i Represents the heterogeneity of microservice function i.

[0040] On this basis, the heterogeneity of microservices with different functions is weighted averaged to obtain the system heterogeneity index H for the entire microservice system. ms :

[0041]

[0042] Among them, N func Represents the number of microservice function sets, γ i Represents the proportion of instances of microservice function i in the total set of functions.

[0043] Similarly, when limiting the scope from the entire microservice system to a certain node, we can also define the node heterogeneity index H node :

[0044]

[0045] Among them, the superscript Ni represents confinement to node i, for example Represents the heterogeneity of microservice function j in node i.

[0046] Combining the above system heterogeneity indicators and node heterogeneity indicators, we can get the comprehensive heterogeneity index H of the microservice system:

[0047] H=H ms +H node ,H∈[0,2]

[0048] When there is only one microservice function set in the microservice system, H reaches its minimum value, and when there is more than one microservice function set in the community and the number of instances contained in each microservice function set is equal, H reaches its maximum value of 2.

[0049] The present invention provides a heterogeneity-oriented microservice deployment method based on a greedy algorithm. The ideological basis of the method is to use a greedy algorithm to deploy microservices one by one, and each deployment makes the comprehensive heterogeneity after deployment the highest. However, according to the aforementioned heterogeneity calculation method, when the number of deployment instances and the number of nodes are large, the timeliness of the pure greedy algorithm is relatively lacking, which is mainly reflected in the fact that it takes too long to perform a large number of heterogeneous calculations. In addition, it can be noted that in the early stage of deployment, the amount of resources remaining in the node is much larger than the amount of resources required for each microservice. Therefore, this method divides the deployment into two parts. When each microservice function has μ instances remaining undeployed (the remaining deployment amount is μ), the greedy algorithm is used for deployment. In the first part, since the remaining resources can be regarded as sufficient, the microservices are evenly deployed (that is, the number of instances of each microservice in the microservice function is equal). As Figure 2 As shown, the specific steps include:

[0050] Step S1, calculate the remaining resources of each node, and number them in order from most to least, recorded as vector α, whose subscript corresponds to the node number, and the value stored corresponds to the ranking. For example, there are three nodes A, B, and C, whose remaining resources are a, b, and c respectively, and b>a>c, and are numbered 0, 1, and 2; then α=[1,0,2], which means that node B has the most resources and ranks first, and node C has the least resources and ranks last.

[0051] Step S2: According to the order of node ranking α, try to deploy one microservice in each microservice function on the node in turn. If the example in step S1 is used, the microservices are deployed in the order of B, A, and C. Try to deploy them evenly each time to maintain their heterogeneity. If a microservice fails to be deployed on a node (for example, insufficient resources), the microservice function to which the microservice belongs is marked and will no longer be deployed on the node. The purpose of stopping deployment is to keep the heterogeneity of the microservice function on the current node from deteriorating. If the deployment continues, it may cause too many microservice instances with small resource occupancy, thereby reducing the heterogeneity.

[0052] Step S3: Return to step S1 until the remaining deployment amount of each microservice function is μ, or all nodes are marked as no longer deployed.

[0053] Step S4: Use the traditional greedy algorithm to deploy the remaining microservice instances, that is, deploy the remaining microservices one by one in the direction with the greatest comprehensive heterogeneity.

[0054] Step S5: End the deployment and determine whether the result meets the constraints.

Claims

1. A method for calculating the comprehensive heterogeneity of a microservice system, characterized in that The method comprises the following steps: Step 1: Microservice Function Set S i All microservices that provide microservice functionality i i,j The set is represented as: Among them, |S i |The number of microservice types representing microservice function i, N func Represents the number of microservice function sets; Step 2: Microservices i,j Belongs to the microservice function set S i , which has multiple attributes, including software attributes: software version v i,j 、Container imagei i,j , programming language i,j , Resource attributes: processor usage p i,j 、Memory usage m i,j , Disk space usage d i,j , expressed as: s i,j =<v i,j ,i i,j ,l i,j ,p i,j ,m i,j ,d i,j > Step 3: The user initiates a request to the microservice function set S i The system distributes the request to microservices i,j In an instance of Step 4: Deploy multiple different or identical microservices on the node i,j , which has resource attributes: processor resource amount p Nk 、Memory resource amount m Nk , Disk space resources d Nk , expressed as: N k =<p Nk ,m Nk ,d Nk > Step 5: Calculate the heterogeneity of microservices by referring to the calculation method of species homogeneity. The species homogeneity is defined based on the Shannon-Wiener index, where: The Shannon-Wiener index H' describes the heterogeneity of a community and has the following form: Among them, S' represents the total number of species, p i represents the proportion of the i-th species in the total; Species uniformity is essentially the normalized Shannon-Wiener index J: Based on the definition of species evenness, |S i |The number of types of microservices representing microservice function i, θ i,j represents the proportion of microservice j in the total number of examples, |s i,j | represents the number of instances of microservice j that provides microservice function i, Sum i Represents the total number of instances of microservice function i, extending the definition of species evenness to measure the heterogeneity of microservices for a certain function: Among them, η i Represents the heterogeneity of microservice function i; The heterogeneity of microservices with different functions is weighted averaged to obtain the system heterogeneity index H for the entire microservice system. ms : Among them, N func Represents the number of microservice function sets, γ i Represents the proportion of instances of microservice function i in the total set of functions; Similarly, when limiting the scope from the entire microservice system to a certain node, the node heterogeneity index H is defined node : Among them, the superscript Ni represents confinement to node i, represents the heterogeneity of microservice function j in node i; Combining the above system heterogeneity indicators and node heterogeneity indicators, we get the comprehensive heterogeneity index H of the microservice system: H=H ms +H node ,H∈[0,2]。 2. The method for calculating the comprehensive heterogeneity of a microservice system according to claim 1, characterized in that When there is only one microservice function set in the microservice system, H reaches its minimum value of 0. When there is more than one microservice function set in the community and the number of instances contained in each microservice function set is equal, H reaches its maximum value of 2.

3. A heterogeneous microservice deployment method based on a greedy algorithm, characterized in that The method comprises the following steps: Step S1, calculate the remaining resources of each node, and number them in order from most to least remaining, recorded as vector α, whose subscript corresponds to the node number, and its stored value corresponds to the ranking; Step S2: According to the order of node ranking α, try to deploy one microservice in each microservice function on the node in turn. If a microservice deployment on a node fails, the microservice function to which the microservice belongs will no longer be deployed on the node; Step S3: After executing step S2, return to step S1 until the remaining deployment amount of each microservice function is μ, or each microservice function is marked as no longer deployed on all nodes; Step S4: deploy the remaining microservice instances using a traditional greedy algorithm, that is, deploy the remaining microservices one by one in the direction with the largest comprehensive heterogeneity calculated by the method of claim 1; Step S5: End the deployment and determine whether the result meets the constraints.

Citation Information

Patent Citations

  • Task and resource awareness-oriented micro-service deployment method

    CN111736983A

  • Data processing method, device and equipment and computer readable storage medium

    CN113762514A

  • Containerized micro-service orchestration method and system for cloud edge heterogeneous environment, and medium

    CN114138486A

  • Micro-service deployment and routing method based on network edge system

    CN114338504A

  • Service credible providing system and method for decentralized network resources

    CN116016550A