CN110650195A - Distributed load balancing method and device - Google Patents
Distributed load balancing method and device Download PDFInfo
- Publication number
- CN110650195A CN110650195A CN201910906325.9A CN201910906325A CN110650195A CN 110650195 A CN110650195 A CN 110650195A CN 201910906325 A CN201910906325 A CN 201910906325A CN 110650195 A CN110650195 A CN 110650195A
- Authority
- CN
- China
- Prior art keywords
- service
- service node
- request
- load
- node
- 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
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1001—Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
- H04L67/1004—Server selection for load balancing
- H04L67/1008—Server selection for load balancing based on parameters of servers, e.g. available memory or workload
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L45/00—Routing or path finding of packets in data switching networks
- H04L45/02—Topology update or discovery
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1001—Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
- H04L67/1029—Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers using data related to the state of servers by a load balancer
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/54—Presence management, e.g. monitoring or registration for receipt of user log-on information, or the connection status of the users
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/60—Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
- H04L67/63—Routing a service request depending on the request content or context
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Hardware Design (AREA)
- General Engineering & Computer Science (AREA)
- Computer And Data Communications (AREA)
Abstract
The embodiment of the specification provides a distributed load balancing method and a distributed load balancing device, wherein the method comprises the following steps: determining a service link formed by services corresponding to a request of a processing client; determining a service node with the largest load factor value in a service node cluster of the first service in the service link based on a service node routing table and a load information table which are constructed in advance; determining the service node with the maximum load factor value as a maximum load service node, and sending the request to the maximum load service node; after the most loaded service node processes the request, determining a service node in a cluster of service nodes for a next service in the service link associated with the most loaded service node based on the service node routing table; and sending the processing result of the maximum load service node on the request to a service node in a service node cluster of the next service in the service link.
Description
Technical Field
The embodiment of the specification relates to the technical field of computers, in particular to a distributed load balancing method. One or more embodiments of the present specification also relate to a distributed equalization apparatus, a computing device, and a computer-readable storage medium.
Background
With the adoption of the method, the service functions are single and internally aggregated by the SOA architecture, the micro-service architecture and the like, so that a complex multi-service combination call with a longer link is often involved in a distributed request call, and the load balancing of a complex even multiple heterogeneous service nodes is very difficult to realize.
Disclosure of Invention
In view of this, the present specification provides a distributed load balancing method. One or more embodiments of the present disclosure also relate to a distributed load balancing apparatus, a computing device, and a computer-readable storage medium to solve the technical problems in the prior art.
According to a first aspect of embodiments of the present specification, there is provided a distributed load balancing method, including:
determining a service link formed by services corresponding to a request of a processing client;
determining a service node with the largest load factor value in a service node cluster of a first service in the service link based on a service node routing table and a load information table which are constructed in advance, wherein the load information table is updated according to the monitored processing request quantity of the service nodes in the service node cluster of the service in the service link;
determining the service node with the maximum load factor value as a maximum load service node, and sending the request to the maximum load service node;
after the most loaded service node processes the request, determining a service node in a cluster of service nodes for a next service in the service link associated with the most loaded service node based on the service node routing table;
and sending the processing result of the maximum load service node on the request to a service node in a service node cluster of the next service in the service link.
Optionally, the sending the processing result of the maximum load service node on the request to the service node in the service node cluster of the next service in the service link includes:
determining a service node with the largest load factor value in a service node cluster of the next service in the service link based on the load information table;
and sending the processing result of the maximum load service node on the request to the service node with the maximum load factor value in the service node cluster of the next service.
Optionally, after sending the processing result of the maximum load service node on the request to the service node in the service node cluster of the next service in the service link, the method further includes:
determining whether a next service in the serving link is a last service in the serving link,
and if so, finishing processing the request based on the service node with the largest load factor value in the service node cluster of the next service in the service link.
Optionally, constructing the service node routing table includes:
determining a service node in a cluster of service nodes served in the service link;
determining an incidence relation between service nodes in the service node cluster of the service;
and constructing the service node routing table based on the incidence relation between the service and the service node in the corresponding service node cluster and the incidence relation between the service nodes in the service node cluster of the service.
Optionally, after the service node routing table is constructed based on the association relationship between the service and the service node in the corresponding service node cluster and the association relationship between the service nodes in the service node cluster of the service, the method further includes:
and monitoring service nodes in the service node cluster serving in the service link based on a heartbeat detection mechanism, and updating the service node routing table under the condition of determining that the service nodes are increased or decreased.
Optionally, constructing the load information table includes:
determining load fluctuation of the service node based on the number of processing requests of the service node;
determining a load factor value for the serving node based on the load fluctuation;
and constructing the load information table based on the incidence relation between the service nodes and the load factor values of the service nodes.
Optionally, the updating according to the monitored processing request number of the service nodes in the service node cluster served in the service link includes:
and updating the load information table according to the increase or decrease of the processing request quantity of the service nodes in the service node cluster which is served in the monitored service link.
Optionally, after sending the request to the maximum load service node, the method further includes:
acquiring a new load factor value of the maximum load service node, updating the new load factor value into the load factor value information table,
and the new load factor value comprises a load factor value obtained by recalculating the maximum load service node based on a preset load factor value calculation formula after receiving the request.
Optionally, the obtaining a new load factor value of the maximum load service node includes:
acquiring the processing request quantity of the maximum load service node at the moment Ti and the processing request quantity at the moment Ti-1,
the Ti time represents the time for receiving the request, and the Ti-1 time represents the time for receiving the last request of the request;
determining the load fluctuation of the maximum load service node based on the processing request quantity of the maximum load service node at the moment of Ti and the processing request quantity at the moment of Ti-1;
and determining a new load factor value of the maximum load service node according to the load fluctuation of the maximum load service node and the load factor value of the maximum load service node at the moment Ti.
Optionally, after determining, based on the service node routing table and the load information table that are constructed in advance, the service node with the largest load factor value in the service node cluster of the first service in the service link, the method further includes:
and sending the updated load information table to the service nodes in the service node cluster served in the service link.
Optionally, after determining, based on the service node routing table and the load information table that are constructed in advance, the service node with the largest load factor value in the service node cluster of the first service in the service link, the method further includes:
and sending the updated service node routing table to the service nodes in the service node cluster served in the service link.
According to a second aspect of embodiments of the present specification, there is provided a distributed load balancing apparatus, including:
the service link determining module is configured to determine a service link formed by services corresponding to the request of the client;
the first service node determining module is configured to determine a service node with a largest load factor value in a service node cluster of a first service in the service link based on a service node routing table and a load information table which are constructed in advance, wherein the load information table is updated according to the monitored processing request quantity of the service nodes in the service node cluster of the service in the service link;
a first request sending module configured to determine the service node with the largest load factor value as a maximum load service node, and send the request to the maximum load service node;
a second service node determination module configured to determine, based on the service node routing table, a service node in a cluster of service nodes for a next service in the service links associated with the most loaded service node after the most loaded service node processes the request;
a second request sending module configured to send a processing result of the maximum load service node on the request to a service node in a service node cluster of a next service in the service link.
Optionally, the second request sending module is further configured to:
determining a service node with the largest load factor value in a service node cluster of the next service in the service link based on the load information table;
and sending the processing result of the maximum load service node on the request to the service node with the maximum load factor value in the service node cluster of the next service.
Optionally, the apparatus further includes:
a determining module configured to determine whether a next service in the service link is a last service in the service link,
and if so, finishing processing the request based on the service node with the largest load factor value in the service node cluster of the next service in the service link.
Optionally, the apparatus further includes:
a service node routing table construction module configured to
Determining a service node in a cluster of service nodes served in the service link;
determining an incidence relation between service nodes in the service node cluster of the service;
and constructing the service node routing table based on the incidence relation between the service and the service node in the corresponding service node cluster and the incidence relation between the service nodes in the service node cluster of the service.
Optionally, the apparatus further includes:
and the service node routing table updating module is configured to monitor service nodes in a service node cluster serving in the service link based on a heartbeat detection mechanism, and update the service node routing table under the condition that the service nodes are determined to be increased or decreased.
Optionally, the apparatus further includes:
a load information table construction module configured to
Determining load fluctuation of the service node based on the number of processing requests of the service node;
determining a load factor value for the serving node based on the load fluctuation;
and constructing the load information table based on the incidence relation between the service nodes and the load factor values of the service nodes.
Optionally, the first service node determining module is further configured to:
and updating the load information table according to the increase or decrease of the processing request quantity of the service nodes in the service node cluster which is served in the monitored service link.
Optionally, the apparatus further includes:
a new load factor value obtaining module configured to obtain a new load factor value of the maximum load service node and update the new load factor value into the load factor value information table,
and the new load factor value comprises a load factor value obtained by recalculating the maximum load service node based on a preset load factor value calculation formula after receiving the request.
Optionally, the new load factor value obtaining module is further configured to:
acquiring the processing request quantity of the maximum load service node at the moment Ti and the processing request quantity at the moment Ti-1,
the Ti time represents the time for receiving the request, and the Ti-1 time represents the time for receiving the last request of the request;
determining the load fluctuation of the maximum load service node based on the processing request quantity of the maximum load service node at the moment of Ti and the processing request quantity at the moment of Ti-1;
and determining a new load factor value of the maximum load service node according to the load fluctuation of the maximum load service node and the load factor value of the maximum load service node at the moment Ti.
Optionally, the apparatus further includes:
and the load information table sending module is configured to send the updated load information table to the service nodes in the service node cluster served in the service link.
Optionally, the apparatus further includes:
and the service node routing table sending module is configured to send the updated service node routing table to service nodes in a service node cluster served in the service link.
According to a third aspect of embodiments herein, there is provided a computing device comprising:
a memory and a processor;
the memory is to store computer-executable instructions, and the processor is to execute the computer-executable instructions to:
determining a service link formed by services corresponding to a request of a processing client;
determining a service node with the largest load factor value in a service node cluster of a first service in the service link based on a service node routing table and a load information table which are constructed in advance, wherein the load information table is updated according to the monitored processing request quantity of the service nodes in the service node cluster of the service in the service link;
determining the service node with the maximum load factor value as a maximum load service node, and sending the request to the maximum load service node;
after the most loaded service node processes the request, determining a service node in a cluster of service nodes for a next service in the service link associated with the most loaded service node based on the service node routing table;
and sending the processing result of the maximum load service node on the request to a service node in a service node cluster of the next service in the service link.
According to a fourth aspect of embodiments herein, there is provided a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of any one of the distributed load balancing methods.
One embodiment of this specification implements a distributed load balancing method, including: determining a service link formed by services corresponding to a request of a processing client; determining a service node with the largest load factor value in a service node cluster of a first service in the service link based on a service node routing table and a load information table which are constructed in advance, wherein the load information table is updated according to the monitored processing request quantity of the service nodes in the service node cluster of the service in the service link; determining the service node with the maximum load factor value as a maximum load service node, and sending the request to the maximum load service node; after the most loaded service node processes the request, determining a service node in a cluster of service nodes for a next service in the service link associated with the most loaded service node based on the service node routing table; sending the processing result of the maximum load service node on the request to a service node in a service node cluster of the next service in the service link;
the distributed load balancing method determines a service node with the largest load factor value in a service node cluster of a first service in the service link, namely a maximum load service node, based on a constructed service node routing table and a load information table, after the maximum load service node processes the request, determines a service node with the largest load factor value in a service node cluster of a next service based on a constructed updated service node routing table and a constructed load information table, then sends a processing result of the request to the service node for processing, circularly processes the request in the above way until all services in the service link finish processing the request, and finally selects the service node with the largest load factor value in the service node cluster of each service based on the service node routing table and the load information table which are updated in real time, the service nodes form a service node sequence with smaller load and more balanced load when processing the request of the client, and a more comprehensive and more detailed distributed responsible balancing method for processing the request of the client can be provided according to the calling relationship and the load factor value condition of the service nodes in the service node cluster served in the whole service link.
Drawings
Fig. 1 is a flowchart of a distributed load balancing method according to an embodiment of the present specification;
FIG. 2 is a diagram illustrating an association relationship between a service and a service node provided by an embodiment of the present specification;
FIG. 3 is a schematic diagram illustrating changes in load factor values of a service node from time T1 to time T2 according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of a distributed load balancing apparatus according to an embodiment of the present disclosure;
fig. 5 is a block diagram of a computing device according to an embodiment of the present disclosure.
Detailed Description
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present description. This description may be embodied in many different forms and should not be construed as limited to the embodiments set forth herein, as those skilled in the art will be able to make and use the present disclosure without departing from the spirit and scope of the present disclosure.
The terminology used in the description of the one or more embodiments is for the purpose of describing the particular embodiments only and is not intended to be limiting of the description of the one or more embodiments. As used in one or more embodiments of the present specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used in one or more embodiments of the present specification refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It will be understood that, although the terms first, second, etc. may be used herein in one or more embodiments to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, a first can also be referred to as a second and, similarly, a second can also be referred to as a first without departing from the scope of one or more embodiments of the present description. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
First, the noun terms to which one or more embodiments of the present specification relate are explained.
SOA: a Service Oriented Architecture (SOA) is a component model that splits different functional units of an application (called services) and ties them up through well-defined interfaces and contracts between these services. The interface is defined in a neutral manner and should be independent of the hardware platform, operating system and programming language in which the service is implemented. This allows services built into a wide variety of systems to interact in a uniform and versatile manner.
Micro-service: the Micro Service Architecture (MSA) is a new technology for deploying applications and services in the cloud, and is a service-oriented architecture style, and decoupling of a solution is realized by dispersing functions into discrete services.
ip: the internet protocol address refers to an IP address, which means a digital label assigned to an Internet Protocol (IP) device used by a user to access internet.
Load balancing: load balancing is built on the existing network structure, and a cheap, effective and transparent method is provided to expand the bandwidth of network equipment and a server, increase the throughput, strengthen the network data processing capacity and improve the flexibility and the availability of the network; the processing request is distributed to a plurality of operation units to be executed, for example, a Web server, an FTP server, an enterprise key application server, other key task servers and the like, so that the work tasks are completed together.
The heartbeat detection mechanism is as follows: the sender sends a message with a fixed format to the receiver according to a certain rule (periodic sending, idle sending, etc.), and the receiver replies a message with a fixed format after receiving the message. The sender may be a client or a server, and the client is usually used as the sender according to actual situations.
In the present specification, a distributed load balancing method is provided, and the present specification relates to a distributed load balancing apparatus, a computing device, and a computer-readable storage medium, which are described in detail in the following embodiments one by one.
The distributed load balancing method in one or more embodiments of the present specification is applied to a load balancer for explanation.
Fig. 1 shows a flowchart of a distributed load balancing method according to an embodiment of the present disclosure, which includes steps 102 to 110.
Step 102: and determining a service link formed by the service corresponding to the request of the processing client.
From the viewpoint of the load balancer, a service link for processing a service composition corresponding to a request of a client is determined, that is, after the load balancer receives the request of the client, the service link for processing the service composition corresponding to the request of the client is determined based on the request of the client.
The request of the client is set according to a specific application scenario of the distributed load balancing method, for example, the distributed load balancing method is applied to a shopping website, and the request of the client may be a request for purchasing an item.
Still taking the request of the client as an example of purchasing a certain item at a certain shopping website, processing the service corresponding to the request of the client can be understood as a service supporting the completion of purchasing a certain item at a certain shopping website, namely a series of services supporting the successful completion of purchasing a certain item at a certain shopping website, such as browsing a certain item, adding a certain item to a shopping cart, generating an order for a certain item added to a shopping cart, paying for the completion of purchasing a certain item, and the like.
Correspondingly, the service link formed by the services may be understood as a service sequence for processing a plurality of services corresponding to the client requests.
Referring to fig. 2, fig. 2 shows a relationship among requests, services and service links formed by the services of the clients, first, a load balancer receives a request of a client 1 and/or a client 2, and if a service corresponding to the request of the client 1 includes service 1 and service 2, it is determined that a service link for processing the service formed by the request of the client includes [ service 1, service 2 ], and if a service corresponding to the request of the client 2 includes service 1, service 2 and service 3, it is determined that a service link for processing the service formed by the request of the client includes [ service 1, service 2, service 3 ].
In specific implementation, the request of the client carries request information, where the request information includes, but is not limited to, a service interface name, a request parameter, a calling party, i.e., a client ip, and a called party, i.e., a service party ip corresponding to the request, and then a service link formed by processing a service corresponding to the request is found based on the request information.
Step 104: and determining the service node with the largest load factor value in the service node cluster of the first service in the service link based on a service node routing table and a load information table which are constructed in advance, wherein the load information table is updated according to the monitored processing request quantity of the service nodes in the service node cluster of the service in the service link.
In one or more embodiments of the present specification, constructing the service node routing table includes:
determining a service node in a cluster of service nodes served in the service link;
determining an incidence relation between service nodes in the service node cluster of the service;
and constructing the service node routing table based on the incidence relation between the service and the service node in the corresponding service node cluster and the incidence relation between the service nodes in the service node cluster of the service.
Still taking fig. 2 as an example, if the service link includes [ service 1, service 2, and service 3 ], the service node in the service node cluster of service 1 in the service link includes [ service node 1.1 and service node 1.2 ], the service node in the service node cluster of service 2 in the service link includes [ service node 2.1, service node 2.2, and service node 2.3 ], and the service node in the service node cluster of service 3 in the service link includes [ service node 3.1, service node 3.2, service node 3.3, and service node 3.4 ], while in actual application, the number of services in the service link is determined according to a received request of a client, and the number of service nodes in each service node cluster is also not fixed, and may be increased or decreased according to actual needs, which is not limited herein.
The association relationship between the service nodes in the service node cluster of the service can be understood as the association relationship between the service node 1.1 and the service node 1.2 in the service node cluster of the service 1 and the service node 2.1, the service node 2.2 and the service node 2.3 in the service node cluster of the service 2, and the association relationship between the service node 2.1, the service node 2.2 and the service node 2.3 in the service node cluster of the service 2 and the service node 3.1, the service node 3.2, the service node 3.3 and the service node 3.4 in the service node cluster of the service 3.
The table 1 may be referred to for constructing the service node routing table based on the association relationship between the service and the service node in the corresponding service node cluster and the association relationship between the service nodes in the service node cluster of the service.
TABLE 1
According to table 1, service nodes corresponding to service 1, service 2, and service 3, respectively, and an association relationship between each service node in service 1, service 2, and service 3 can be seen. In addition, table 1 does not exclude that other data may be included, and the configuration may be performed according to practical applications, and is not limited herein.
In one or more embodiments of the present specification, after the constructing the service node routing table based on the association relationship between the service and the service node in the corresponding service node cluster and the association relationship between service nodes in the service node cluster of the service, the method further includes:
and monitoring service nodes in the service node cluster serving in the service link based on a heartbeat detection mechanism, and updating the service node routing table under the condition of determining that the service nodes are increased or decreased.
After the service node routing table is constructed, when new service nodes are added (on-line) in a service node cluster of a monitored service or service nodes in the constructed service node routing table are reduced (off-line), the specific conditions of the addition or reduction of the service nodes are determined, and the service node routing table is updated.
In one or more embodiments of this specification, after determining, based on a service node routing table and a load information table that are constructed in advance, a service node in a service node cluster of a first service in the service link, where a load factor value is the largest, the method further includes:
and sending the updated service node routing table to the service nodes in the service node cluster served in the service link.
Specifically, after the updated routing table of the service node is sent to the service nodes in the service node cluster served in the service link, each service node will call the service node of the next service according to the association relationship between the latest service nodes, so that the corresponding load balancing policy can be adaptively adjusted.
In one or more embodiments of the present specification, constructing the load information table includes:
determining load fluctuation of the service node based on the number of processing requests of the service node;
determining a load factor value for the serving node based on the load fluctuation;
and constructing the load information table based on the incidence relation between the service nodes and the load factor values of the service nodes.
In practical applications, the initial value of the load factor value of the service node is 1, and when the load balancer receives a request from a client and distributes the request to the service node for processing, the load factor value of the service node changes based on the number of processed requests from the client.
Taking the time when the service node processes the current request of the client as T1 as an example, the load fluctuation of the service node is determined.
The time when the service node processes the current request of the client is T1, the time when the last request of the current request of the client is processed is T2, and the service node does not end the request in the period from T2 to T1, then the load fluctuation of the service node in the period from T2 to T1 is calculated based on formula 1.
Load fluctuation (L (T1) -L (T2))/(T1-T2) formula 1
Where L (T1) represents the number of processing requests of the service node at time T1, and L (T2) represents the number of processing requests of the service node at time T2.
If the service node has the request end in the period from T2 to T1, the load fluctuation of the service node in the period from T2 to T1 is calculated based on the formula 2.
Load fluctuation (1-END (T2, T1))/(T1-T2) formula 2
Wherein END (T2, T1) represents the number of requests for the service node to END in the period of T2 to T1.
As can be seen from the above, the load fluctuation of the service node is determined based on the number of processing requests of the service node, the first is that if the service node does not request processing to END in the period from T2 to T1, the amount of increase in processing requests of the service node between the current request and the last request of the current request is 1, and the second is that if the service node has request processing to END in the period from T2 to T1, the amount of change in processing requests of the service node in the period from T2 to T1 is equal to 1 minus the number of services ending in the period from T2 to T1, i.e., L (T1) -L (T2) -1-END (T2, T1).
And determining the load factor value of the service node based on the load fluctuation may be calculated based on equation 3.
Load factor value ═ 1-X (1-END (T2, T1))/(T1-T2))/(current LF equation 3
Where X is a fluctuation factor coefficient, which is a parameter for controlling the attenuation and the increment rate, and may be set according to practical applications, which is not limited herein, and may be set to X ═ 0.3, for example; LF represents a load factor value and the current LF represents a current load factor value.
The LF identifies the load capacity which can be accommodated by the current server, the value range is 0 to 1, and the larger the LF is, the larger the load capacity of the service node is identified. The value of the LF is continuously adaptively adjusted according to the request invocation condition (i.e. the load fluctuation condition of the service node).
Taking the example that the service includes service 1, service 2 and service 3, the service node in the service node cluster of service 1 includes service node 1.1 and service node 1.2, the service node in the service node cluster of service 2 includes service node 2.1, service node 2.2 and service node 2.3, and the service node in the service node cluster of service 3 includes service node 3.1, service node 3.2, service node 3.3 and service node 3.4.
The table of load information is constructed based on the association relationship between the service node and the load factor value of the service node, which can be referred to as table 2.
TABLE 2
From table 2, the load factor values of the service nodes in the service node cluster of service 1, service 2 and service 3 can be seen. In addition, table 2 does not exclude that other data may be included, and the configuration may be performed according to practical applications, and is not limited herein.
In one or more embodiments of the present specification, the updating according to the monitored processing request number of the service nodes in the service node cluster served in the service link includes:
and updating the load information table according to the increase or decrease of the processing request quantity of the service nodes in the service node cluster which is served in the monitored service link.
After the load information table is constructed, the processing request number of the service nodes in the service node cluster in the service link can be periodically monitored, and then partial data updating is carried out on the load information table according to the increase or decrease of the processing request number of the service nodes in the service node cluster served in the service link, so that the expansibility is good, and the method is more suitable for the condition of dynamic service node change in a distributed environment.
If the service link includes [ service 1, service 2, and service 3 ], the first service in the service link is service 1, it can be known from table 1 that the service node in the service node cluster of service 1 includes service node 1.1 and service node 1.2, and it can be known from table 2 that the load factor value of the service node 1.1 is 0.2 and the load factor value of the service node 1.2 is 0.3, and it is determined that the service node with the largest load factor value in the service node cluster of the first service in the service link is the service node 1.2 based on a service node routing table and a load information table which are constructed in advance.
In one or more embodiments of this specification, after determining, based on a service node routing table and a load information table that are constructed in advance, a service node in a service node cluster of a first service in the service link, where a load factor value is the largest, the method further includes:
and sending the updated load information table to the service nodes in the service node cluster served in the service link.
Specifically, after the updated load information table is sent to the service nodes in the service node cluster served in the service link, each service node performs the calculation of the relevant load factor value according to the processing request number of the latest service node when calculating the load factor value, so as to adaptively adjust the corresponding load balancing policy.
Step 106: and determining the service node with the maximum load factor value as a maximum load service node, and sending the request to the maximum load service node.
Taking the service node with the largest load factor value as the service node 1.2 as an example, determining the service node 1.2 as a maximum load service node, and sending the request to the maximum load service node.
In one or more embodiments of the present specification, after sending the request to the maximum load service node, the method further includes:
acquiring a new load factor value of the maximum load service node, updating the new load factor value into the load factor value information table,
and the new load factor value comprises a load factor value obtained by recalculating the maximum load service node based on a preset load factor value calculation formula after receiving the request.
Specifically, the obtaining of the new load factor value of the maximum load service node includes:
acquiring the processing request quantity of the maximum load service node at the moment Ti and the processing request quantity at the moment Ti-1,
the Ti time represents the time for receiving the request, and the Ti-1 time represents the time for receiving the last request of the request;
determining the load fluctuation of the maximum load service node based on the processing request quantity of the maximum load service node at the moment of Ti and the processing request quantity at the moment of Ti-1;
and determining a new load factor value of the maximum load service node according to the load fluctuation of the maximum load service node and the load factor value of the maximum load service node at the moment Ti.
In practical applications, the method for obtaining the new load factor value of the maximum load service node is the same as that in the above embodiment, and is obtained by calculation according to formula 1, formula 2, and formula 3 on the basis of obtaining the number of processing requests of the maximum load service node, and the specific calculation manner may refer to the above embodiment, which is not described herein again.
In specific implementation, after receiving a request of each client, a load balancer obtains a new load factor value of a maximum load service node once after sending the request to the maximum load service node of a first service, and updates the load information table once when the new load factor value of the maximum load service node is inconsistent with the load factor value of the maximum load service node in the load information table, so as to ensure that the load factor value of the service node in the load information table is latest after receiving a request of a next client, and ensure that an optimal service link is determined for the request of the next client.
Step 108: after the most loaded service node processes the request, determining a service node in a cluster of service nodes for a next service in the service links associated with the most loaded service node based on the service node routing table.
Wherein, after the most loaded service node processes the request, a service node in a cluster of service nodes for a next service in the service link associated with the most loaded service node is determined based on the updated service node routing table.
In practical application, service nodes in a service node cluster of a service are increased or decreased according to actual conditions, and at different times, association relations between the service and the service nodes and between the service nodes are changed, so that it is necessary to determine a service node in a service node cluster of a next service in a service link associated with the maximum load service node based on the updated service node routing table, so as to avoid that when the service node associated with the maximum load service node is queried based on a service node routing table which is not updated, due to the increase or decrease of the service nodes, the service nodes which are not associated with the service nodes are not searched or not fully queried, so that a service node sequence corresponding to a request of a subsequent processing client is inaccurate, and an optimal policy for processing the request cannot be formed.
Step 110: and sending the processing result of the maximum load service node on the request to a service node in a service node cluster of the next service in the service link.
In one or more embodiments of the present specification, the sending a processing result of the maximum load service node on the request to a service node in a service node cluster of a next service in the service link includes:
determining a service node with the largest load factor value in a service node cluster of the next service in the service link based on the load information table;
and sending the processing result of the maximum load service node on the request to the service node with the maximum load factor value in the service node cluster of the next service.
Still taking the service link comprising [ service 1, service 2, and service 3 ] as an example, referring to table 1, it can be known that the next service in the service link is service 2, and the service nodes in the service node cluster of the next service comprise service node 2.1, service node 2.2, and service node 2.3;
as can be seen from table 2, the service node with the largest load factor value in the service node cluster of the next service in the service link is the service node 2.2.
Specifically, after the sending of the processing result of the maximum load service node on the request to the service node in the service node cluster of the next service in the service link, the method further includes:
determining whether a next service in the serving link is a last service in the serving link,
and if so, finishing processing the request based on the service node with the largest load factor value in the service node cluster of the next service in the service link.
In practical application, after the service node with the largest load factor value in the service node cluster of the first service in the service link completes processing of the request, the service node with the largest load factor value in the service node cluster of the next service is determined based on the updated service node routing table and the load information table, then the processed request is sent to the service node for continuous processing, if two services exist in the service link, the processing of the request by the service node with the largest load factor value in the service node cluster of the next service is completed, if a plurality of services exist in the service link, each service after the first service in the service link processes the request processed by the service node with the largest load factor value in the service node cluster of the previous service in the above manner in a circulating manner, and completing the processing of the request until the processing of the request by all the services in the service link is finished, and finally forming a complete service node sequence, wherein the service node sequence is a more balanced call link with smaller load for processing the request.
In a specific implementation, the request of one client needs to be processed by a service node with the largest load factor value in a service node cluster of multiple services, for example, when an a item is purchased at an a website, the request of browsing the a item in the request of the client is sent to the service node a1 with the largest load factor value of the a service for processing, after the request of browsing the a item in the request is completed by the service node a1 with the largest load factor value of the a service, the request of adding the a item to a shopping cart in the request is sent to the service node B1 with the largest load factor value of the B service for processing, after the request of adding the a item to the shopping cart in the request is processed by the service node B1 with the largest load factor value of the B service, the request of generating an order by the a item in the shopping cart in the request is sent to the service node C1 with the largest load factor value of the C service for processing, after the service node C1 with the largest load factor value of the C service generates an order for A in the shopping cart in the request, the request for settlement of the A item in the request is sent to the service node D1 with the largest load factor value of the D service for processing, the service node D1 with the largest load factor value of the D service settles the A item generating the order in the request, at the moment, the request of the client is processed, and at the moment, the complete service node sequence formed by completing the request is [ A1, B1, C1 and D1 ].
Referring to fig. 3, fig. 3 shows a schematic diagram of a change of the load factor value from time T1 to time T2 of the service node.
Firstly, service links of corresponding service compositions determined based on a received request of a client are [ S1, S2, S3 ], wherein a service node in a service node cluster of the service S1 is S (1.1), service nodes in a service node cluster of the service S2 are S (2.1) and S (2.2), and service nodes in a service node cluster of the service S3 are S (3.1), S (3.2) and S (3.3); at time T1, the load factor value of the service node S (1.1) is 0.5, the load factor value of the service node S (2.1) is 0.4, the load factor value of the service node S (2.2) is 0.5, the load factor value of the service node S (3.1) is 0.2, the load factor value of the service node S (3.2) is 0.3, and the load factor value of the service node S (3.3) is 0.5, after 5 time intervals, there are 2 requests completed by time T2, and a complete service node sequence [ service node S (1.1), service node S (2.2), and service node S (3.3) ] is obtained, if there are 4 requests in the service node sequence, then the load factor value of the corresponding service node sequence at time T2 is calculated by formula 3:
load factor value ═ 1-X (1-END (T2, T1))/(T1-T2))/(current LF
Where X is 0.3, END (T2, T1) indicates a ratio of requests completed by the service node sequence in a time period from T1 to T2, that is, a ratio of requests already existing by the service node sequence to requests completed in a time period from T1 to T2, that is, a time interval from END (T2, T1) to T2/4 and from T1 to T2 is 5s (unit time interval is 5s), then T2-T1 is 5/5 is 1.
Then, the above parameter values are substituted into equation 3, and then the load factor value is obtained as (1-0.3 (1- (2/4))/1) × 0.5 ═ 0.425, that is, the load factor value of the service node sequence is obtained as 0.425.
According to the distributed load balancing method provided by one or more embodiments of the present specification, a service node routing table and a load information table can be constructed according to the obtained basic information such as the association relationship between the service and the service nodes, the number of processing requests of each service node, the online and offline of the service node, and the like, and then according to a distributed load balancing distribution algorithm, a system load is calculated for the request of the client in a self-adaptive manner, and a more balanced call link is a service node sequence obtained by the method, and the method considers the call relationship and the load condition of the whole call link, so that the load of the system can be considered more comprehensively and carefully; in addition, the method only depends on information such as the number of processing requests of the service node in a certain time period as a load factor value metering decision factor, so that the load factor value is convenient to obtain; in addition, the service node routing table and the load information table in the method can only need to perform partial data updating on the service node routing table and the load information table when the service node and the service node process the change of the request quantity, have better expansibility and are more suitable for the condition of dynamic service node change in a distributed environment.
Corresponding to the above method embodiment, the present specification further provides an embodiment of a distributed load balancing apparatus, and fig. 4 shows a schematic structural diagram of a distributed load balancing apparatus provided in an embodiment of the present specification. As shown in fig. 4, the apparatus 400 includes:
a service link determining module 402 configured to determine a service link composed of services corresponding to a request of a client;
a first service node determining module 404, configured to determine, based on a service node routing table and a load information table constructed in advance, a service node with a largest load factor value in a service node cluster served first in the service link, where the load information table is updated according to the monitored processing request number of the service nodes in the service node cluster served in the service link;
a first request sending module 406, configured to determine the service node with the largest load factor value as a maximum load service node, and send the request to the maximum load service node;
a second service node determination module 408 configured to determine, based on the service node routing table, a service node in a cluster of service nodes for a next service in the service links associated with the most loaded service node after the most loaded service node processes the request;
a second request sending module 410 configured to send a result of processing the request by the most loaded service node to a service node in the service node cluster of the next service in the service link.
Optionally, the second request sending module 406 is further configured to:
determining a service node with the largest load factor value in a service node cluster of the next service in the service link based on the load information table;
and sending the processing result of the maximum load service node on the request to the service node with the maximum load factor value in the service node cluster of the next service.
Optionally, the apparatus further includes:
a determining module configured to determine whether a next service in the service link is a last service in the service link,
and if so, finishing processing the request based on the service node with the largest load factor value in the service node cluster of the next service in the service link.
Optionally, the apparatus further includes:
a service node routing table construction module configured to
Determining a service node in a cluster of service nodes served in the service link;
determining an incidence relation between service nodes in the service node cluster of the service;
and constructing the service node routing table based on the incidence relation between the service and the service node in the corresponding service node cluster and the incidence relation between the service nodes in the service node cluster of the service.
Optionally, the apparatus further includes:
and the service node routing table updating module is configured to monitor service nodes in a service node cluster serving in the service link based on a heartbeat detection mechanism, and update the service node routing table under the condition that the service nodes are determined to be increased or decreased.
Optionally, the apparatus further includes:
a load information table construction module configured to
Determining load fluctuation of the service node based on the number of processing requests of the service node;
determining a load factor value for the serving node based on the load fluctuation;
and constructing the load information table based on the incidence relation between the service nodes and the load factor values of the service nodes.
Optionally, the first serving node determining module 404 is further configured to:
and updating the load information table according to the increase or decrease of the processing request quantity of the service nodes in the service node cluster which is served in the monitored service link.
Optionally, the apparatus further includes:
a new load factor value obtaining module configured to obtain a new load factor value of the maximum load service node and update the new load factor value into the load factor value information table,
and the new load factor value comprises a load factor value obtained by recalculating the maximum load service node based on a preset load factor value calculation formula after receiving the request.
Optionally, the new load factor value obtaining module is further configured to:
acquiring the processing request quantity of the maximum load service node at the moment Ti and the processing request quantity at the moment Ti-1,
the Ti time represents the time for receiving the request, and the Ti-1 time represents the time for receiving the last request of the request;
determining the load fluctuation of the maximum load service node based on the processing request quantity of the maximum load service node at the moment of Ti and the processing request quantity at the moment of Ti-1;
and determining a new load factor value of the maximum load service node according to the load fluctuation of the maximum load service node and the load factor value of the maximum load service node at the moment Ti.
Optionally, the apparatus further includes:
and the load information table sending module is configured to send the updated load information table to the service nodes in the service node cluster served in the service link.
Optionally, the apparatus further includes:
and the service node routing table sending module is configured to send the updated service node routing table to service nodes in a service node cluster served in the service link.
According to a third aspect of embodiments herein, there is provided a computing device comprising:
a memory and a processor;
the memory is to store computer-executable instructions, and the processor is to execute the computer-executable instructions to:
determining a service link formed by services corresponding to a request of a processing client;
determining a service node with the largest load factor value in a service node cluster of a first service in the service link based on a service node routing table and a load information table which are constructed in advance, wherein the load information table is updated according to the monitored processing request quantity of the service nodes in the service node cluster of the service in the service link;
determining the service node with the maximum load factor value as a maximum load service node, and sending the request to the maximum load service node;
after the most loaded service node processes the request, determining a service node in a cluster of service nodes for a next service in the service link associated with the most loaded service node based on the service node routing table;
and sending the processing result of the maximum load service node on the request to a service node in a service node cluster of the next service in the service link.
The distributed load balancing device provided in one or more embodiments of the present specification can construct a service node routing table and a load information table according to the obtained basic information such as the association relationship between the service and the service nodes, the number of processing requests of each service node, the online and offline of the service node, and the like, and then can adaptively calculate a system load for the request of the client according to a distributed load balancing distribution algorithm, where a more balanced call link is a service node sequence obtained by the method, and the method considers the call relationship and the load condition of the whole call link, so that the load of the system can be considered more comprehensively and carefully; in addition, the method only depends on information such as the number of processing requests of the service node in a certain time period as a load factor value metering decision factor, so that the load factor value is convenient to obtain; in addition, the service node routing table and the load information table in the method can only need to perform partial data updating on the service node routing table and the load information table when the service node and the service node process the change of the request quantity, have better expansibility and are more suitable for the condition of dynamic service node change in a distributed environment.
The foregoing is a schematic scheme of a distributed load balancing apparatus according to this embodiment. It should be noted that the technical solution of the distributed load balancing apparatus and the technical solution of the distributed load balancing method belong to the same concept, and details of the technical solution of the distributed load balancing apparatus, which are not described in detail, can be referred to the description of the technical solution of the distributed load balancing method.
FIG. 5 illustrates a block diagram of a computing device 500 provided in accordance with one embodiment of the present description. The components of the computing device 500 include, but are not limited to, a memory 510 and a processor 520. Processor 520 is coupled to memory 510 via bus 530, and database 550 is used to store data.
Computing device 500 also includes access device 540, access device 540 enabling computing device 500 to communicate via one or more networks 560. Examples of such networks include the Public Switched Telephone Network (PSTN), a Local Area Network (LAN), a Wide Area Network (WAN), a Personal Area Network (PAN), or a combination of communication networks such as the internet. The access device 540 may include one or more of any type of network interface, e.g., a Network Interface Card (NIC), wired or wireless, such as an IEEE802.11 Wireless Local Area Network (WLAN) wireless interface, a worldwide interoperability for microwave access (Wi-MAX) interface, an ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a bluetooth interface, a Near Field Communication (NFC) interface, and so forth.
In one embodiment of the present description, the above-described components of computing device 500, as well as other components not shown in FIG. 5, may also be connected to each other, such as by a bus. It should be understood that the block diagram of the computing device architecture shown in FIG. 5 is for purposes of example only and is not limiting as to the scope of the present description. Those skilled in the art may add or replace other components as desired.
Computing device 500 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., tablet, personal digital assistant, laptop, notebook, netbook, etc.), mobile phone (e.g., smartphone), wearable computing device (e.g., smartwatch, smartglasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop computer or PC. Computing device 500 may also be a mobile or stationary server.
Wherein processor 520 is configured to execute the following computer-executable instructions:
determining a service link formed by services corresponding to a request of a processing client;
determining a service node with the largest load factor value in a service node cluster of a first service in the service link based on a service node routing table and a load information table which are constructed in advance, wherein the load information table is updated according to the monitored processing request quantity of the service nodes in the service node cluster of the service in the service link;
determining the service node with the maximum load factor value as a maximum load service node, and sending the request to the maximum load service node;
after the most loaded service node processes the request, determining a service node in a cluster of service nodes for a next service in the service link associated with the most loaded service node based on the service node routing table;
and sending the processing result of the maximum load service node on the request to a service node in a service node cluster of the next service in the service link.
Optionally, the sending the processing result of the maximum load service node on the request to the service node in the service node cluster of the next service in the service link includes:
determining a service node with the largest load factor value in a service node cluster of the next service in the service link based on the load information table;
and sending the processing result of the maximum load service node on the request to the service node with the maximum load factor value in the service node cluster of the next service.
Optionally, after sending the processing result of the maximum load service node on the request to the service node in the service node cluster of the next service in the service link, the method further includes:
determining whether a next service in the serving link is a last service in the serving link,
and if so, finishing processing the request based on the service node with the largest load factor value in the service node cluster of the next service in the service link.
Optionally, constructing the service node routing table includes:
determining a service node in a cluster of service nodes served in the service link;
determining an incidence relation between service nodes in the service node cluster of the service;
and constructing the service node routing table based on the incidence relation between the service and the service node in the corresponding service node cluster and the incidence relation between the service nodes in the service node cluster of the service.
Optionally, after the service node routing table is constructed based on the association relationship between the service and the service node in the corresponding service node cluster and the association relationship between the service nodes in the service node cluster of the service, the method further includes:
and monitoring service nodes in the service node cluster serving in the service link based on a heartbeat detection mechanism, and updating the service node routing table under the condition of determining that the service nodes are increased or decreased.
Optionally, constructing the load information table includes:
determining load fluctuation of the service node based on the number of processing requests of the service node;
determining a load factor value for the serving node based on the load fluctuation;
and constructing the load information table based on the incidence relation between the service nodes and the load factor values of the service nodes.
Optionally, the updating according to the monitored processing request number of the service nodes in the service node cluster served in the service link includes:
and updating the load information table according to the increase or decrease of the processing request quantity of the service nodes in the service node cluster which is served in the monitored service link.
Optionally, after sending the request to the maximum load service node, the method further includes:
acquiring a new load factor value of the maximum load service node, updating the new load factor value into the load factor value information table,
and the new load factor value comprises a load factor value obtained by recalculating the maximum load service node based on a preset load factor value calculation formula after receiving the request.
Optionally, the obtaining a new load factor value of the maximum load service node includes:
acquiring the processing request quantity of the maximum load service node at the moment Ti and the processing request quantity at the moment Ti-1,
the Ti time represents the time for receiving the request, and the Ti-1 time represents the time for receiving the last request of the request;
determining the load fluctuation of the maximum load service node based on the processing request quantity of the maximum load service node at the moment of Ti and the processing request quantity at the moment of Ti-1;
and determining a new load factor value of the maximum load service node according to the load fluctuation of the maximum load service node and the load factor value of the maximum load service node at the moment Ti.
Optionally, after determining, based on the service node routing table and the load information table that are constructed in advance, the service node with the largest load factor value in the service node cluster of the first service in the service link, the method further includes:
and sending the updated load information table to the service nodes in the service node cluster served in the service link.
Optionally, after determining, based on the service node routing table and the load information table that are constructed in advance, the service node with the largest load factor value in the service node cluster of the first service in the service link, the method further includes:
and sending the updated service node routing table to the service nodes in the service node cluster served in the service link.
The above is an illustrative scheme of a computing device of the present embodiment. It should be noted that the technical solution of the computing device and the technical solution of the distributed load balancing method described above belong to the same concept, and details that are not described in detail in the technical solution of the computing device can be referred to the description of the technical solution of the distributed load balancing method described above.
An embodiment of the present specification also provides a computer readable storage medium storing computer instructions that, when executed by a processor, are operable to:
determining a service link formed by services corresponding to a request of a processing client;
determining a service node with the largest load factor value in a service node cluster of a first service in the service link based on a service node routing table and a load information table which are constructed in advance, wherein the load information table is updated according to the monitored processing request quantity of the service nodes in the service node cluster of the service in the service link;
determining the service node with the maximum load factor value as a maximum load service node, and sending the request to the maximum load service node;
after the most loaded service node processes the request, determining a service node in a cluster of service nodes for a next service in the service link associated with the most loaded service node based on the service node routing table;
and sending the processing result of the maximum load service node on the request to a service node in a service node cluster of the next service in the service link.
Optionally, the sending the processing result of the maximum load service node on the request to the service node in the service node cluster of the next service in the service link includes:
determining a service node with the largest load factor value in a service node cluster of the next service in the service link based on the load information table;
and sending the processing result of the maximum load service node on the request to the service node with the maximum load factor value in the service node cluster of the next service.
Optionally, after sending the processing result of the maximum load service node on the request to the service node in the service node cluster of the next service in the service link, the method further includes:
determining whether a next service in the serving link is a last service in the serving link,
and if so, finishing processing the request based on the service node with the largest load factor value in the service node cluster of the next service in the service link.
Optionally, constructing the service node routing table includes:
determining a service node in a cluster of service nodes served in the service link;
determining an incidence relation between service nodes in the service node cluster of the service;
and constructing the service node routing table based on the incidence relation between the service and the service node in the corresponding service node cluster and the incidence relation between the service nodes in the service node cluster of the service.
Optionally, after the service node routing table is constructed based on the association relationship between the service and the service node in the corresponding service node cluster and the association relationship between the service nodes in the service node cluster of the service, the method further includes:
and monitoring service nodes in the service node cluster serving in the service link based on a heartbeat detection mechanism, and updating the service node routing table under the condition of determining that the service nodes are increased or decreased.
Optionally, constructing the load information table includes:
determining load fluctuation of the service node based on the number of processing requests of the service node;
determining a load factor value for the serving node based on the load fluctuation;
and constructing the load information table based on the incidence relation between the service nodes and the load factor values of the service nodes.
Optionally, the updating according to the monitored processing request number of the service nodes in the service node cluster served in the service link includes:
and updating the load information table according to the increase or decrease of the processing request quantity of the service nodes in the service node cluster which is served in the monitored service link.
Optionally, after sending the request to the maximum load service node, the method further includes:
acquiring a new load factor value of the maximum load service node, updating the new load factor value into the load factor value information table,
and the new load factor value comprises a load factor value obtained by recalculating the maximum load service node based on a preset load factor value calculation formula after receiving the request.
Optionally, the obtaining a new load factor value of the maximum load service node includes:
acquiring the processing request quantity of the maximum load service node at the moment Ti and the processing request quantity at the moment Ti-1,
the Ti time represents the time for receiving the request, and the Ti-1 time represents the time for receiving the last request of the request;
determining the load fluctuation of the maximum load service node based on the processing request quantity of the maximum load service node at the moment of Ti and the processing request quantity at the moment of Ti-1;
and determining a new load factor value of the maximum load service node according to the load fluctuation of the maximum load service node and the load factor value of the maximum load service node at the moment Ti.
Optionally, after determining, based on the service node routing table and the load information table that are constructed in advance, the service node with the largest load factor value in the service node cluster of the first service in the service link, the method further includes:
and sending the updated load information table to the service nodes in the service node cluster served in the service link.
Optionally, after determining, based on the service node routing table and the load information table that are constructed in advance, the service node with the largest load factor value in the service node cluster of the first service in the service link, the method further includes:
and sending the updated service node routing table to the service nodes in the service node cluster served in the service link.
The above is an illustrative scheme of a computer-readable storage medium of the present embodiment. It should be noted that the technical solution of the storage medium belongs to the same concept as the technical solution of the distributed load balancing method described above, and for details that are not described in detail in the technical solution of the storage medium, reference may be made to the description of the technical solution of the distributed load balancing method described above.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The computer instructions comprise computer program code which may be in the form of source code, object code, an executable file or some intermediate form, or the like. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
It should be noted that, for the sake of simplicity, the foregoing method embodiments are described as a series of acts, but those skilled in the art should understand that the present embodiment is not limited by the described acts, because some steps may be performed in other sequences or simultaneously according to the present embodiment. Further, those skilled in the art should also appreciate that the embodiments described in this specification are preferred embodiments and that acts and modules referred to are not necessarily required for an embodiment of the specification.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
The preferred embodiments of the present specification disclosed above are intended only to aid in the description of the specification. Alternative embodiments are not exhaustive and do not limit the invention to the precise embodiments described. Obviously, many modifications and variations are possible in light of the above teaching. The embodiments were chosen and described in order to best explain the principles of the embodiments and the practical application, to thereby enable others skilled in the art to best understand and utilize the embodiments. The specification is limited only by the claims and their full scope and equivalents.
Claims (16)
1. A distributed load balancing method, comprising:
determining a service link formed by services corresponding to a request of a processing client;
determining a service node with the largest load factor value in a service node cluster of a first service in the service link based on a service node routing table and a load information table which are constructed in advance, wherein the load information table is updated according to the monitored processing request quantity of the service nodes in the service node cluster of the service in the service link;
determining the service node with the maximum load factor value as a maximum load service node, and sending the request to the maximum load service node;
after the most loaded service node processes the request, determining a service node in a cluster of service nodes for a next service in the service link associated with the most loaded service node based on the service node routing table;
and sending the processing result of the maximum load service node on the request to a service node in a service node cluster of the next service in the service link.
2. The method of claim 1, the sending the results of the processing of the request by the most loaded service node to a service node in a cluster of service nodes for a next service in the service link comprising:
determining a service node with the largest load factor value in a service node cluster of the next service in the service link based on the load information table;
and sending the processing result of the maximum load service node on the request to the service node with the maximum load factor value in the service node cluster of the next service.
3. The method of claim 2, after sending the result of processing the request by the most loaded service node to a service node in a cluster of service nodes for a next service in the service link, further comprising:
determining whether a next service in the serving link is a last service in the serving link,
and if so, finishing processing the request based on the service node with the largest load factor value in the service node cluster of the next service in the service link.
4. The method of claim 1, constructing the service node routing table comprising:
determining a service node in a cluster of service nodes served in the service link;
determining an incidence relation between service nodes in the service node cluster of the service;
and constructing the service node routing table based on the incidence relation between the service and the service node in the corresponding service node cluster and the incidence relation between the service nodes in the service node cluster of the service.
5. The method of claim 4, further comprising, after constructing the service node routing table based on the association of the service with the service nodes in the corresponding service node cluster and the association between the service nodes in the service node cluster of the service:
and monitoring service nodes in the service node cluster serving in the service link based on a heartbeat detection mechanism, and updating the service node routing table under the condition of determining that the service nodes are increased or decreased.
6. The method of claim 1, constructing the load information table comprising:
determining load fluctuation of the service node based on the number of processing requests of the service node;
determining a load factor value for the serving node based on the load fluctuation;
and constructing the load information table based on the incidence relation between the service nodes and the load factor values of the service nodes.
7. The method of claim 6, the updating according to the number of processing requests of the service nodes in the cluster of service nodes served in the service link that are listened to comprises:
and updating the load information table according to the increase or decrease of the processing request quantity of the service nodes in the service node cluster which is served in the monitored service link.
8. The method of claim 1, after sending the request to the maximum load service node, further comprising:
acquiring a new load factor value of the maximum load service node, updating the new load factor value into the load factor value information table,
and the new load factor value comprises a load factor value obtained by recalculating the maximum load service node based on a preset load factor value calculation formula after receiving the request.
9. The method of claim 8, the obtaining a new load factor value for the maximum load service node comprising:
acquiring the processing request quantity of the maximum load service node at the moment Ti and the processing request quantity at the moment Ti-1,
the Ti time represents the time for receiving the request, and the Ti-1 time represents the time for receiving the last request of the request;
determining the load fluctuation of the maximum load service node based on the processing request quantity of the maximum load service node at the moment of Ti and the processing request quantity at the moment of Ti-1;
and determining a new load factor value of the maximum load service node according to the load fluctuation of the maximum load service node and the load factor value of the maximum load service node at the moment Ti.
10. The method of claim 7, after determining the service node with the largest load factor value in the service node cluster of the first service in the service link based on the pre-constructed service node routing table and the load information table, further comprising:
and sending the updated load information table to the service nodes in the service node cluster served in the service link.
11. The method of claim 5, after determining the service node with the largest load factor value in the service node cluster of the first service in the service link based on the pre-constructed service node routing table and the load information table, further comprising:
and sending the updated service node routing table to the service nodes in the service node cluster served in the service link.
12. A distributed load balancing apparatus, comprising:
the service link determining module is configured to determine a service link formed by services corresponding to the request of the client;
the first service node determining module is configured to determine a service node with a largest load factor value in a service node cluster of a first service in the service link based on a service node routing table and a load information table which are constructed in advance, wherein the load information table is updated according to the monitored processing request quantity of the service nodes in the service node cluster of the service in the service link;
a first request sending module configured to determine the service node with the largest load factor value as a maximum load service node, and send the request to the maximum load service node;
a second service node determination module configured to determine, based on the service node routing table, a service node in a cluster of service nodes for a next service in the service links associated with the most loaded service node after the most loaded service node processes the request;
a second request sending module configured to send a processing result of the maximum load service node on the request to a service node in a service node cluster of a next service in the service link.
13. The apparatus of claim 12, the second request sending module further configured to:
determining a service node with the largest load factor value in a service node cluster of the next service in the service link based on the load information table;
and sending the processing result of the maximum load service node on the request to the service node with the maximum load factor value in the service node cluster of the next service.
14. The apparatus of claim 13, further comprising:
a determining module configured to determine whether a next service in the service link is a last service in the service link,
and if so, finishing processing the request based on the service node with the largest load factor value in the service node cluster of the next service in the service link.
15. A computing device, comprising:
a memory and a processor;
the memory is to store computer-executable instructions, and the processor is to execute the computer-executable instructions to:
determining a service link formed by services corresponding to a request of a processing client;
determining a service node with the largest load factor value in a service node cluster of a first service in the service link based on a service node routing table and a load information table which are constructed in advance, wherein the load information table is updated according to the monitored processing request quantity of the service nodes in the service node cluster of the service in the service link;
determining the service node with the maximum load factor value as a maximum load service node, and sending the request to the maximum load service node;
after the most loaded service node processes the request, determining a service node in a cluster of service nodes for a next service in the service link associated with the most loaded service node based on the service node routing table;
and sending the processing result of the maximum load service node on the request to a service node in a service node cluster of the next service in the service link.
16. A computer readable storage medium storing computer instructions which, when executed by a processor, carry out the steps of the distributed load balancing method of any one of claims 1 to 11.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910906325.9A CN110650195B (en) | 2019-09-24 | 2019-09-24 | Distributed load balancing method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910906325.9A CN110650195B (en) | 2019-09-24 | 2019-09-24 | Distributed load balancing method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110650195A true CN110650195A (en) | 2020-01-03 |
CN110650195B CN110650195B (en) | 2022-01-07 |
Family
ID=69011179
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910906325.9A Active CN110650195B (en) | 2019-09-24 | 2019-09-24 | Distributed load balancing method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110650195B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111683132A (en) * | 2020-06-04 | 2020-09-18 | 重庆英楼维兴信息科技有限公司 | Business distribution method based on micro-service architecture and related device |
CN112003763A (en) * | 2020-08-07 | 2020-11-27 | 山东英信计算机技术有限公司 | Network link monitoring method, monitoring device, monitoring equipment and storage medium |
CN115134227A (en) * | 2022-06-17 | 2022-09-30 | 京东科技信息技术有限公司 | Method and apparatus for maintaining server |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102918813A (en) * | 2010-06-08 | 2013-02-06 | 阿尔卡特朗讯公司 | Device and method for data load balancing |
CN103095572A (en) * | 2013-01-29 | 2013-05-08 | 山东省计算中心 | Route maintenance method of multiple mobile sink wireless sensor networks (MMS-WSNs) |
US20130229990A1 (en) * | 2010-03-12 | 2013-09-05 | Qualcomm Incorporated | Method and apparatus for managing uplink interference |
CN104994149A (en) * | 2015-06-29 | 2015-10-21 | 中国人民解放军国防科学技术大学 | Cloud video service oriented resource provision method |
US20150312166A1 (en) * | 2014-04-25 | 2015-10-29 | Rami El-Charif | Software load balancer to maximize utilization |
CN107770096A (en) * | 2017-12-11 | 2018-03-06 | 国网河南省电力公司信息通信公司 | A kind of SDN/NFV network dynamic resource allocation algorithms based on load balancing |
CN107995126A (en) * | 2017-12-12 | 2018-05-04 | 中国联合网络通信集团有限公司 | Load balancing route analysis method and load balancing route analyzer |
CN108173894A (en) * | 2016-12-07 | 2018-06-15 | 阿里巴巴集团控股有限公司 | The method, apparatus and server apparatus of server load balancing |
CN109922006A (en) * | 2017-12-13 | 2019-06-21 | 中兴通讯股份有限公司 | Route switching system and its Virtual Service reconstructing method, device, equipment and medium |
-
2019
- 2019-09-24 CN CN201910906325.9A patent/CN110650195B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20130229990A1 (en) * | 2010-03-12 | 2013-09-05 | Qualcomm Incorporated | Method and apparatus for managing uplink interference |
CN102918813A (en) * | 2010-06-08 | 2013-02-06 | 阿尔卡特朗讯公司 | Device and method for data load balancing |
CN103095572A (en) * | 2013-01-29 | 2013-05-08 | 山东省计算中心 | Route maintenance method of multiple mobile sink wireless sensor networks (MMS-WSNs) |
US20150312166A1 (en) * | 2014-04-25 | 2015-10-29 | Rami El-Charif | Software load balancer to maximize utilization |
CN104994149A (en) * | 2015-06-29 | 2015-10-21 | 中国人民解放军国防科学技术大学 | Cloud video service oriented resource provision method |
CN108173894A (en) * | 2016-12-07 | 2018-06-15 | 阿里巴巴集团控股有限公司 | The method, apparatus and server apparatus of server load balancing |
CN107770096A (en) * | 2017-12-11 | 2018-03-06 | 国网河南省电力公司信息通信公司 | A kind of SDN/NFV network dynamic resource allocation algorithms based on load balancing |
CN107995126A (en) * | 2017-12-12 | 2018-05-04 | 中国联合网络通信集团有限公司 | Load balancing route analysis method and load balancing route analyzer |
CN109922006A (en) * | 2017-12-13 | 2019-06-21 | 中兴通讯股份有限公司 | Route switching system and its Virtual Service reconstructing method, device, equipment and medium |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111683132A (en) * | 2020-06-04 | 2020-09-18 | 重庆英楼维兴信息科技有限公司 | Business distribution method based on micro-service architecture and related device |
CN111683132B (en) * | 2020-06-04 | 2022-07-19 | 重庆金窝窝网络科技有限公司 | Business distribution method based on micro-service architecture and related device |
CN112003763A (en) * | 2020-08-07 | 2020-11-27 | 山东英信计算机技术有限公司 | Network link monitoring method, monitoring device, monitoring equipment and storage medium |
CN112003763B (en) * | 2020-08-07 | 2022-05-24 | 山东英信计算机技术有限公司 | Network link monitoring method, monitoring device, monitoring equipment and storage medium |
CN115134227A (en) * | 2022-06-17 | 2022-09-30 | 京东科技信息技术有限公司 | Method and apparatus for maintaining server |
Also Published As
Publication number | Publication date |
---|---|
CN110650195B (en) | 2022-01-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110650195B (en) | Distributed load balancing method and device | |
AbdulRahman et al. | FedMCCS: Multicriteria client selection model for optimal IoT federated learning | |
CN109358971B (en) | Rapid and load-balancing service function chain deployment method in dynamic network environment | |
US7937473B2 (en) | Resource-amount calculation system, and method and program thereof | |
CN110365748A (en) | Treating method and apparatus, storage medium and the electronic device of business datum | |
CN110417587B (en) | Server load management | |
CN110086886B (en) | Dynamic session holding method and device | |
CN106161643B (en) | Task distribution formula processing method, device and Cloud Server | |
CN114741611A (en) | Federal recommendation model training method and system | |
CN102724105B (en) | A kind of load-balancing method and device | |
CN111538605A (en) | Distributed data access layer middleware and command execution method and device | |
Singh et al. | Service Versus Protection: a Bayesian learning approach for trust provisioning in edge of things environment | |
CN116909735A (en) | Calculation power scheduling method and device, server and storage medium | |
CN104333611A (en) | Method and device for adjusting aging time | |
Huang et al. | On modeling and optimization for composite network–Cloud service provisioning | |
CN115633041B (en) | Multi-cluster management method and device, electronic equipment and readable storage medium | |
Manogaran et al. | Deep learning-based service distribution model for wireless network assisted Internet of Everything | |
CN110995802A (en) | Task processing method and device, storage medium and electronic device | |
CN113542371B (en) | Resource scheduling method and system based on edge gateway | |
CN112333095B (en) | Software-defined Wide Area Network (WAN) route calculation method and system based on kubernets expansion characteristic | |
Yang et al. | Replica placement in content delivery networks with stochastic demands and M/M/1 servers | |
CN111522999A (en) | Method and device for managing service operation tree | |
CN111314460A (en) | Service iteration method, service iteration device and storage medium | |
CN111367637A (en) | Task processing method and device | |
CN112953844B (en) | Network traffic optimization method and device |
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 |