A terminal microservice discovery method based on attractor model

Through the microservice instance discovery method based on the attractor model, the problems of harsh resource allocation and fragmentation in the existing technology are solved, load balancing and resource saving are achieved, and the resource utilization of microservice instances is optimized.

CN115083512BInactive Publication Date: 2024-09-27XI AN JIAOTONG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110263187.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-11
Publication Date
2024-09-27
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing microservice instance resource allocation technology has strict execution conditions and does not consider the heterogeneity of physical servers, resulting in resource fragmentation.

Method used

Using the terminal microservice discovery method based on the attractor model, by calculating the selection probability of microservice instances, dynamically screening out microservice instances suitable for carrying user requests, and recording the number of resource fragments as input parameters for the next model, simulating E. coli lactose Metabolic processes to optimize resource allocation.

Benefits of technology

It achieves load balancing, reduces the fragmentation of physical server resources, saves computing time, and optimizes the resource utilization of microservice instances.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115083512B
    Figure CN115083512B
Patent Text Reader

Abstract

The present invention relates to the field of microservice technology, and in particular to a terminal microservice discovery method based on an attractor model. The selection probability of all microservice instances is calculated based on the attractor model according to input parameters, wherein the selection probability is the probability corresponding to the action of each microservice instance being selected to carry a business; the target selection probability is obtained by using an algorithm to screen the selection probabilities of all microservice instances, and the microservice instance corresponding to the target selection probability is used as the microservice instance carrying the user request. The terminal microservice discovery method based on the attractor model proposed by the present invention solves the problems that the existing resource allocation technology has harsh execution conditions, does not consider the heterogeneity of physical servers, and is prone to physical resource fragmentation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of microservice technology, and in particular to a terminal microservice discovery method based on an attractor model. Background Art

[0002] The goal of the microservice instance discovery algorithm is to determine the microservice instance that carries the user request and provide computing resources for the user business by allocating physical server resources. For the resource allocation technology of microservice instances, the existing methods have harsh execution conditions and do not consider the heterogeneity of physical servers and the problem of physical resource fragmentation. Summary of the invention

[0003] The present invention proposes a terminal microservice discovery method based on an attractor model to solve the problems that the existing resource allocation technology has harsh execution conditions, does not consider the heterogeneity of physical servers and easily causes physical resource fragmentation.

[0004] The technical solution of the present invention to solve the above problem is: a terminal microservice discovery method based on an attractor model, comprising the following steps:

[0005] S1: The selection probability of all microservice instances is calculated based on the attractor model according to the input parameters, where the selection probability is the probability corresponding to the action of each microservice instance being selected to carry the business;

[0006] S2: According to the selection probabilities of all microservice instances, an algorithm is used to screen and obtain a target selection probability, and the microservice instance corresponding to the target selection probability is used as the microservice instance that carries the user request.

[0007] Preferably, the step of selecting the microservice instance corresponding to the probability as the microservice instance that carries the user request in S2 specifically includes:

[0008] Determine the target action corresponding to the target selection probability, where the target action is the action in which the target microservice instance is selected to carry the business;

[0009] The target microservice instance corresponding to the target action is used as the microservice instance that carries the user request.

[0010] Preferably, the method further comprises the following steps:

[0011] The number of resource fragments corresponding to the target action is recorded, and the number of resource fragments is used as an input parameter of the next attractor model.

[0012] Preferably, the attractor model is a model for simulating the kinetic process of lactose metabolism in Escherichia coli, and the step S1 specifically comprises:

[0013] S11: At time T0, the selection probabilities of all microservice instances are initialized;

[0014] S12: In T t At time , the selection probability of all microservice instances is calculated based on the attractor model according to the input parameters, where: the attractor model includes the calculation formula for gene expression level and the calculation formula for the growth rate of Escherichia coli;

[0015] The calculation formula of the gene expression level is expressed as:

[0016]

[0017]

[0018] Among them: the action of each instance being selected to carry the service is recorded as a gene x, and the selection probability is recorded as a gene expression level x i , η i represents Gaussian noise, v g represents the growth rate of E. coli, w ij Represents gene expression level x j x i The influence coefficient of

[0019] The v g The calculation formula is:

[0020]

[0021] Among them: γ, δ, is a fixed parameter, and r is recorded as the number of resource fragments generated in the system.

[0022] Preferably, in the expression of the calculation formula of the gene expression level: θ i and μ are set to 0.5 and 10 respectively.

[0023] Preferably, the v g In the calculation formula, both γ and δ are set to 100. and κ are set to 0.1 and 10.

[0024] Preferably, the algorithm in step 3 is one of a probability selection algorithm, a center of gravity selection algorithm and a random selection algorithm.

[0025] Preferably, when the algorithm is a probability selection algorithm, the probability selection formula is expressed as:

[0026]

[0027] Among them: the action of each instance selected to carry the service is recorded as a gene x, and the probability corresponding to the action is recorded as a gene expression level x i .

[0028] Compared with the prior art, the present invention has the following beneficial effects: the present invention models the problem of discovering microservice instances, redefines the parameters of the attractor model on this basis, uses the microservice instance discovery algorithm based on the attractor model, dynamically selects microservice instances, and carries business needs. The present invention ensures load balancing on physical servers, reduces resource fragmentation, saves physical server resources, and shortens computing time. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 This is a flow chart of the terminal microservice discovery method of the present invention;

[0030] Figure 2 This is a graph showing how resource fragmentation changes over time when the microservice instance specifications are fixed;

[0031] Figure 3 This is a graph showing how resource fragmentation changes over time when the microservice instance specifications change.

[0032] in: Figure 2 , Figure 3 MSV, MSH, MSC and MSA respectively represent: cloudware paas platform, adaptive microservice framework, Docker-based elastic cloud platform and the discovery method of the present invention. DETAILED DESCRIPTION

[0033] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are 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. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention.

[0034] A terminal microservice discovery method based on attractor model, such as Figure 1 As shown, the following steps are included:

[0035] S1: The selection probability of all microservice instances is calculated based on the attractor model according to the input parameters, where the selection probability is the probability corresponding to the action of each microservice instance being selected to carry the business;

[0036] S2: According to the selection probabilities of all microservice instances, an algorithm is used to screen and obtain a target selection probability, and the microservice instance corresponding to the target selection probability is used as the microservice instance that carries the user request.

[0037] The attractor model algorithm selected by the present invention is compared with the existing genetic algorithm, attractor algorithm and gene algorithm. It can dynamically feed back the measurement value of the optimization target to the system according to the dynamic changes of the environment, dynamically solve the optimal solution corresponding to the optimization target, and accurately reflect the changing process of the environment. The attractor model algorithm does not need to understand the information transmission within the system, and the calculation is simple. It can support the terminal microservice discovery algorithm requiring a simple algorithm and fast solution.

[0038] As a preferred embodiment of the present invention, the step of selecting the microservice instance corresponding to the probability as the microservice instance that carries the user request in S2 specifically includes:

[0039] Determine the target action corresponding to the target selection probability, where the target action is the action in which the target microservice instance is selected to carry the business;

[0040] The target microservice instance corresponding to the target action is used as the microservice instance that carries the user request.

[0041] As a preferred embodiment of the present invention, the following steps are also included:

[0042] Record the number of resource fragments corresponding to the target action, and use the number of resource fragments as the input parameter of the next attractor model.

[0043] As a preferred embodiment of the present invention, the attractor model simulates the lactose metabolism process of E. coli and determines the probability of E. coli moving toward the high lactose concentration through simple feedback to solve the dynamic selection problem. The present invention corresponds the lactose metabolism process of E. coli to the microservice instance discovery problem.

[0044] The S1 step specifically includes:

[0045] S11: At time T0, the selection probabilities of all microservice instances are initialized;

[0046] S12: In T t At time , the selection probability of all microservice instances is calculated based on the attractor model according to the input parameters, where: the attractor model includes the calculation formula for gene expression level and the calculation formula for the growth rate of Escherichia coli;

[0047] The calculation formula of the gene expression level is expressed as:

[0048]

[0049]

[0050] Among them: the action of each instance being selected to carry the service is recorded as a gene x, and the selection probability is recorded as a gene expression level x i , η i represents Gaussian noise with mean 0 and variance σ, v g represents the growth rate of E. coli, w ij Represents gene expression level x j x i The influence coefficient of .

[0051] The v g The calculation formula is:

[0052]

[0053] Among them: γ, δ, is a fixed parameter, and r is recorded as the number of resource fragments generated in the system.

[0054] As a preferred embodiment of the present invention, in order to avoid the influence of different gene expression levels on each other, the gene expression level calculation formula is expressed as follows: i and μ are set to 0.5 and 10 respectively.

[0055] As a preferred embodiment of the present invention, the effect of gene expression level on growth rate is amplified. g In the calculation formula, both γ and δ are set to 100. In order to more flexibly adjust the microservice discovery action triggering interval, and κ are set to 0.1 and 10.

[0056] As a preferred embodiment of the present invention, the algorithm in step S3 is one of a probability selection algorithm, a center of gravity selection algorithm and a random selection algorithm.

[0057] As a preferred embodiment of the present invention, the algorithm is a probability selection algorithm, and the use of probability selection can improve the robustness of action selection. The probability selection formula is expressed as:

[0058]

[0059] Among them: the action of each instance selected to carry the service is recorded as a gene x, and the probability corresponding to the action is recorded as a gene expression level x i .

[0060] Embodiment 1: Terminal microservice discovery method based on attractor model.

[0061] 1.1 Redefinition of the attractor model

[0062] A microservice has multiple instances. The action of each instance selected to carry the business is recorded as a gene x, and the probability corresponding to the action is recorded as a gene expression level x. i The attractor model simulates the lactose metabolism process of E. coli and determines the probability of E. coli moving toward high lactose concentration through simple feedback to solve the dynamic selection problem. Corresponding to the microservice instance discovery problem, the calculation formula for each gene expression level is as follows:

[0063]

[0064]

[0065] In formula (1), the first and second parts on the right side of the equation are stable parts, and the third part is unstable part. In formula (1), the growth rate of E. coli at the current position is v g , v g The larger the value, the larger the first and second parts are. i The greater the impact, the greater the probability that E. coli will stay in the original location. Its biological significance means that the lactose concentration at this location is higher, the growth rate of E. coli is faster, and the probability of moving to other locations with lower lactose concentration is smaller. Corresponding to the microservice instance selection method, the greater the probability that the action corresponds to the selected microservice instance. Conversely, v g The smaller the value, the smaller the first and second parts are. i The smaller the influence of i x i The influence of becomes larger, the system becomes unstable, and the probability of E. coli moving becomes larger. Its biological significance means that the lactose concentration at this location is small, the growth rate of E. coli is slow, and the probability of moving to other locations with higher lactose concentration is greater. Corresponding to the microservice instance selection method, the probability of selecting the microservice instance corresponding to this action becomes smaller.

[0066] In formula (1), w ij Represents gene expression level x j x i The influence coefficient, η i represents Gaussian noise with a mean of 0 and a variance of σ. The purpose of adding Gaussian noise is to prevent formula (1) from falling into a stable state. g When it is small, the system has the ability to jump out of the stable state and find a new convergence point. In order to avoid the influence of different gene expression levels on each other, θ i and μ are set to 0.5 and 10 respectively.

[0067] The attractor model of lactose metabolism focuses on the growth rate of Escherichia coli v g , v gIt is related to the lactose concentration at the location of E. coli, and ultimately reflects the total amount of protein produced by E. coli under a certain lactose concentration. g The direct influencing factor is the number of resource fragments generated in the system after selecting the microservice instance. i When the corresponding action results in fewer resource fragments in the system, the corresponding v g Larger, x i The higher the gene expression level of the action, the higher the probability of selecting the microservice instance corresponding to the action. Conversely, the lower the probability of selecting the microservice instance corresponding to the action. g The expression is as follows:

[0068]

[0069] Among them, γ, δ, is a fixed parameter, r is the number of resource fragments generated in the system, and in order to amplify the effect of gene expression level on the growth rate, γ and δ are both set to 100; in order to more flexibly adjust the interval time for triggering microservice discovery actions, and κ are set to 0.1 and 10.

[0070] 1.2. The terminal microservice discovery method based on the attractor model includes the following steps:

[0071] Step 1: At time T0, initialize the microservice instance to discover the gene expression level x corresponding to the action i ;

[0072] Step 2: T t At time t, the gene expression level x corresponding to all microservice instances is calculated based on the input parameters using formulas (1), (2), and (3) i ;

[0073] Step 3: Use the probability selection algorithm to calculate x i Select the target action and use the target microservice instance corresponding to the target action as the microservice instance that carries the user request. Using probabilistic selection can improve the robustness of action selection. The probabilistic selection formula is as follows:

[0074]

[0075] Step 4: Record the number of resource fragments r corresponding to the target action as the input parameter of the next microservice instance discovery method.

[0076] 1.3, such as Figure 2 , 3 As shown in the figure, the performance test of the terminal microservice discovery method based on the attractor model is shown.

[0077] When there are surplus resources on a physical server, but the surplus resources cannot meet the resource requirements of microservices, it means that resource fragmentation has occurred on the physical server. Resource fragmentation is quantified and defined as the number of physical servers with resource fragmentation, denoted as n = n v +n r .

[0078] There are two scenarios where the remaining resources on the server cannot meet the microservice resource request: one is that the number of remaining vCPU cores cannot meet the number of vCPU cores requested by the microservice, and the other is that the remaining memory cannot meet the memory requested by the microservice.

[0079] in,

[0080]

[0081]

[0082] T v and T r are the remaining vCPU cores and the remaining memory fragmentation thresholds respectively. If the remaining vCPU of the physical server is greater than T v And the remaining memory is less than T r , or the remaining memory is greater than T r And the remaining vCPU is less than T v , then resource fragmentation occurs on the physical server.

[0083] A microservice management framework was built, and the performance of the present invention and the comparison method (including cloudware PaaS platform, adaptive microservice framework, and elastic cloud platform based on Docker) were tested under the verification microservice management framework. The performance test results are as follows: Figure 2 , Figure 3 As shown. Figure 2 , Figure 3 It can be seen that no matter the microservice instance specifications are fixed or the microservice instance specifications change, as time goes by, the number of resource fragments in the present invention is less than that in the comparison algorithm, indicating that the microservice instance that can be selected by the present invention is most suitable for carrying the user's business request.

[0084] In summary, the attractor model algorithm proposed in the present invention can automatically select the microservice instance that carries the business and meet the resource requirements of the business for the microservice instance. The optimization performance of the present invention is better than the comparison algorithm, and there are fewer resource fragments on the physical server. Through experimental verification, the test results show that the present invention can reduce the resource fragmentation rate of the physical server by 32% and shorten the calculation time by about 70%.

[0085] The above descriptions are merely embodiments of the present invention and are not intended to limit the protection scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related system fields, are also included in the protection scope of the present invention.

Claims

1. A terminal microservice discovery method based on an attractor model, characterized in that: The following steps are involved: S1: Calculate the selection probability of all microservice instances based on the attractor model according to the input parameters, where the selection probability is the probability corresponding to the action of each microservice instance being selected to carry the business, and the attractor model is a model that simulates the kinetic process of lactose metabolism in Escherichia coli; S11: At time T0, the selection probabilities of all microservice instances are initialized; S12: In T t At time , the selection probability of all microservice instances is calculated based on the attractor model according to the input parameters, where: the attractor model includes the calculation formula for gene expression level and the calculation formula for the growth rate of Escherichia coli; The calculation formula of the gene expression level is expressed as: Among them: the action of each instance being selected to carry the service is recorded as a gene x, and the selection probability is recorded as a gene expression level x i , η i represents Gaussian noise, v g represents the growth rate of E. coli, w ij Represents gene expression level x j The influence coefficient on xi; The growth rate calculation formula of the Escherichia coli is expressed as: Among them: γ, δ, is a fixed parameter, r is recorded as the number of resource fragments generated in the system; S2: According to the selection probabilities of all microservice instances, the target selection probability is obtained by using an algorithm, and the microservice instance corresponding to the target selection probability is used as the microservice instance that carries the user request, including: Determine the target action corresponding to the target selection probability, where the target action is the action in which the target microservice instance is selected to carry the business; The target microservice instance corresponding to the target action is used as the microservice instance that carries the user request; The number of resource fragments corresponding to the target action is recorded, and the number of resource fragments is used as an input parameter of the next attractor model.

2. According to the terminal microservice discovery method based on the attractor model of claim 1, it is characterized in that: In the expression of the calculation formula of the gene expression level: θ i and μ are set to 0.5 and 10 respectively.

3. According to the terminal microservice discovery method based on the attractor model of claim 2, it is characterized in that: In the expression of the growth rate calculation formula of Escherichia coli: γ and δ are both set to 100, and κ are set to 0.1 and 10.

4. According to the terminal microservice discovery method based on the attractor model of claim 1, it is characterized in that: The algorithm in step S2 is one of a probability selection algorithm, a center of gravity selection algorithm and a random selection algorithm.

5. According to the terminal microservice discovery method based on the attractor model of claim 4, it is characterized in that: When the algorithm is a probability selection algorithm, the probability selection formula is expressed as: Among them: the action of each instance selected to carry the service is recorded as a gene x, and the probability corresponding to the action is recorded as a gene expression level xi.