CN112291326A - Load balancing method, load balancing device, storage medium and electronic equipment - Google Patents

Load balancing method, load balancing device, storage medium and electronic equipment Download PDF

Info

Publication number
CN112291326A
CN112291326A CN202011147548.0A CN202011147548A CN112291326A CN 112291326 A CN112291326 A CN 112291326A CN 202011147548 A CN202011147548 A CN 202011147548A CN 112291326 A CN112291326 A CN 112291326A
Authority
CN
China
Prior art keywords
load balancing
balancing cluster
cluster
standby
current
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011147548.0A
Other languages
Chinese (zh)
Other versions
CN112291326B (en
Inventor
霍晓湘
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Shenzhen Huantai Technology Co Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Shenzhen Huantai Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd, Shenzhen Huantai Technology Co Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN202011147548.0A priority Critical patent/CN112291326B/en
Publication of CN112291326A publication Critical patent/CN112291326A/en
Application granted granted Critical
Publication of CN112291326B publication Critical patent/CN112291326B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/12Avoiding congestion; Recovering from congestion
    • H04L47/125Avoiding congestion; Recovering from congestion by balancing the load, e.g. traffic engineering
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/29Flow control; Congestion control using a combination of thresholds
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • H04L67/1008Server selection for load balancing based on parameters of servers, e.g. available memory or workload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1044Group management mechanisms 

Abstract

The disclosure provides a load balancing method, a load balancing device, a computer readable storage medium and an electronic device, and relates to the technical field of computers. The load balancing method comprises the following steps: detecting the flow received by the current main load balancing cluster and the current standby load balancing cluster; and when the flow of the current main load balancing cluster reaches a first load threshold and maintains a first preset time length, newly adding at least one standby load balancing cluster, and performing load balancing through the newly added standby load balancing cluster, wherein the first load threshold is smaller than the maximum load value of the current main load balancing cluster. The load balancer cluster adopting the main and standby structure can better cope with the situation of sudden flow increase, and can avoid capacity expansion jitter caused by frequent capacity expansion.

Description

Load balancing method, load balancing device, storage medium and electronic equipment
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a load balancing method, a load balancing apparatus, a computer-readable storage medium, and an electronic device.
Background
With the continuous development of computer and internet technologies, the scale of business traffic and the complexity of business logic also develop, and in order to adapt to larger and larger business traffic and more complicated and diversified business logic, multiple machines are often needed to implement performance expansion and avoid single-point failures.
In the process of using multiple machines to realize service functions, how to perform load balancing on traffic sent to each machine is very important. However, in the conventional load balancing technology, when the traffic suddenly increases, there are problems that the capacity expansion is delayed, the capacity cannot be timely handled, or the capacity expansion cannot be performed, so that the load of the conventional cluster is too heavy, and a fault is caused.
Disclosure of Invention
The present disclosure provides a load balancing method, a load balancing apparatus, a computer-readable storage medium, and an electronic device, which can improve the capacity of coping with a sudden increase in traffic to at least some extent, and can avoid frequent volume expansion.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows, or in part will be obvious from the description, or may be learned by practice of the disclosure.
According to a first aspect of the present disclosure, there is provided a load balancing method, including:
detecting the flow received by the current main load balancing cluster and the current standby load balancing cluster;
and when the flow of the current main load balancing cluster reaches a first load threshold and maintains a first preset time length, newly adding at least one standby load balancing cluster, and performing load balancing through the newly added standby load balancing cluster, wherein the first load threshold is smaller than the maximum load value of the current main load balancing cluster.
According to a second aspect of the present disclosure, there is provided a load balancing apparatus comprising:
the flow detection module is used for detecting the flow received by the current main load balancing cluster and the current standby load balancing cluster;
and the load balancing module is used for adding at least one standby load balancing cluster when the flow of the current main load balancing cluster reaches a first load threshold and maintains a first preset time length, and performing load balancing through the added standby load balancing cluster, wherein the first load threshold is smaller than the maximum load value of the current main load balancing cluster.
According to a third aspect of the present disclosure, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the load balancing method described above.
According to a fourth aspect of the present disclosure, there is provided an electronic device comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the above load balancing method via execution of the executable instructions.
The technical scheme of the disclosure has the following beneficial effects:
detecting the flow received by the current main load balancing cluster and the current standby load balancing cluster according to the load balancing method, the load balancing device, the computer readable storage medium and the electronic equipment; and when the flow of the current main load balancing cluster reaches a first load threshold and maintains the preset time length, adding at least one standby load balancing cluster, and performing load balancing through the added standby load balancing cluster, wherein the first load threshold is smaller than the maximum load value of the current main load balancing cluster. On one hand, in the load balancing method provided in this exemplary embodiment, the first load threshold is smaller than the maximum load value of the current primary load balancing cluster, that is, the current primary load balancing cluster is extended by adding at least one backup load balancing cluster before reaching the maximum load value, so that the current primary load balancing cluster can quickly react to a traffic surge scenario. On the other hand, when the traffic of the current main load balancing cluster reaches the first load threshold, capacity expansion is not performed immediately, but a corresponding capacity expansion or capacity reduction process is performed after the traffic lasts for the first preset time, so that jitter caused by frequent capacity expansion and reduction is prevented.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure. It is to be understood that the drawings in the following description are merely exemplary of the disclosure, and that other drawings may be derived from those drawings by one of ordinary skill in the art without the exercise of inventive faculty.
FIG. 1 shows a schematic diagram of a system architecture of the present exemplary embodiment;
fig. 2 shows a schematic diagram of an electronic device of the present exemplary embodiment;
FIG. 3 illustrates a flow chart of a method of load balancing of the present exemplary embodiment;
FIG. 4 illustrates an initial state diagram of one embodiment of a load balancing method of the present exemplary embodiment;
fig. 5 is a schematic expansion diagram illustrating an embodiment of a load balancing method according to the present exemplary embodiment;
FIG. 6 is a schematic diagram illustrating a reduced capacity of an embodiment of a load balancing method according to the present exemplary embodiment;
fig. 7 shows a block diagram of a load balancing apparatus according to the present exemplary embodiment.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the disclosure. One skilled in the relevant art will recognize, however, that the subject matter of the present disclosure can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and the like. In other instances, well-known technical solutions have not been shown or described in detail to avoid obscuring aspects of the present disclosure.
Furthermore, the drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus their repetitive description will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
Fig. 1 shows a schematic diagram of a system architecture of an exemplary embodiment of the present disclosure. As shown in fig. 1, the system architecture 100 may include: terminal device 110, primary load balancing cluster 120, backup load balancing cluster 130, network 140, and server 150. The servers 150 are used to distribute traffic to the primary load-balancing cluster 120 and the backup load-balancing cluster 130. It should be understood that the numbers of end devices 110, primary load-balancing clusters 120, backup load-balancing clusters 130, and servers 150 in fig. 1 are merely illustrative. For example, the number of the main load balancing clusters and the number of the standby load balancing clusters may be adjusted to be any number according to the traffic in the network and the traffic of the load of each load balancing cluster.
In the load balancing method provided in the embodiment of the present disclosure, the server sends the traffic sent by the terminal device to the main load balancing cluster and the standby load balancing cluster 130 according to a preset distribution rule; detecting the flow received by the main load balancing cluster and the standby load balancing cluster, wherein the detection process can be carried out by a server or each load balancing cluster; when the fact that the flow of the current main load balancing cluster reaches a first load threshold value and the preset time length is maintained is detected, at least one standby load balancing cluster is added, load balancing is conducted through the added standby load balancing cluster, and the first load threshold value is smaller than the maximum load value of the current main load balancing cluster.
Exemplary embodiments of the present disclosure also provide an electronic device capable of implementing the above method.
As will be appreciated by one skilled in the art, aspects of the present disclosure may be embodied as a system, method or program product. Accordingly, various aspects of the present disclosure may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
An electronic device 200 according to such an exemplary embodiment of the present disclosure is described below with reference to fig. 2. The electronic device 200 shown in fig. 2 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in FIG. 2, electronic device 200 is embodied in the form of a general purpose computing device. The components of the electronic device 200 may include, but are not limited to: the at least one processing unit 210, the at least one memory unit 220, a bus 230 connecting different system components (including the memory unit 220 and the processing unit 210), and a display unit 240.
Where the storage unit stores program code, the program code may be executed by the processing unit 210 to cause the processing unit 210 to perform the steps according to various exemplary embodiments of the present disclosure described in the above section "exemplary methods" of this specification. For example, processing unit 210 may perform the steps shown in fig. 3, 4, or 5, and so on.
The storage unit 220 may include readable media in the form of volatile memory units, such as a random access memory unit (RAM)221 and/or a cache memory unit 222, and may further include a read only memory unit (ROM) 223.
The storage unit 220 may also include a program/utility 224 having a set (at least one) of program modules 225, such program modules 225 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Bus 230 may be one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
The electronic device 200 may also communicate with one or more external devices 270 (e.g., keyboard, pointing device, bluetooth device, etc.), with one or more devices that enable a user to interact with the electronic device 200, and/or with any devices (e.g., router, modem, etc.) that enable the electronic device 200 to communicate with one or more other computing devices. Such communication may occur via an input/output (I/O) interface 250. Also, the electronic device 200 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network such as the Internet) via the network adapter 260. As shown, the network adapter 260 communicates with the other modules of the electronic device 200 over the bus 230. It should be appreciated that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the electronic device 200, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the exemplary embodiments of the present disclosure.
The existing related technology of load balancing may have the following problems: (1) when a scene of sudden flow increase occurs, the load balancing service cannot rapidly respond to the situation due to certain time delay of automatic capacity expansion, and preheating is needed in advance; (2) the capacity cannot be expanded, and once the flow is too large, the load is easy to be too much, so that the fault may occur and the device cannot be used.
In order to solve the above problem, the exemplary embodiments of the present disclosure provide a load balancing method, a load balancing apparatus, a computer-readable storage medium, and an electronic device. The following describes a load balancing method and a load balancing apparatus according to exemplary embodiments of the present disclosure in detail.
Fig. 3 shows a flow of a load balancing method in the present exemplary embodiment, which includes the following steps S310 to S320:
step S310: and detecting the flow received by the current main load balancing cluster and the current standby load balancing cluster.
In this exemplary embodiment, the load balancing cluster refers to a cluster for processing a user traffic request, and the cluster may implement load balancing by setting a reasonable traffic scheduling policy. That is, the load balancing cluster can achieve the balance of the load flow of each server by reasonably distributing the flow before the flow enters the back-end server, thereby achieving the effects of optimizing resource use, maximizing throughput, minimizing response time, avoiding overload and the like.
The load balancing method provided by the present exemplary embodiment adopts a main/standby structure. And distributing the received user traffic to the main load balancing cluster and the standby load balancing cluster through the traffic scheduling strategy. The traffic scheduling policy may be proportionally allocated according to the load capacity of each cluster, for example, it is predetermined that the load balancing method initially includes a main load balancing cluster and a standby load balancing cluster, and the traffic scheduling policy obtained according to the load capacity of the current main and standby load balancing clusters is that 90% of traffic is sent to the main load balancing cluster for processing, and 10% of traffic is sent to the standby load balancing cluster for processing. It should be noted that the above scenario is only an exemplary illustration, and the scope of protection of the exemplary embodiment is not limited thereto. For example, the traffic scheduling policy may also be other policies that can implement scheduling of traffic received by each load balancing cluster, and the number and load capacity of the active/standby load balancing clusters may also be adjusted according to actual situations, which is not particularly limited in this exemplary embodiment.
In order to better cope with the sudden traffic increase and save software and hardware resources on the basis of ensuring the processing capability, the present exemplary embodiment may further adjust the number of each load balancing cluster according to the actual network condition. For example, when the traffic increases, the number of the standby load balancing clusters may be increased to share the traffic, and when the traffic is less, the number of the standby load balancing clusters may be decreased to save software and hardware resources. In addition, while the number of load balancing clusters is adjusted, the original main/standby structure may also be adjusted. For example, when the number of the standby load balancing clusters is increased, the original standby load balancing clusters may be merged into the original main load balancing cluster to improve the load capacity of the main load balancing cluster. The current main load balancing cluster and the current standby load balancing cluster refer to a main/standby load balancing cluster corresponding to a current main/standby structure before adjustment.
The adjustment of each load balancing cluster needs to be based on the traffic in the network. Therefore, in order to implement reasonable adjustment, it is necessary to detect the traffic received by the current primary load balancing cluster and the current standby load balancing cluster. Specifically, the detection may be implemented by a server responsible for load balancing scheduling, or may be performed by each load balancing cluster and reported to the scheduling server, which is not particularly limited in this exemplary embodiment.
Step S320: and when the flow of the current main load balancing cluster reaches a first load threshold and maintains a first preset time length, newly adding at least one standby load balancing cluster, and performing load balancing through the newly added standby load balancing cluster, wherein the first load threshold is smaller than the maximum load value of the current main load balancing cluster.
In this example embodiment, the first load threshold and the first preset time period are used to determine whether a new load balancing cluster needs to be added. The first load threshold may be determined according to the load capacity of the current master load balancing cluster and the traffic in the network, and is smaller than the maximum load capacity of the current master load balancing cluster. For example, the first load threshold may be defined as an optimal load capacity of the current master load balancing cluster, where the optimal load capacity refers to a maximum traffic that can be processed by the current master load balancing cluster on the basis of ensuring a normal processing capacity, such as a processing speed, and it should be noted that the optimal load capacity is usually smaller than the maximum load capacity because the maximum load capacity is a limit of the cluster processing traffic, and at this time, a normal processing speed and other requirements cannot be ensured. The optimal load capacity can be customized according to the utilization rate of a Central Processing Unit (CPU), the number of user requests and other factors. It should be noted that the above scenario is only an exemplary illustration, and the first load threshold may be another threshold meeting the above definition. The present exemplary embodiment does not limit the definition and specific values of the threshold, and the first load threshold is smaller than the maximum load capacity of the cluster, so that the corresponding capacity expansion processing can be performed before the capacity received by the cluster reaches the limit, and the case of sudden traffic increase can be well dealt with.
In this exemplary embodiment, in order to prevent a situation of capacity expansion jitter caused by frequent capacity expansion operations, when the traffic load of the current primary load balancing cluster obtains the first load threshold, the capacity expansion operation is not performed immediately, but an observation duration, that is, the first preset duration, is defined. And when the current main load balancing cluster reaches a first load threshold and maintains a first preset time, newly adding at least one standby load balancing cluster, wherein the number of the newly added standby load balancing clusters can be determined according to the service requirement and the actual situation. For example, in the load balancing method provided in this exemplary embodiment, a shared resource pool may be set, where the shared resource pool has a plurality of available standby load balancing clusters, and when capacity expansion is required, the server in charge of scheduling may schedule the standby load balancing clusters from the shared resource pool to meet the current requirement. It should be noted that the above scenario is only an exemplary illustration, and the scope of protection of the exemplary embodiment is not limited thereto.
After adding at least one backup load balancing, the method provided in this example embodiment may further implement load balancing by using the newly added backup load balancing cluster, for example, the process of implementing load balancing may be as follows: sending the flow of the current standby load balancing cluster to the newly added standby load balancing cluster; and sending the flow borne by the current main load balancing cluster to the current main load balancing cluster and the current standby load balancing cluster according to a preset proportion rule. In the process, after the new backup load balancing cluster is added, the new backup load balancing cluster is used as a new backup load balancing cluster in the system, and the current backup load balancing cluster is added into the current main load balancing cluster to form a new main load balancing cluster together with the current main load balancing cluster. The preset proportion rule is the proportion of the load-bearing flow of the newly added standby load balancing cluster and the original main load balancing cluster in the new main load balancing cluster.
Specifically, taking that the current main load balancing cluster bears 90% of traffic, the current standby load balancing cluster bears 10% of traffic, and the current main load balancing cluster reaches the first load threshold and maintains a first preset time, a new standby load balancing cluster is added, and the preset proportion rule is average distribution, for example, the process of implementing load balancing is as follows: and when the flow of the current main load balancing cluster reaches the first load threshold and the first preset time is maintained, newly adding a standby load balancing cluster, wherein the newly added standby load balancing cluster is used as a new standby load balancing cluster and bears 10% of the flow. The current standby load balancing cluster and the current main load balancing cluster are used as a new main load balancing cluster together and bear 90% of traffic, wherein the current standby load balancing cluster and the current main load balancing cluster respectively bear half of the 90% of the traffic. It should be noted that the above scenario is only an exemplary illustration, and does not limit the exemplary embodiment. For example, the process may be repeatedly executed until the finally obtained traffic received by the main load balancing cluster is maintained below the first load threshold, or a plurality of backup load balancing clusters may be newly added, where the proportion of the traffic assumed by the main load balancing clusters, and the preset proportion rule of the traffic assumed by the current main load balancing cluster in the new main load balancing cluster may also be other proportions or rules, and these proportions or rules belong to the protection category of the present example embodiment.
In this exemplary embodiment, the process of implementing load balancing by the newly added backup load balancing cluster may also be implemented by the following steps: and merging the newly added standby load balancing cluster into the current main load balancing cluster to jointly form a new main load balancing cluster and bear the flow born by the original main load balancing cluster.
Taking an example that the current main load balancing cluster bears 90% of traffic, the current standby load balancing cluster bears 10% of traffic, and the current main load balancing cluster reaches the first load threshold and maintains the first preset duration, a new standby load balancing cluster is added, where the process may be: and merging the newly added standby load balancing cluster into the current main load cluster as a new main load balancing cluster, bearing 90% of traffic, and still bearing the remaining 10% of traffic by the current standby load balancing cluster. The traffic distribution proportion between the newly added backup load balancing cluster and the current main load balancing cluster may be set according to actual conditions, for example, when the conditions such as the carrying capacity are similar, the backup load balancing cluster and the current main load balancing cluster may respectively bear one half of 90% of traffic. It should be noted that the above scenario is only an exemplary illustration, and the scope of protection of the exemplary embodiment is not limited thereto.
In summary, according to the load balancing method, the load balancing apparatus, the computer-readable storage medium and the electronic device, the traffic received by the current primary load balancing cluster and the current standby load balancing cluster is detected; and when the flow of the current main load balancing cluster reaches a first load threshold and maintains the preset time length, adding at least one standby load balancing cluster, and performing load balancing through the added standby load balancing cluster, wherein the first load threshold is smaller than the maximum load value of the current main load balancing cluster. On one hand, in the load balancing method provided in this exemplary embodiment, the first load threshold is smaller than the maximum load value of the current primary load balancing cluster, that is, the current primary load balancing cluster is extended by adding at least one backup load balancing cluster before reaching the maximum load value, so that the current primary load balancing cluster can quickly react to a traffic surge scenario. On the other hand, when the traffic of the current main load balancing cluster reaches the first load threshold, capacity expansion is not performed immediately, but a corresponding capacity expansion or capacity reduction process is performed after the traffic lasts for the first preset time, so that jitter caused by frequent capacity expansion and reduction is prevented.
In an exemplary embodiment, after the load balancing is performed by the newly added backup load balancing cluster, when the current main load balancing cluster maintains a lower traffic within a certain time period and the number of load balancing devices in the cluster is relatively large, at least one current load balancing cluster may be released, so as to achieve an effect of saving resources on the basis of maintaining normal processing requirements.
Taking as an example that the newly added load balancing cluster is added into a current standby load balancing cluster, the current main load cluster and at least one standby load balancing cluster are taken as a new current main load balancing cluster, and the rest current standby load balancing clusters are taken as new standby load balancing clusters, the capacity reduction process may be: and when the number of the load balancing devices of the current main load balancing cluster reaches a preset threshold, and the received flow reaches a second load threshold and maintains a second preset duration, sending the flow of at least one current standby load balancing cluster to the current main load balancing cluster, and releasing the corresponding current standby load balancing cluster.
The device responsible for balancing is a device used for processing a user request in each load balancing cluster, and may be a server or other electronic devices conforming to the above definition, which is not particularly limited in this exemplary embodiment. The preset threshold may be based on an initial load balancing number in each load balancing cluster, for example, in an initial state of the system, each active/standby load balancing cluster includes three load balancing devices, and the preset threshold may be defined as a multiple of the initial number, for example, 6. In addition, the preset threshold may be formulated based on other criteria, for example, the preset threshold may be formulated according to the number of current load balancing devices and the proportion of current traffic, or may be any other number that may indicate that the number of load balancing devices is too large relative to the traffic, and this is not particularly limited in this example embodiment.
The second load threshold is a threshold value for which the reduction is required. The second load threshold may be determined according to the load capability of the current master load balancing cluster and the traffic in the network. The second load threshold may be defined according to the optimal load capability of the current master load balancing cluster, for example, may be defined as one half of the optimal load capability. The reaching of the second load threshold means that the traffic of the current master load balancing cluster is smaller than or equal to the second load threshold. For example, the second load threshold may also be a traffic received by the current master load balancing cluster when the sum of the traffic received by the current master load balancing cluster and the current standby load balancing cluster is less than one-half of the optimal load capacity, which is not particularly limited in this exemplary embodiment.
In order to prevent the situation of capacity expansion jitter caused by frequent capacity expansion operations, in this exemplary embodiment, when the traffic load of the current primary load balancing cluster obtains the second load threshold, the capacity reduction operation is not performed immediately, but an observation duration, that is, the second preset duration, is defined. And when the number of the load balancing devices of the current main load balancing cluster reaches the preset threshold, and the received flow reaches a second load threshold and maintains a second preset duration, executing a process of releasing at least one current load balancing cluster. The second preset time period may be the same as the first preset time period during the capacity expansion operation, or may be another time period defined according to an actual situation, which is not particularly limited in this example embodiment. The releasing of the at least one current standby load balancing cluster may be releasing the at least one current standby load balancing cluster to the shared resource pool by a server in charge of scheduling when capacity reduction is required, so as to achieve the purpose of saving resources. It should be noted that the above scenario is only an exemplary illustration, and the scope of protection of the exemplary embodiment is not limited thereto.
The above procedure of releasing at least one current standby load balancing cluster may be as follows: and sending the flow of at least one current standby load balancing cluster to the current main load balancing cluster, and releasing the corresponding current standby load balancing cluster.
In addition, after the above process, the present exemplary embodiment may further adjust the active/standby structures of each load balancing cluster. The adjustment process may be as follows: and dividing the current main load balancing cluster into a new main load balancing cluster and a new standby load balancing cluster according to the number of the load balancing devices. For example, the dividing according to the number of the load balancing devices may be dividing according to the number of the load balancing devices in each load balancing cluster when the system is in the initial state. In addition, the active/standby structure of the load balancing cluster may also be adjusted by other methods, which is not particularly limited in this example embodiment.
Specifically, taking the active/standby load balancing clusters after one expansion in step S320 as an example, in the initial state, the number of the load balancing devices in each load balancing cluster is 3. The number of the load balancing devices in the expanded main load balancing cluster is 6, and the load balancing devices bear 90% of the flow, and the number of the load balancing devices in the standby load balancing cluster is 3, and the load balancing devices bear 10% of the flow. The preset threshold corresponding to the load balancing device is set twice, that is, 6, the initial number. At this time, the number of the load balancing devices in the current main load balancing cluster after capacity expansion is 6, the number of the load balancing devices in the standby load balancing cluster is 3, and at this time, the flow received by the main load balancing cluster is less than or equal to the second load and the second preset time duration is maintained, at this time, capacity reduction needs to be performed. The capacity reduction process can be as follows: and sending 10% of the flow borne by the current standby load balancing cluster to the current main load balancing cluster, and releasing the current standby load balancing cluster. And then, dividing 3 load balancing devices from the current main load balancing cluster to serve as a new standby load balancing cluster for receiving 10% of traffic, and taking the remaining 3 load balancing devices as a new main load balancing cluster for receiving 90% of traffic. It should be noted that the above scenario is only an exemplary illustration, and does not limit the exemplary embodiment.
In addition, the above-mentioned capacity reduction process may be performed after at least one capacity expansion, or may not be performed through the capacity expansion process. For example, in an initial state, the number of load balancing devices in the main load balancing cluster is 6, and 90% of traffic is carried, the number of load balancing devices in the standby load balancing cluster is 3, and 10% of traffic is carried, and the preset threshold of the number of load balancing devices is 6. And if the flow received by the main load balancing cluster is less than or equal to the second load and the second preset duration is maintained, the capacity reduction condition is also met. In this scenario, the capacity is directly expanded in the initial condition without the capacity expansion process. It should be noted that the above scenario is only an exemplary illustration, and does not limit the exemplary embodiment.
In an exemplary embodiment, the method may further set an initial traffic receiving ratio of the current master load balancing cluster and the current standby load balancing cluster. For example, in an initial state of the system, 90% of traffic may be received for the set primary load balancing cluster, and 10% of traffic may be received by the standby load balancing device. Because the initial traffic receiving proportion is set, the standby load balancing cluster receives traffic in the initial state, and the availability of the standby load balancing cluster can be ensured.
When the current master load balancing cluster meets the capacity expansion condition, the following processes can be executed: sending the flow loaded by the current standby load balancing cluster according to the initial flow receiving proportion to the newly added standby load balancing cluster; the current main load balancing cluster receives the flow loaded in proportion according to the initial flow and sends the flow to the current main load balancing cluster and the current standby load balancing cluster according to a preset proportion rule; and taking the current main load balancing cluster and the current standby load balancing cluster as a new main load balancing cluster, taking the newly added standby load balancing cluster as a new standby load balancing cluster, and setting the flow receiving proportion of the new main load balancing cluster and the new standby load balancing cluster as the initial flow receiving proportion.
When the current main load balancing cluster meets the capacity reduction condition, the following processes can be executed: sending the flow loaded by at least one current standby load balancing cluster according to the initial flow receiving proportion to a current main load balancing cluster, and releasing the corresponding current standby load balancing cluster; and dividing the current main load balancing cluster into a new main load balancing cluster and a new standby load balancing cluster according to the number of the load balancing devices, and setting the flow receiving proportion of the new main load balancing cluster and the new standby load balancing cluster as an initial flow receiving proportion.
The following describes the above procedure with the initial state shown in fig. 4 as an example:
as shown in fig. 4, the number of user requests per second is 50 ten thousand, and the number of initial state preset load balancing clusters is two. One of the load balancing clusters is a main load balancing cluster, the main load balancing cluster receives 90% of user requests, and the optimal load capacity is 100 multi-user requests. The other is a standby load balancing cluster, receiving 10% of the user requests. The first load threshold is the optimal load capacity, the second load threshold is half of the optimal load capacity, the observation duration of the expansion and contraction capacity is 1 minute, the number of the load balancing devices in each load balancing cluster is 3, and the number of the load balancing devices required by the contraction capacity is twice as large as the initial number of the load balancing devices in each load balancing cluster in the current main load balancing cluster.
When the number of requests of users per second reaches 150 ten thousand, as shown in fig. 5, the current primary load balancing cluster receives 90% of traffic, that is, the current primary load balancing cluster receives 135 ten thousand user requests, and reaches the first load threshold. When the main load balancing cluster continues to be in the state for 1 minute, the capacity expansion condition is reached, and the capacity expansion needs to be carried out. As shown in fig. 5, the original active/standby load balancing cluster will become a new active/standby load balancing cluster, and the new active/standby load balancing cluster together carry 90% of the traffic, and the 90% of the traffic is averagely allocated to the original active/standby load balancing cluster. Meanwhile, a new standby load balancing cluster is automatically expanded and added to serve as the new standby load balancing cluster and bear 10% of flow.
When the number of requests of users per second reaches 50 ten thousand, as shown in fig. 6, the sum of the flows received by the current master/slave load balancing cluster is half of the optimal load capacity, and the number of load balancing devices in the current master load balancing cluster is 6, which is twice the initial number of load balancing devices, and capacity reduction is required when the state lasts for 1 minute. As shown in fig. 6, the backup load balancer cluster firstly puts 10% of traffic onto the main load balancer, the main load balancer cluster divides 3 load balancer devices as backup load balancers, receives only 10% of traffic, and the remaining 3 load balancer devices as new main load balancer clusters, receives 90% of traffic, and releases all the original backup load balancers.
Exemplary embodiments of the present disclosure also provide a load balancing apparatus. As shown in fig. 7, the load balancing apparatus 700 may include:
a traffic detection module 710, configured to detect traffic received by the current primary load balancing cluster and the current standby load balancing cluster;
the load balancing module 720 may be configured to add at least one backup load balancing cluster when the traffic of the current primary load balancing cluster reaches the first load threshold and maintains the first preset duration, and perform load balancing through the added backup load balancing cluster, where the first load threshold is smaller than the maximum load value of the current primary load balancing cluster.
In an exemplary embodiment, the detection module may further include a setting unit, configured to set an initial traffic receiving ratio of the current master load balancing cluster and the current backup load balancing cluster.
In an exemplary embodiment, the capacity expansion module may include a condition determining unit and a capacity expansion unit. The condition determining unit is configured to determine whether each cluster satisfies an expansion condition, for example, determine whether a current flow of the main load balancing cluster reaches a first load threshold and maintains a preset duration. The capacity expansion unit is configured to newly add at least one backup load balancing cluster, and specifically, the capacity expansion unit may perform capacity expansion by performing the following processes: sending the flow of the current standby load balancing cluster to the newly added standby load balancing cluster; and sending the flow borne by the current main load balancing cluster to the current main load balancing cluster and the current standby load balancing cluster according to a preset proportion rule. At this time, the newly added backup load balancing cluster is used as a new backup load balancing cluster in the system, and the current backup load balancing cluster is added into the current main load balancing cluster to form a new main load balancing cluster together with the current main load balancing cluster. The preset proportion rule is the proportion of the load-bearing flow of the newly added standby load balancing cluster and the original main load balancing cluster in the new main load balancing cluster.
In an exemplary embodiment, the load balancing apparatus may further include a capacity reduction module, where the capacity reduction module may be configured to perform capacity reduction when the number of the load balancing devices of the current master load balancing cluster reaches a preset threshold, and the received traffic reaches a second load threshold and maintains a second preset duration.
The capacity reduction module can comprise a condition judgment unit and a capacity reduction unit. The condition determining unit is configured to determine whether each cluster satisfies a capacity reduction condition, for example, after the newly added load balancing cluster is added to a current primary load balancing cluster and the current primary load cluster and at least one secondary load balancing cluster are used as a new current primary load balancing cluster, determine whether the number of load balancing devices of the current primary load balancing cluster reaches a preset threshold, and whether the received traffic reaches a second load threshold and maintains a second preset duration. The capacity reduction unit is used for releasing at least one current standby load balancing cluster when the judgment unit is yes. The capacity reduction unit can carry out capacity reduction by executing the following processes: sending the flow of at least one current standby load balancing cluster to a current main load balancing cluster, and releasing the corresponding current standby load balancing cluster; and dividing the current main load balancing cluster into a new main load balancing cluster and a new standby load balancing cluster according to the number of the load balancing devices.
The specific details of each module in the above apparatus have been described in detail in the method section, and details that are not disclosed may refer to the method section, and thus are not described again.
As will be appreciated by one skilled in the art, aspects of the present disclosure may be embodied as a system, method or program product. Accordingly, various aspects of the present disclosure may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
Exemplary embodiments of the present disclosure also provide a computer-readable storage medium having stored thereon a program product capable of implementing the above-described method of the present specification. In some possible embodiments, various aspects of the disclosure may also be implemented in the form of a program product including program code for causing a terminal device to perform the steps according to various exemplary embodiments of the disclosure described in the above-mentioned "exemplary methods" section of this specification, when the program product is run on the terminal device, for example, any one or more of the steps in fig. 3 may be performed.
Exemplary embodiments of the present disclosure also provide a program product for implementing the above method, which may employ a portable compact disc read only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present disclosure is not limited thereto, and in this document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
A computer readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is to be limited only by the terms of the appended claims.

Claims (10)

1. A method of load balancing, comprising:
detecting the flow received by the current main load balancing cluster and the current standby load balancing cluster;
and when the flow of the current main load balancing cluster reaches a first load threshold and maintains a first preset time length, newly adding at least one standby load balancing cluster, and performing load balancing through the newly added standby load balancing cluster, wherein the first load threshold is smaller than the maximum load value of the current main load balancing cluster.
2. The method according to claim 1, wherein the load balancing by the newly added backup load balancing cluster comprises:
and sending the flow of the current standby load balancing cluster to the newly added standby load balancing cluster, and sending the flow borne by the current main load balancing cluster to the current main load balancing cluster and the current standby load balancing cluster according to a preset proportion rule.
3. The method of load balancing according to claim 1, further comprising:
adding the newly added load balancing cluster into a current standby load balancing cluster, and taking the current main load cluster and at least one standby load balancing cluster as a new current main load balancing cluster;
and when the number of the load balancing devices of the current main load balancing cluster reaches a preset threshold, and the received flow reaches a second load threshold and maintains a second preset duration, sending the flow of at least one current standby load balancing cluster to the current main load balancing cluster, and releasing the corresponding current standby load balancing cluster.
4. The method according to claim 3, wherein after said releasing the corresponding current standby load balancing cluster, the method further comprises:
and dividing the current main load balancing cluster into a new main load balancing cluster and a new standby load balancing cluster according to the number of the load balancing devices.
5. The method of load balancing according to claim 1, further comprising:
and setting the initial flow receiving proportion of the current main load balancing cluster and the current standby load balancing cluster.
6. The load balancing method according to claim 5, wherein the adding at least one backup load balancing cluster and performing load balancing through the added backup load balancing cluster comprises:
sending the flow loaded by the current standby load balancing cluster according to the initial flow receiving proportion to the newly added standby load balancing cluster;
sending the current main load balancing cluster to the current main load balancing cluster and the current standby load balancing cluster according to the initial flow receiving proportion-bearing flow and a preset proportion rule;
and taking the current main load balancing cluster and the current standby load balancing cluster as new main load balancing clusters, taking the newly added standby load balancing cluster as new standby load balancing clusters, and setting the traffic receiving proportion of the new main load balancing cluster and the new standby load balancing cluster as the initial traffic receiving proportion.
7. The method according to claim 6, wherein after setting the traffic receiving ratios of the new primary load balancing cluster and the new standby load balancing cluster to the initial traffic receiving ratio, the method comprises:
when the number of the load balancing devices of the current main load balancing cluster reaches the preset threshold, and the received flow reaches the second load threshold and maintains the second preset duration, sending the flow borne by at least one current standby load balancing cluster according to the initial flow receiving proportion to the current main load balancing cluster, and releasing the corresponding current standby load balancing cluster;
and dividing the current main load balancing cluster into a new main load balancing cluster and a new standby load balancing cluster according to the number of load balancing devices, and setting the traffic receiving proportion of the new main load balancing cluster and the new standby load balancing cluster as the initial traffic receiving proportion.
8. A load balancing apparatus, comprising:
the flow detection module is used for detecting the flow received by the current main load balancing cluster and the current standby load balancing cluster;
and the load balancing module is used for adding at least one standby load balancing cluster when the flow of the current main load balancing cluster reaches a first load threshold and maintains a first preset time length, and performing load balancing through the added standby load balancing cluster, wherein the first load threshold is smaller than the maximum load value of the current main load balancing cluster.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the load balancing method according to any one of claims 1 to 7.
10. An electronic device, comprising:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the load balancing method of any one of claims 1 to 7 via execution of the executable instructions.
CN202011147548.0A 2020-10-23 2020-10-23 Load balancing method, load balancing device, storage medium and electronic equipment Active CN112291326B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011147548.0A CN112291326B (en) 2020-10-23 2020-10-23 Load balancing method, load balancing device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011147548.0A CN112291326B (en) 2020-10-23 2020-10-23 Load balancing method, load balancing device, storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN112291326A true CN112291326A (en) 2021-01-29
CN112291326B CN112291326B (en) 2023-04-18

Family

ID=74423774

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011147548.0A Active CN112291326B (en) 2020-10-23 2020-10-23 Load balancing method, load balancing device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN112291326B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113407112A (en) * 2021-05-11 2021-09-17 浙江大华技术股份有限公司 Capacity expansion method, electronic equipment and computer readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103391299A (en) * 2012-05-08 2013-11-13 深圳市腾讯计算机系统有限公司 Load balance method and load balance system
CN107769943A (en) * 2016-08-17 2018-03-06 阿里巴巴集团控股有限公司 A kind of method and apparatus of active and standby cluster switching
CN108769271A (en) * 2018-08-20 2018-11-06 北京百度网讯科技有限公司 Method, apparatus, storage medium and the terminal device of load balancing
CN110417842A (en) * 2018-04-28 2019-11-05 北京京东尚科信息技术有限公司 Fault handling method and device for gateway server
CN110958311A (en) * 2019-11-27 2020-04-03 北京大学 YARN-based shared cluster elastic expansion system and method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103391299A (en) * 2012-05-08 2013-11-13 深圳市腾讯计算机系统有限公司 Load balance method and load balance system
CN107769943A (en) * 2016-08-17 2018-03-06 阿里巴巴集团控股有限公司 A kind of method and apparatus of active and standby cluster switching
CN110417842A (en) * 2018-04-28 2019-11-05 北京京东尚科信息技术有限公司 Fault handling method and device for gateway server
CN108769271A (en) * 2018-08-20 2018-11-06 北京百度网讯科技有限公司 Method, apparatus, storage medium and the terminal device of load balancing
CN110958311A (en) * 2019-11-27 2020-04-03 北京大学 YARN-based shared cluster elastic expansion system and method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113407112A (en) * 2021-05-11 2021-09-17 浙江大华技术股份有限公司 Capacity expansion method, electronic equipment and computer readable storage medium

Also Published As

Publication number Publication date
CN112291326B (en) 2023-04-18

Similar Documents

Publication Publication Date Title
US9571561B2 (en) System and method for dynamically expanding virtual cluster and recording medium on which program for executing the method is recorded
US9442763B2 (en) Resource allocation method and resource management platform
CN111078363B (en) NUMA node scheduling method, device, equipment and medium of virtual machine
CN109451051B (en) Service request processing method and device, electronic equipment and storage medium
US8429666B2 (en) Computing platform with resource constraint negotiation
US20160378570A1 (en) Techniques for Offloading Computational Tasks between Nodes
CN108600005A (en) A method of defence micro services avalanche effect
US20210149743A1 (en) Resource processing method of cloud platform, related device, and storage medium
WO2015101091A1 (en) Distributed resource scheduling method and device
CN105335229A (en) Business resource scheduling method and apparatus
CN112445857A (en) Resource quota management method and device based on database
CN102158387A (en) Protection fault information processing system based on dynamic load balance and mutual hot backup
US20220006879A1 (en) Intelligent scheduling apparatus and method
CN111988234A (en) Overload protection method, device, server and storage medium
US8458719B2 (en) Storage management in a data processing system
CN112291326B (en) Load balancing method, load balancing device, storage medium and electronic equipment
KR20150007698A (en) Load distribution system for virtual desktop service
WO2022062981A1 (en) Resource scheduling method and system, electronic device, and computer-readable storage medium
US20090313634A1 (en) Dynamically selecting an optimal path to a remote node
CN114564313A (en) Load adjustment method and device, electronic equipment and storage medium
CN114116173A (en) Method, device and system for dynamically adjusting task allocation
US9152549B1 (en) Dynamically allocating memory for processes
US11513856B2 (en) Method, devices and computer program products for resource usage
CN115051997A (en) Method and device for scheduling distributed resources, storage medium and electronic equipment
CN107783823A (en) A kind of load-balancing 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