CN110601994A - Load balancing method for micro-service chain perception in cloud environment - Google Patents

Load balancing method for micro-service chain perception in cloud environment Download PDF

Info

Publication number
CN110601994A
CN110601994A CN201910973419.8A CN201910973419A CN110601994A CN 110601994 A CN110601994 A CN 110601994A CN 201910973419 A CN201910973419 A CN 201910973419A CN 110601994 A CN110601994 A CN 110601994A
Authority
CN
China
Prior art keywords
micro
service
instance
request
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201910973419.8A
Other languages
Chinese (zh)
Other versions
CN110601994B (en
Inventor
李鑫
邢临川
吴梦帆
王欣
王林
杨涛
赵祯真
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nanjing University of Aeronautics and Astronautics
Original Assignee
Nanjing University of Aeronautics and Astronautics
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nanjing University of Aeronautics and Astronautics filed Critical Nanjing University of Aeronautics and Astronautics
Priority to CN201910973419.8A priority Critical patent/CN110601994B/en
Publication of CN110601994A publication Critical patent/CN110601994A/en
Application granted granted Critical
Publication of CN110601994B publication Critical patent/CN110601994B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/12Avoiding congestion; Recovering from congestion
    • H04L47/125Avoiding congestion; Recovering from congestion by balancing the load, e.g. traffic engineering
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/28Flow control; Congestion control in relation to timing considerations
    • H04L47/283Flow control; Congestion control in relation to timing considerations in response to processing delays, e.g. caused by jitter or round trip time [RTT]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • H04L67/101Server selection for load balancing based on network conditions

Abstract

The invention discloses a load balancing method for micro service chain perception in a cloud environment, which at least comprises the following steps: acquiring system parameters, including: a user request set R, each request corresponding to a micro service chain; obtaining a current request, finding a micro service chain C corresponding to the request: taking out all required microservice sets from the microservice chain; taking out a data set required to be transmitted among the microservices; setting an optimal micro-service instance path to be selected, and emptying the path; traversing all data to be transmitted, and searching the data combination of the maximum data volume in the transmission process: finding the example combination with the minimum cost in the set pMSIns and nMSINs of the step (5); removing the maximum data volume from the queue of all transmission data volumes; when the data set DSset required to be transmitted between the micro-services is not empty, the step (4) is carried out; and (4) if the requests in the request set R are not completely traversed, turning to the step (2). The scheme of the invention effectively reduces the time delay problem in the micro-service architecture.

Description

Load balancing method for micro-service chain perception in cloud environment
Technical Field
The invention relates to a resource management optimization method under a micro-service architecture, in particular to a load balancing method for micro-service chain perception under a cloud environment.
Background
With the rapid development of the internet, particularly the 5G era has come, people rely on the internet to reach a new peak, more internet services mean higher development cost and faster iteration speed, the efficiency of the internet is reflected in the marginal cost of extremely low services, meanwhile, the internet environment is increasingly complex and changeable, and a micro-service architecture is generated for better user experience and improvement of the stability of service maintenance.
The microservice architecture is an architectural model that calls for a single application to be divided into a set of small services that are coordinated and interworked. Each service runs in its independent process, and the services communicate with each other by adopting a lightweight communication mechanism (usually, a http (Hypertext Transfer Protocol) -based Restful API (presentation State Transfer Application programming interface)). Each service is built around a specific business and can be deployed independently to a production environment, a production-like environment, and the like. In addition, a unified and centralized service management mechanism should be avoided as much as possible, and for a specific service, a suitable language and tool should be selected and constructed according to the business context.
Several characteristics of the microservice architecture:
single duty
Each service in the micro-service architecture is a unit with business logic and accords with a high-cohesion and low-coupling principle and a single-responsibility principle, and different services are flexibly combined in a pipeline mode, so that a huge system is constructed.
Lightweight communications
The services are interconnected through a lightweight communication mechanism, and the lightweight generally refers to a language-independent and platform-independent interaction mode.
Independence of
Each service is independently developed, tested, and deployed during the application delivery process.
Process isolation
In the microservice architecture, an application consists of multiple services, each of which is a highly autonomous, independent business entity that can run in an independent process, and different services can be very easily deployed to different hosts.
Brief introduction to SpringCloud
Spring cloud is a complete set of framework for implementing microservice based on spring boot. It provides the components required for microservice development, such as configuration management, service discovery, circuit breakers, routability, micro-agents, control buses, decision election, distributed session and cluster state management. Fig. 1 is a general framework diagram of a spring cloud microserver.
Wherein
Hystrix (breaker)
In the micro-service architecture, services are split into individual services according to services, and the services can be mutually called. To ensure that it is highly available, individual services are typically deployed in clusters. Due to network reasons or self reasons, the service cannot be guaranteed to be available in a hundred percent, if a single service has a problem, thread blocking occurs when the service is called, and at the moment, if a large number of requests are input, thread resources of a Servlet container are consumed completely, so that service paralysis is caused. Due to service-to-service dependencies, failures can propagate with catastrophic serious consequences for the entire microservice system, which is the "avalanche" effect of service failures. Netflix has sourced the Hystrix component, realizes the breaker mode, and SpringCloud integrates the component.
Eureka registration service center
Because the Spring Cloud makes an abstract interface for service administration, a variety of different service administration frameworks can be supported in Spring Cloud applications, such as: netflix Eureka, Consul, Zookeeper. The SpringCloud cusul project is for cusul service governance implementation. Consul is a distributed, highly available system that contains multiple components, but as a whole provides tools for service discovery and service configuration for our infrastructure in a microservice architecture. It contains the following characteristics: service discovery, health check, Key/Value storage, multiple data centers. Since Consul itself provides the server, we do not need to create a service registry as before when Eureka is implemented, and can use it by directly downloading the server program of Consul. Consul is more than Eureka registration supports.
Config configuration management
After spring child configuration is introduced, external configuration files can be intensively placed in a git warehouse, a config server is newly built to manage all the configuration files, when configuration needs to be changed during maintenance, the configuration files are pushed to a remote warehouse only after being changed locally, and all service instances can acquire the configuration files through the config server. At this time, each service instance is equivalent to a client config client of the configuration service, and the configuration server config server can perform cluster deployment in order to ensure the stability of the system.
Zuuul service gateway
At the heart of Zuul is a series of filters that can act like the Filter of the Servlet framework, where the main functions of Zuul are routing and filtering.
In the micro-service architecture, the micro-services are highly decoupled, and the micro-service architecture is a classical distributed system. Thus, it presents different complexity problems than the monolithic application. When the application service system receives a user request, several associated microservices may be required to process to return the correct expected result to the user. If the requests are forwarded to each other among multiple microservices in a large-scale cloud system, and the resources cannot be reasonably distributed, the time for processing the user requests by one microservices is increased sharply, and the extremely poor user experience is caused. Therefore, a useful and efficient resource management mechanism is to be explored to achieve reasonable scheduling of resources and reduce the response time of the system in the whole micro-service architecture. In the current micro service architecture, the load balancing technology is the key to realize reasonable resource allocation. Load balancing is to distribute requests or data evenly among a plurality of operation units.
Currently, there are several common load balancing algorithms:
polling method
The round robin algorithm is also one of the most basic algorithms in the static load balancing algorithm. The english name is RoundRobin, and therefore is also called RR scheduling algorithm. The algorithm idea is also simpler, namely requests are distributed to the servers in turn, each node at the back end is treated in a balanced mode, and other load indexes of the nodes are not considered.
Stochastic method
The random algorithm is one of the most basic algorithms in the static load balancing algorithm, and the basic principle of the algorithm is that the total number of instance nodes is divided by a module after a random number is generated, and the obtained value is the node which needs to be requested.
Weighted round robin method
Weighted polling is a further step relative to simple polling load balancing. Because certain performance difference possibly exists between the nodes, the problem that the polling cannot be applied to a heterogeneous node environment can be well solved through weighted polling, relatively fair load distribution can be achieved by setting weighted values for different nodes, and system efficiency is improved.
Source address hashing method
The source address hash is to obtain the IP address of the visiting client, a hash value is calculated through an appointed hash function, the hash value is used for conducting modular extraction on the number of the nodes, and the obtained value is the serial number of the nodes to be distributed.
Consistent hashing method
The principle of consistent hashing is to organize the value range of a hash function into a ring, and use a hash ring to replace the previous linear hash bucket, which can change the mapping relation of the existing value on the hash ring as little as possible when removing and adding nodes. Due to good expandability and flexibility, the consistent hash is widely applied in the traditional P2P field (data are directly transmitted between network users), and covers the node allocation mechanism of most systems. However, the royal honest et al also indicate that the consistent hashing only solves the problem of the lateral expansion of the system, is not good in load balancing, and may cause a data skew problem, and the methods of the royal honest et al improve the performance of the consistent hashing method on load balancing by using a greedy algorithm to perform position mapping distribution in the consistent hashing.
Method of minimum number of connections
The minimum number of connections is a typical and easily implemented dynamic load balancing algorithm. The method is widely supported in commercial load balancing software, and NGINX (high-performance HTTP and reverse proxy Web server), HAproxy (application proxy based on TCP and HTTP) and LVS (Linux Virtual Server) are correspondingly realized. The algorithm idea is that the number of the request connections served by the back end is used as a load index, and the current load condition of the node is abstractly measured according to the number of the connections of the node at a certain moment. Therefore, the load balancer should obtain the number of connections to the proxied node in real time and find the minimum value thereof to assign a new request to the node.
Most of the current micro-service architecture is deployed in a data center in the form of a container. A container is an abstraction at the application level and can run independently in user space. However, under the existing micro-service architecture, when a user sends a service request, a plurality of related micro-services are required to process the user request, and then an expected result can be returned to the client, and due to the fact that the coupling degree between containers is not high, the network delay of the user request is increased, and the user experience is reduced.
Under the micro-service architecture, the uncertainty of the instance distribution causes huge network cost of the request, and finally the delay of the request is increased. A high probability of an increase in the request delay leads to a reduction in the user experience with the product, and at the same time, too high a load leads to a reduction in the processing capacity of the overall system.
Disclosure of Invention
In order to solve the problems, the micro-service chain perception load balancing method in the cloud environment disclosed by the invention starts with the load balancer, endows the cloud environment with perception capability, and provides a micro-service chain perception request load balancing algorithm. The algorithm can reduce the request delay time in the micro-service architecture to a certain extent, and simultaneously effectively balance the load among the hosts. And finally, evaluation is carried out according to two aspects of average request delay on the micro service chain and the load condition of the host, and the conclusion is that the algorithm can effectively reduce the average request delay in the complex micro service request calling chain and can effectively balance the work load of the host.
The invention discloses a load balancing method for micro service chain perception in a cloud environment, which at least comprises the following steps:
(1) acquiring system parameters, including: a user request set R, each request corresponding to a micro service chain C (chain);
(2) obtaining a current request, finding a micro service chain C corresponding to the request:
(3) taking out all needed microservice sets MSset from the microservice chain;
(4) taking out a data set DSset required to be transmitted among the micro services; the inster sets an optimal micro-service instance path to be selected and nulls the path;
(5) traversing all data needing to be transmitted, and when the data are not empty:
a) finding the maximum data volume in the current transmission process, taking out the producer micro-service PRIORITYMS of the data volume, and constructing all corresponding producer micro-service instance sets pMSIns;
b) finding the maximum data volume in the current transmission process, taking out the consumer micro service nextMS of the data volume, and constructing all corresponding consumer micro service instance sets nMSins;
(6) finding the example combination with the minimum cost in the sets pMSIns and nMSINs in the step (5), and completing pairing;
(7) removing the maximum data volume from the queue of all transmission data volumes;
(8) when the data set DSset required to be transmitted between the micro-services is not empty, the step (4) is carried out;
(9) and (4) if the requests in the request set R are not completely traversed, turning to the step (2).
The invention discloses an improvement of a micro-service chain-aware load balancing method in a cloud environment, wherein the implementation of finding the least-costly example combination in the set pMSIns and nMSINs of step (5) in step (6) is as follows:
if the number of the first-time-series terminal,
the micro-service of the inquired producer in the micro-service path with the lowest cost does not determine a service instance;
the consumer micro service inquired this time in the micro service path with the lowest cost does not determine a service instance;
and traversing all the micro-service examples to find the micro-service example pIns of the consumer and the micro-service example nIns of the consumer corresponding to the minimum cost.
In the invention, as another improvement of the micro-service chain-aware load balancing method in the cloud environment, the implementation of finding the least costly example combination in the set pMSIns and nMSIns of step (5) in step (6) is as follows: if one producer micro-service instance is determined to be an insMpThen in insMpThe least costly customer micro-service instance nlin is sought on the basis of (1).
In the invention, as another improvement of the micro-service chain-aware load balancing method in the cloud environment, the implementation of finding the least costly example combination in the set pMSIns and nMSIns of step (5) in step (6) is as follows: if there is one customer microservice instance determined to be insMnThen in insMnAnd searching for the producer micro-service example pIns with the minimum cost on the basis.
The invention discloses an improvement of a micro-service chain perception load balancing method in a cloud environment, wherein pairing in step (6) is implemented as follows: if the producer microservice exists in the instance path and the instance is empty, the instance with the least producer microservice cost is placed in the path.
The invention discloses another improvement of the micro-service chain perception load balancing method under the cloud environment, wherein the pairing in the step (6) is implemented as follows: if the consumer micro-service exists in the instance path and the instance is empty, the instance with the minimum consumer micro-service cost is placed in the path.
The invention discloses an improvement of a micro-service chain perception load balancing method under a cloud environment, wherein the load balancing method further comprises the following steps: calculating the average request delay on the micro service chain, and executing the step (3) after the micro service chain C corresponding to the request is obtained in the step (2);
in the step (1) Em(k)An execution time for each microservice instance; dAFor micro-service MADelivery to microservice MBThe requested data size;
then, the average request latency over the chain of compute microservices:
Lc=∑ili/Rc,{i|RToChain(Ri)=C}
liis the delay time of a single request, as shown by the equation below, which is mainly determined by the latency of the execution timeAnd request data transfer time
Li=α∑Pi kβ∑Ti kxWherein α, β are constants;
wait for execution time Pi kFrom a waiting time Wi xAnd execution time Em(k)Consists of the following components:
Pi k=Wi x+Em(k)
simultaneously, the following requirements are met:
Wi x=∑Em(i(r)),{r|r∈Q(h(k))}
wherein h (k) is the host where k instances are located, Q (x) is all requests in the host x queue, and i (r) is the instance where the acquisition request r is located;
the data transmission time is determined by the ratio of the size of the transmission data to the speed:
where speed (x, y) is the speed at which data is transmitted between instances x, y.
The invention discloses an improvement of a micro-service chain perception load balancing method in a cloud environment, wherein in the step of calculating the average request delay on a micro-service chain, the assignment range of a constant alpha is 0-1. Preferably, the constant α is assigned to 1 when the delay caused by an abnormality such as collision or the like is not considered. And when the delay caused by the abnormality such as collision conflict is the largest, such as crash, the constant beta is assigned to be 0. In general, the value is considered to be above 0.5, and may be 0.8 if the delay reaches 20 ms. If the delay is large and significantly affects the calculation, for example, in the case of a stuck condition, the value may be set to be less than 0.5, for example, when the delay reaches 100ms, the value may be set to 0.2. The specific assignment is contingent on the respective situation and is not absolutely limited.
The invention discloses an improvement of a micro-service chain perception load balancing method in a cloud environment, wherein in the step of calculating the average request delay on a micro-service chain, the assignment range of a constant beta is 0-1. Preferably, the constant β is assigned to 1 when the delay caused by an abnormality such as collision or the like is not taken into consideration. And when the delay caused by the abnormality such as collision conflict is the largest, such as crash, the constant beta is assigned to be 0. In general, the value is considered to be above 0.5, and may be 0.8 if the delay reaches 20 ms. If the delay is large and significantly affects the calculation, for example, in the case of a stuck condition, the value may be set to be less than 0.5, for example, when the delay reaches 100ms, the value may be set to 0.2. The specific assignment is contingent on the respective situation and is not absolutely limited.
The invention discloses a load balancing method for micro service chain perception in a cloud environment, which is further expressed as follows:
the invention discloses a load balancing method for micro service chain perception in a cloud environment, which at least comprises the following steps:
(1) acquiring system parameters, including: a user request set R, each request corresponding to a micro service chain C (chain);
(2) obtaining a current request, finding a micro service chain C corresponding to the request:
RToChain(Ri) Wherein, RToChain (R)i) Is to obtain a request RiThe function of the corresponding unique micro service chain C;
(3) taking out all required microservices from a microservice chain
MSset←getMSfromChain(chain)
Wherein, GetMsfromChain (chain) is a function for taking out all micro services in the chain of chain micro services, and MSset is a set of all the micro services taken out;
(4) fetching data to be transmitted between microservices
DSset←getDSfromMSset(MSset)
Wherein, getDSfromsset (MSset) is a function of measuring out the data transmitted between all the micro services extracted from the previous step, and DSset is the set of all the data extracted;
(5) traversing all data needing to be transmitted, and when the data are not empty:
a) finding the maximum data volume in the current transmission process, and taking out the producer micro-service priority MS of the data volume:
data,priorityMS←findMaxDataSize(DSSet)
wherein findMaxDataSeze (DSset) is a function of sorting the size of the elements in the data volume set to find the maximum data volume and the data producer microservice;
b) find and fetch the consumer micro service nextMS of the largest amount of data in the transfer:
nextMS←next(MSset,priorityMS)
wherein, next (MSset, priority ms) is a function of finding the consumer micro-service of the previous data volume with the micro-service set and the producer micro-service as parameters;
(6) fetching all producer microservice instances
pMSIns←getInsfromMS(priorityMS)
Wherein getInsfromMS (PRIORITYMS) fetches a function of all producer microservice instances, pMSIns is a set of producer microservice instances;
(7) all consumer microservice instances taken out
nMSIns←getInsfromMS(nextMS)
Wherein getInsfromMS (nextMS) fetches a function of all consumer microservice instances, nMSins is the producer microservice instance set;
(8) finding the least costly combination of instances, i.e. the combination of instances with the least latency to the request:
(8_1) if
insOrder.get(priorityMS)is not null
insOrder.get(nextMS)is not null
Get (priority ms) is to see whether the producer microservice queried this time in the microservice path with the lowest cost has already determined a service instance;
get (nextMS) is to see if the consumer microservice queried this time in the lowest cost microservice path has already determined a service instance
Traversing all micro-service examples to find the minimum cost correspondent
pIns,nIns←findMinCost(pMSIns,nMSIns)
findMinCost (pMSIns, nMSINs) is a function that finds the least costly combination of instances in the set of instances as parameters;
(8_2) if there is one producer micro-service instance determined to be an insppThen in insMpFind the least costly consumer microservice instance on the basis of
nIns←findMinCost(insMp,nMSIns)
(8_3) if there is one producer micro-service instance determined to be an inspnThen in insMnTo find the least costly consumption on the basis ofMicro service example
pIns←findMinCost(pMSIns,insMn)
(9) If the producer micro-service exists in the instance path and the instance is empty, the instance with the minimum producer micro-service cost is placed in the path
insOrder.set(priorityMS,pIns)
Wherein, order.set (PRIORTYMS, pINS) is a function for placing a minimal instance of a micro-service corresponding to a low price in a path;
(10) if the consumer micro-service exists in the instance path and the instance is empty, the instance with the minimum consumer micro-service cost is placed in the path
insOrder.set(nextMS,nIns);
(11) The maximum data volume is deleted from the queue of all transmission data volumes
DSset.pop(priorityMS,data)
Pop (priority ms, data) is a function of deleting the amount of data that has been manipulated from the set of amounts of data;
(12) when in use
DSset is not null
Step (5) is carried out, otherwise, the obtained micro-service instance path corresponds to the request
send(Ri,insOrder)
Wherein, send (Ri, inster) is a function corresponding to the acquired micro-service instance path and the request;
(13) and (4) if the requests in the request set R are not completely traversed, turning to the step (2).
The invention discloses an improvement of a micro-service chain perception load balancing method under a cloud environment, wherein the load balancing method further comprises the following steps: calculating the average request delay on the micro service chain, and executing the step (3) after the micro service chain C corresponding to the request is obtained in the step (2);
in the step (1) Em(k)An execution time for each microservice instance; dAFor micro-service MADelivery to microservice MBThe requested data size;
the average request latency over the chain of computational microservices:
Lc=∑ili/Rc,{i|RToChain(Ri)=C}
liis the delay time of a single request, as shown by the following equation, which is mainly composed of the latency execution time Pi kAnd request data transmission time Ti kx
Li=α∑Pi kβ∑Ti kxWherein α, β are constants;
wait for execution time Pi kFrom a waiting time Wi xAnd execution time Em(k)Consists of the following components:
Pi k=Wi x+Em(k)
simultaneously, the following requirements are met:
Wi x=∑Em(i(r)),{r|r∈Q(h(k))}
wherein h (k) is the host where k instances are located, Q (x) is all requests in the host x queue, and i (r) is the instance where the acquisition request r is located;
the data transmission time is determined by the ratio of the size of the transmission data to the speed:
wherein speed (x, y) is a speed function of data transmission between instances x, y, and satisfies the following conditions:
in the method, a speed function of data transmission between instances x and y is calculated, for example, for two instances of the same host, the communication speed between the instances is mainly limited by the throughput of a disk, so that the communication speed can be set to be 500 MB/s; for two examples of different hosts in the same rack, the communication rate between the two hosts is mainly limited by the throughput of the network card, and the rate can be set to be 100MB/s in consideration of the intermediate network loss; finally, the rate should be the lowest of the three for communication between different chassis instances, and considering the pressure of the backbone network of the data center, we consider that communication between the chassis will have higher network loss, so it can be set to 30 MB/s. Therefore, these three transmission speeds can be set to 500MB/s, 100MB/s, and 30MB/s, respectively. The surface speed function is influenced by factors such as hardware, network speed and geographical position, and needs to be set according to actual conditions.
The invention discloses an improvement of a micro-service chain perception load balancing method in a cloud environment, wherein in the step of calculating the average request delay on a micro-service chain, the assignment range of a constant alpha is 0-1. Preferably, the value is 1 regardless of the delay due to an abnormality such as collision or the like.
The invention discloses an improvement of a micro-service chain perception load balancing method in a cloud environment, wherein in the step of calculating the average request delay on a micro-service chain, the assignment range of a constant beta is 0-1. Preferably, the value is 1 regardless of the delay due to an abnormality such as collision or the like.
The invention discloses an improvement of a micro-service chain perception load balancing method under a cloud environment, wherein the load balancing method further comprises the following steps:
after the data set DSset is obtained, the inster can also be set as the optimal micro-service instance path to be selected, namely, the instance path with the minimum delay corresponding to the request, and the instance path is nulled
insOrder←setEmptyInsfromMSset(MSset)
setemptylnsfrommsset (msset) is a function that nulls out all instances of the microservice in the microservice set.
The core of the invention is that:
it should be clear that when the micro-service architecture is in a cloud environment, its distributed micro-service instances are scattered among the various hosts, and a high latency is incurred when processing user requests through the micro-service call chain. Therefore, in order to solve the problem, a micro-service chain-aware request load balancing algorithm is provided by starting from a load balancer and endowing the load balancer with perception capability in a cloud environment. The algorithm can reduce the request delay time in the micro-service architecture to a certain extent, and simultaneously effectively balance the load among the hosts. And finally, evaluation is carried out according to two aspects of average request delay on the micro service chain and the load condition of the host, and the conclusion is that the algorithm can effectively reduce the average request delay in the complex micro service request calling chain and can effectively balance the work load of the host.
The data center is deployed by a container, the service quality and the user experience are improved in the aspect of load balance under a large number of unbalanced instances, and the user time delay and the host load are mainly used as reference indexes.
(1) The algorithm is used for realizing the micro-perception of the micro-service chain of the service scene, and a scheme with better consideration indexes tends to be selected.
(2) The method is in the face of formal description of the whole architecture, and has universality and reference significance under more application scenes.
(3) The method is characterized in that the scheme takes the user as an object, and the user conducts traversal query on the Requests of the user, so that the optimal scheme under an available microservice chain can be found, and the operability is strong.
(4) In the specific selection process of the scheme, the elasticity comparison is realized, the micro services with higher requirements on the micro service chain can be distributed with better priority, and the time delay is reduced to the greatest extent.
(5) In the temporal complexity O (n × n) and the spatial complexity O (n) of the algorithm.
(6) The method is characterized in that findMinCost (pMsins, nMSins) is selected for a plurality of instances of a user, and the path search scheme serving as a micro service chain under the selection of the large number of instances is more scientific because the service quality of the whole service is improved for a service party, and the pseudo optimization of other situations is abandoned instead of the simple optimization of one instance.
(7) In the selection of the reference index: load, user delay. This is a factor that users and service parties pay attention to in the micro-service scene. The algorithm reasonably selects the main factors and ignores the secondary factors. Under a mathematical model, there are two magnitudes to calculate based on.
Drawings
FIG. 1, a general framework diagram of a SpringCloud microserver;
FIG. 2 is a flow chart of an aspect of the present invention;
FIG. 3 is a table illustrating partial compliance with the inventive arrangements.
Detailed Description
The present invention is further illustrated by the following specific embodiments, which are to be construed as merely illustrative, and not limitative of the remainder of the disclosure in any way whatsoever.
The implementation of the solution of the present invention is described below with reference to fig. 2-3, and it should be clear that the following description is only an explanation of the solution of the present invention, and not a limitation of the scope of protection of the corresponding claims. When the scheme of the present invention is implemented specifically, an implementation manner of the scheme is as follows, wherein "←" represents assignment, the following function or set assignment process is only illustrative, and different assignment functions can be specifically adopted on different platforms, and the scheme of the present invention can be implemented:
(1) acquiring system parameters, including: a user request set R, a micro service chain C (chain) corresponding to each request, the distribution condition of micro service instances, and the execution time E of each micro service instancem(k)(micro service type of available micro service instance k), micro service MADelivery to microservice MBRequested data size DA
(2) Obtaining the current request, finding the micro service chain corresponding to the request
RToChain(Ri)=C
RToChain(Ri) Is to obtain a request RiFunction of corresponding single micro service chain C
(3) The average request delay over the microservice chain is calculated.
Lc=∑ili/Rc,{i|RToChain(Ri)=C}
liIs the delay time of a single request, as shown by the following equation, which is mainly composed of the latency execution time Pi kAnd request data transmission time Ti kx
Li=α∑Pi k+β∑Ti kx
(α, β are constants, and are assigned such that, regardless of the delay due to an anomaly such as a collision, the assignment is 1, and when the delay due to an anomaly such as a collision is the largest, if a crash occurs, the assignment is 0, in general, the assignment is 0.5 or more, and if the delay reaches 20ms, the assignment is 0.8, in the case where the delay is large and significantly affects the calculation such as the occurrence of a stuck condition, the assignment is 0.5 or less, for example, when the delay reaches 100ms, the assignment is 0.2, and the specific assignment is determined in accordance with the corresponding situation, without absolute limitation.)
Wait for execution time Pi kFrom a waiting time Wi xAnd execution time Em(k)Composition of
Pi k=Wi x+Em(k)
And also
Wi x=∑Em(i(r)),{r|r∈Q(h(k))}
I.e. the latency is equal to the execution time of all requests preceding the request
Where h (k) is the host where k instances are located, Q (x) is all requests in the host x queue, and i (r) is the instance where get request r is located.
The data transmission time is determined by the ratio of the size of the transmission data to the speed:
where speed (x, y) is a speed function of data transmission between instances x, y, and in order to fully utilize network topology information, the transmission speed is measured by using the distance between two microservice instances:
by the above expression, the average request delay over each microservice chain can be calculated. Average request latency generation
The performance in terms of service quality in the whole micro service architecture is shown, and the higher the service quality of the architecture is proved if the average request delay on the micro service chain is smaller.
(4) Taking out all required microservices from a microservice chain
MSset←getMSfromChain(chain)
GetMsfromChain (chain) is a function for taking out all microservices in the chain of microservices, MSset is the set of all microservices taken out, and MS is an abbreviation of microservices (MicroService).
(5) Fetching data to be transmitted between microservices
DSset←getDSfromMSset(MSset)
getDSfromsset (MSset) is a function of the amount of data transmitted between all the microservices taken from the previous step, and DSset is the set of all the data taken.
(6) The inster sets the optimal micro-service instance path to be selected and nulls the path
insOrder←setEmptyInsfromMSset(MSset)
setemptylnsfrommsset (msset) is a function that nulls out all instances of a microservice in a microservice set, ins being an abbreviation for instance (instance).
(7) Traversing all data needing to be transmitted, finding the maximum data volume in the current transmission process when the data are not empty, and taking out the producer micro-service priority MS of the data volume:
data,priorityMS←findMaxDataSize(DSSet)
findMaxDataSeze (DSset) is a function of the size ordering of the elements in the set of data volumes, finding the largest data volume, and the data producer microservice.
(8) Finding and retrieving the consumer micro-service nextMS of the largest amount of data in the transmission
nextMS←next(MSset,priorityMS)
next (MSset, priority ms) is a function of finding the consumer micro-service of the last step data volume using the micro-service set and the producer micro-service as parameters.
(9) Fetching all producer microservice instances
pMSIns←getInsfromMS(priorityMS)
getInsfromMS (priorities) takes out the function of all producer microservice instances, pMSIns is the producer microservice instance set.
(10) All consumer microservice instances taken out
nMSIns←getInsfromMS(nextMS)
getlnsfromms (nextms) takes out the function of all the consumer microservice instances, nMSIns is the set of producer microservice instances.
(11) Finding least costly example combinations
(11_1) if
insOrder.get(priorityMS)is not null
insOrder.get(nextMS)is not null
Get (priority ms) is to see whether the producer microservice queried this time in the lowest cost microservice path has already determined the service instance
Get (nextMS) is to see if the consumer microservice queried this time in the lowest cost microservice path has already determined a service instance
That is, the producer micro-service instance and the consumer micro-service instance are not determined, all the micro-service instances are traversed to find the minimum-cost correspondent
pIns,nIns←findMinCost(pMSIns,nMSIns)
findMinCost (pMSIns, nMSINs) is a function of finding the least costly combination of instances in the set of instances as parameters
(11_2) if there is one producer micro-service instance determined to be an insppThen in insMpFind the least costly consumer microservice instance on the basis of
nIns←findMinCost(insMp,nMSIns)
(11_3) if there is one producer micro-service instance determined to be an inspnThen in insMnFind the least costly consumer microservice instance on the basis of
pIns←findMinCost(pMSIns,insMn)
(12) If the producer micro-service exists in the instance path and the instance is empty, the instance with the minimum producer micro-service cost is placed in the path
insOrder.set(priorityMS,pIns)
Set (priority ms, pIns) is a function that places a micro-service corresponding to a low-cost minimal instance in the path.
(13) If the consumer micro-service exists in the instance path and the instance is empty, the instance with the minimum consumer micro-service cost is placed in the path
insOrder.set(nextMS,nIns)
(14) The maximum data volume is deleted from the queue of all transmission data volumes
DSset.pop(priorityMS,data)
Pop (priority ms, data) is a function of the amount of data that has been manipulated to be deleted from a set of amounts of data.
(15) When in use
DSset is not null
That is, the data to be transmitted is not completely traversed, the step (7) is carried out, otherwise, the obtained micro-service instance path is corresponding to the request
send(Ri,insOrder)
send (Ri, inster) is a function for associating the obtained micro-service instance path with the request.
(16) And (4) if the requests in the request set R are not completely traversed, turning to the step (2).
The technical means disclosed by the scheme of the invention are not limited to the technical means disclosed by the technical means, and the technical scheme also comprises the technical scheme formed by any combination of the technical characteristics. While the foregoing is directed to embodiments of the present invention, it will be appreciated by those skilled in the art that various changes may be made in the embodiments without departing from the principles of the invention, and that such changes and modifications are intended to be included within the scope of the invention.

Claims (9)

1. The method for balancing the load perceived by the micro service chain in the cloud environment at least comprises the following steps:
(1) acquiring system parameters, including: a user request set R, each request corresponding to a micro service chain C (chain);
(2) obtaining a current request, finding a micro service chain C corresponding to the request:
(3) taking out all needed microservice sets MSset from the microservice chain;
(4) taking out a data set DSset required to be transmitted among the micro services; the inster sets an optimal micro-service instance path to be selected and nulls the path;
(5) traversing all data needing to be transmitted, and when the data are not empty:
a) finding the maximum data volume in the current transmission process, taking out the producer micro-service PRIORITYMS of the data volume, and constructing all corresponding producer micro-service instance sets pMSIns;
b) finding the maximum data volume in the current transmission process, taking out the consumer micro service nextMS of the data volume, and constructing all corresponding consumer micro service instance sets nMSins;
(6) finding the example combination with the minimum cost in the sets pMSIns and nMSINs in the step (5), and completing pairing;
(7) removing the maximum data volume from the queue of all transmission data volumes;
(8) when the data set DSset required to be transmitted between the micro-services is not empty, the step (4) is carried out;
(9) and (4) if the requests in the request set R are not completely traversed, turning to the step (2).
2. The method for balancing load perceived by micro service chain in cloud environment as claimed in claim 1, wherein the implementation of finding the least costly instance combination in the set pMSIns and nMSIns of step (5) in step (6) is:
if the number of the first-time-series terminal,
the micro-service of the inquired producer in the micro-service path with the lowest cost does not determine a service instance;
the consumer micro service inquired this time in the micro service path with the lowest cost does not determine a service instance;
and traversing all the micro-service examples to find the micro-service example pIns of the consumer and the micro-service example nIns of the consumer corresponding to the minimum cost.
3. The method for balancing load perceived by micro service chain in cloud environment as claimed in claim 1, wherein the implementation of finding the least costly instance combination in the set pMSIns and nMSIns of step (5) in step (6) is: if one producer micro-service instance is determined to be an insMpThen in insMpThe least costly customer micro-service instance nlin is sought on the basis of (1).
4. The method for balancing load perceived by micro service chain in cloud environment as claimed in claim 1, wherein the implementation of finding the least costly instance combination in the set pMSIns and nMSIns of step (5) in step (6) is: if there is one customer microservice instance determined to be insMnThen in insMnAnd searching for the producer micro-service example pIns with the minimum cost on the basis.
5. The method for micro-service chain-aware load balancing in a cloud environment according to claim 1, wherein the pairing in step (6) is implemented as: if the producer microservice exists in the instance path and the instance is empty, the instance with the least producer microservice cost is placed in the path.
6. The method for micro-service chain-aware load balancing in a cloud environment according to claim 1, wherein the pairing in step (6) is implemented as: if the consumer micro-service exists in the instance path and the instance is empty, the instance with the minimum consumer micro-service cost is placed in the path.
7. The method for micro-service chain aware load balancing in a cloud environment according to claim 1, wherein the method for load balancing further comprises the steps of: calculating the average request delay on the micro service chain, and executing the step (3) after the micro service chain C corresponding to the request is obtained in the step (2);
in the step (1) Em(k)An execution time for each microservice instance; dAFor micro-service MADelivery to microservice MBThe requested data size;
then, the average request latency over the chain of compute microservices:
Lc=∑ili/Rc,{i|RToChain(Ri)=C}
liis the delay time of a single request, as shown by the equation below, which is mainly determined by the latency of the execution timeAnd request data transfer time
Li=α∑Pi k+β∑Ti kxWherein α, β are constants;
wait for execution timeFrom waiting timeAnd execution time Em(k)Consists of the following components:
simultaneously, the following requirements are met:
wherein h (k) is the host where k instances are located, Q (x) is all requests in the host x queue, and i (r) is the instance where the acquisition request r is located;
the data transmission time is determined by the ratio of the size of the transmission data to the speed:
where speed (x, y) is the speed at which data is transmitted between instances x, y.
8. The method for micro-service chain aware load balancing in a cloud environment according to claim 2, wherein the constant α is assigned in a range of 0 to 1 in calculating the average request delay on the micro-service chain.
9. The method for micro-service chain aware load balancing in a cloud environment according to claim 2, wherein the constant β is assigned in a range of 0 to 1 in calculating the average request delay on the micro-service chain.
CN201910973419.8A 2019-10-14 2019-10-14 Load balancing method for micro-service chain perception in cloud environment Active CN110601994B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910973419.8A CN110601994B (en) 2019-10-14 2019-10-14 Load balancing method for micro-service chain perception in cloud environment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910973419.8A CN110601994B (en) 2019-10-14 2019-10-14 Load balancing method for micro-service chain perception in cloud environment

Publications (2)

Publication Number Publication Date
CN110601994A true CN110601994A (en) 2019-12-20
CN110601994B CN110601994B (en) 2021-07-16

Family

ID=68867180

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910973419.8A Active CN110601994B (en) 2019-10-14 2019-10-14 Load balancing method for micro-service chain perception in cloud environment

Country Status (1)

Country Link
CN (1) CN110601994B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111614779A (en) * 2020-05-28 2020-09-01 浙江工商大学 Dynamic adjustment method for optimizing and accelerating micro service chain
CN112256384A (en) * 2020-09-22 2021-01-22 杭州指令集智能科技有限公司 Service set processing method and device based on container technology and computer equipment
CN112272231A (en) * 2020-10-23 2021-01-26 杭州卷积云科技有限公司 Edge cloud collaborative service arrangement method for intelligent manufacturing scene
CN112346899A (en) * 2020-11-06 2021-02-09 北京北信源软件股份有限公司 Method and device for optimizing microservice performance

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106506605A (en) * 2016-10-14 2017-03-15 华南理工大学 A kind of SaaS application construction methods based on micro services framework
CN107770243A (en) * 2017-09-06 2018-03-06 北京奥鹏远程教育中心有限公司 From extension, adaptive micro services platform and its application process
US20180307524A1 (en) * 2016-11-17 2018-10-25 Red Hat, Inc. Executing code referenced from a microservice registry
CN108712464A (en) * 2018-04-13 2018-10-26 中国科学院信息工程研究所 A kind of implementation method towards cluster micro services High Availabitity
CN109218355A (en) * 2017-06-30 2019-01-15 华为技术有限公司 Load equalizing engine, client, distributed computing system and load-balancing method
CN109921927A (en) * 2019-02-20 2019-06-21 苏州人之众信息技术有限公司 Real-time calling D-chain trace method based on micro services
CN110324177A (en) * 2019-05-31 2019-10-11 中国人民解放军国防科技大学 Service request processing method, system and medium under micro-service architecture

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106506605A (en) * 2016-10-14 2017-03-15 华南理工大学 A kind of SaaS application construction methods based on micro services framework
US20180307524A1 (en) * 2016-11-17 2018-10-25 Red Hat, Inc. Executing code referenced from a microservice registry
CN109218355A (en) * 2017-06-30 2019-01-15 华为技术有限公司 Load equalizing engine, client, distributed computing system and load-balancing method
CN107770243A (en) * 2017-09-06 2018-03-06 北京奥鹏远程教育中心有限公司 From extension, adaptive micro services platform and its application process
CN108712464A (en) * 2018-04-13 2018-10-26 中国科学院信息工程研究所 A kind of implementation method towards cluster micro services High Availabitity
CN109921927A (en) * 2019-02-20 2019-06-21 苏州人之众信息技术有限公司 Real-time calling D-chain trace method based on micro services
CN110324177A (en) * 2019-05-31 2019-10-11 中国人民解放军国防科技大学 Service request processing method, system and medium under micro-service architecture

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
李春霞: "微服务架构研究概述", 《软件导刊》 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111614779A (en) * 2020-05-28 2020-09-01 浙江工商大学 Dynamic adjustment method for optimizing and accelerating micro service chain
CN112256384A (en) * 2020-09-22 2021-01-22 杭州指令集智能科技有限公司 Service set processing method and device based on container technology and computer equipment
CN112256384B (en) * 2020-09-22 2023-10-24 杭州指令集智能科技有限公司 Service set processing method and device based on container technology and computer equipment
CN112272231A (en) * 2020-10-23 2021-01-26 杭州卷积云科技有限公司 Edge cloud collaborative service arrangement method for intelligent manufacturing scene
CN112272231B (en) * 2020-10-23 2022-05-13 杭州卷积云科技有限公司 Edge cloud collaborative service arrangement method for intelligent manufacturing scene
CN112346899A (en) * 2020-11-06 2021-02-09 北京北信源软件股份有限公司 Method and device for optimizing microservice performance
CN112346899B (en) * 2020-11-06 2024-02-09 北京北信源软件股份有限公司 Micro-service performance optimization method and device

Also Published As

Publication number Publication date
CN110601994B (en) 2021-07-16

Similar Documents

Publication Publication Date Title
CN110601994B (en) Load balancing method for micro-service chain perception in cloud environment
CN106899680B (en) The fragment treating method and apparatus of multi-tiling chain
JP5582344B2 (en) Connection management system and connection management server linkage method in thin client system
US6327622B1 (en) Load balancing in a network environment
CN107545338B (en) Service data processing method and service data processing system
US20120226799A1 (en) Capabilities Based Routing of Virtual Data Center Service Request
CN109085999B (en) Data processing method and processing system
US20150149611A1 (en) Centralized Resource Usage Visualization Service For Large-Scale Network Topologies
US20100138540A1 (en) Method of managing organization of a computer system, computer system, and program for managing organization
CN108833462A (en) A kind of system and method found from registration service towards micro services
CN110166507B (en) Multi-resource scheduling method and device
JP2014035717A (en) Load distribution method taking account of node of each rank of multi-rank
US8606908B2 (en) Wake-up server
CN111835849B (en) Method and device for enhancing service capability of access network
US20220318071A1 (en) Load balancing method and related device
WO2019153880A1 (en) Method for downloading mirror file in cluster, node, and query server
Bhowmik et al. Distributed control plane for software-defined networks: A case study using event-based middleware
Simoens et al. Challenges for orchestration and instance selection of composite services in distributed edge clouds
EP2517408A2 (en) Fault tolerant and scalable load distribution of resources
CN112035244A (en) Deployment of virtual node clusters in a multi-tenant environment
CN113612688B (en) Distributed software defined network control system and construction method thereof
CN111711675B (en) Solution for concurrent message transmission in local area network
US20150127799A1 (en) Hierarchical distribution of control information in a massively scalable network server
Chen et al. Efficient performance-centric bandwidth allocation with fairness tradeoff
US11256440B2 (en) Method and distributed storage system for aggregating statistics

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant