A load balancing method and apparatus
By classifying and identifying session flows and analyzing resources, the problem of existing load balancing algorithms being unable to perceive changes in the state of the load side in real time has been solved, achieving adaptive load balancing and improving the intelligence level of load balancing.
Patent Information
- Application Number
- CN202410557675.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-07
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2044-05-07
AI Technical Summary
Existing load balancing algorithms cannot detect changes in the state of session streams on the load side in real time, resulting in load imbalance.
By classifying and identifying the session flow during the session establishment phase, the traffic distribution and remaining resources of each load end are obtained, and the session flow is allocated to the load end that meets the load balancing conditions based on this information.
It achieves adaptive load balancing, and can sense and respond to changes in the status of existing session streams on the load side in real time, thus improving the intelligence level of load balancing.
Smart Images

Figure CN118433189B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of load balancing, in particular to a load balancing method and device. BACKGROUND
[0002] The server load balancing technology is to distribute network services to multiple servers for processing based on multiple traffic distribution methods, so as to reasonably utilize server resources and improve user access experience.
[0003] At present, the load balancing algorithms of existing devices are mainly divided into three categories: random distribution algorithm, flow state distribution algorithm and dynamic feedback classification algorithm. However, each of the above algorithms generally has specific application value for specific scenarios, and cannot adapt to real-time dynamic changes of scenarios and traffic states, resulting in that load balancing cannot be performed according to the changes of session flow, that is, it is impossible to adaptively select appropriate devices.
[0004] Therefore, how to perform load balancing based on the session flow of the load end change is one of the technical problems worth considering. SUMMARY
[0005] Therefore, the present application provides a load balancing method and device to realize load balancing based on the session flow of the load end change.
[0006] Specifically, the present application is realized by the following technical solutions:
[0007] According to a first aspect of the present application, a load balancing method is provided, which is applied to a load balancing device, and the method comprises:
[0008] Classifying and identifying the obtained first session flow in the session establishment stage to obtain a classification result;
[0009] Obtaining the traffic distribution of the second session flow belonging to the classification result existing in each load end respectively;
[0010] Obtaining the remaining resources of each load end respectively;
[0011] According to the traffic distribution and the remaining resources of each load end, the first session flow is distributed to the load end satisfying the load balancing condition.
[0012] According to a second aspect of the present application, a load balancing device is provided, which is applied to a load balancing device, and the device comprises:
[0013] A first classification and identification module is configured to classify and identify the obtained first session flow in the session establishment stage to obtain a classification result;
[0014] a first obtaining module, configured to obtain a traffic distribution of the second session flow belonging to the classification result existing in each load end respectively;
[0015] a second obtaining module, configured to obtain a remaining resource of each load end respectively;
[0016] a distribution module, configured to distribute the first session flow to a load end satisfying a load balancing condition according to the traffic distribution and the remaining resource of each load end.
[0017] According to a third aspect of the present application, an electronic device is provided, comprising a processor and a machine readable storage medium, the machine readable storage medium stores a computer program capable of being executed by the processor, and the processor is prompted to execute the method provided in the first aspect of the present application by the computer program.
[0018] According to a fourth aspect of the present application, a machine readable storage medium is provided, the machine readable storage medium stores a computer program, and the computer program prompts the processor to execute the method provided in the first aspect of the present application when being called and executed by the processor.
[0019] The beneficial effects of the embodiments of the present application are as follows:
[0020] The load balancing method and device provided in the embodiments of the present application perform classification and identification processing on the first session flow obtained in the session establishment stage to obtain a classification result, obtain a traffic distribution of the second session flow belonging to the classification result existing in each load end respectively, obtain a remaining resource of each load end respectively, and distribute the first session flow to a load end satisfying a load balancing condition according to the traffic distribution and the remaining resource of each load end.
[0021] In the foregoing method, when performing load balancing, the session flow is first processed by classification, and then the traffic distribution of the existing session flow corresponding to the classification result under each load end and the remaining resource of each load end are obtained based on the classification result, so that the traffic distribution of the existing session flow under the load end is perceived, and the resource usage of the load end is also considered, thereby selecting a suitable load end for load balancing, and solving the problem that the current load balancing algorithm cannot perceive the state change of the existing session flow under the load end in real time. BRIEF DESCRIPTION OF DRAWINGS
[0022] Figure 1 is a flow diagram of a load balancing method provided in the embodiments of the present application;
[0023] Figure 2 is a flow diagram of another load balancing method provided in the embodiments of the present application;
[0024] Figure 3is a structural schematic diagram of a load balancing device provided by an embodiment of the present application;
[0025] Figure 4 is a hardware structural schematic diagram of an electronic device for implementing a load balancing method provided by an embodiment of the present application. DETAILED DESCRIPTION
[0026] The exemplary embodiments will be described in detail herein with reference to the attached drawings. In the following description, unless otherwise indicated, like numbers in the attached drawings refer to the same or similar elements. The following exemplary embodiments described in the detailed description are not meant to be limiting of all embodiments that can be consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present application.
[0027] The terminology used in the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the present application. As used in the present application, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "and / or," as used herein, refers to and encompasses any or all possible combinations of one or more of the associated listed items.
[0028] It is to be understood that although the terms first, second, third, etc. can be used herein to describe various information, these terms are not intended to denote a particular order or hierarchy. These terms are used merely for the purpose of distinguishing one type of information from another. For example, a first information can be referred to as a second information, and similarly, a second information can be referred to as a first information, without departing from the scope of the present application. As used herein, the term "if' can be construed to mean "when" or "upon" or "in response to determining" terms denoting the occurrence of an action.
[0029] Before introducing the method provided by the present application, the technical terms involved in the present application are introduced:
[0030] 1. The random allocation algorithm refers to randomly allocating requests to a server. The algorithm includes a random algorithm and a weighted random allocation algorithm, wherein:
[0031] (1) The random algorithm refers to a device randomly distributing user requests to a device.
[0032] (2) The weighted random allocation algorithm mainly includes a weighted round-robin algorithm. The algorithm refers to a device distributing user requests to each server according to the weight of the server in a certain proportion. The administrator can assign a larger weight to a high-performance server to make it get more traffic.
[0033] 2、Based on the flow state distribution algorithm, refers to a certain fixed feature distribution request to a device. The algorithm can include: weighted minimum connection algorithm, hash algorithm, maximum residual bandwidth algorithm, weighted bandwidth algorithm, etc., wherein:
[0034] (1) Weighted minimum connection algorithm, refers to the device will user request distribution to the weighted active connection number of the smallest server. Weighted active connection number is the ratio of the current activity and the server weight.
[0035] (2) Hash algorithm, refers to the device will have the same characteristics of user request distribution to the same server. For example, based on the source IP address of the hash algorithm, the source IP address of the same user request can be distributed to the same server for processing.
[0036] (3) Maximum residual bandwidth algorithm, refers to the device always distributes user requests to the server with the maximum residual bandwidth.
[0037] (4) Weighted bandwidth algorithm, refers to the device according to the weight and residual bandwidth to calculate the weighted residual bandwidth of the server and distribute user requests to the server with the maximum weighted residual bandwidth.
[0038] 3、Dynamic feedback distribution algorithm, refers to the request according to the relevant characteristics of the server to a certain server. The algorithm can include: dynamic feedback algorithm and fastest response algorithm, etc., wherein:
[0039] (1) Dynamic feedback algorithm, refers to the device according to the memory, CPU and disk usage of the server, etc. Information, calculate the weight of the current server, and distribute user requests to each server according to the weight.
[0040] (2) Fastest response algorithm, refers to the device according to the response time of the server to calculate the weight of the current load capacity, and distribute user requests to each server according to the weight.
[0041] The load balancing method provided by the present application is described in detail below.
[0042] Referring to Figure 1 , Figure 1 is a flow chart of a load balancing method provided by the present application, which can be applied to a load balancing device. When the method is implemented, the load balancing device can include the following steps:
[0043] Step 101, classifying and identifying the first session flow obtained in the session establishment stage to obtain a classification result.
[0044] In this step, in order to realize the load balancing of the traffic on each load end, the load balancing device can capture the session flow flowing through the load balancing device. For the session flow of the allocated load end, the load balancing device directly distributes the session flow to the allocated load end. For the newly established session flow, the load balancing device needs to load balance it to allocate the newly established session flow to the appropriate load end.
[0045] The new session flow has two stages: a session establishment stage and a session maintenance stage. In order to realize the load balancing of the session flow, the embodiment proposes that after obtaining the new session flow, the session flow is a session flow in the session establishment stage, and is recorded as a first session flow for convenience of description. The first session flow is classified to obtain the classification to which the first session flow belongs.
[0046] Specifically, the fingerprint information can be extracted from the first session flow, and then the classification to which the first session flow belongs is identified based on the fingerprint information. Specifically, a pre-classification identification model can be called to process the fingerprint information, so as to obtain the classification result of the first session flow.
[0047] It should be noted that the pre-classification identification model can be obtained by training a machine model based on the fingerprint information and the corresponding classification of each known classification session flow. The application does not limit the machine model used.
[0048] Optionally, the fingerprint information can include but is not limited to the IP address in the session establishment stage, the domain name, the port number, the key feature data in the session flow, and the like.
[0049] When performing classification identification, a fingerprint library can be obtained, which records the correspondence between each fingerprint information and classification. Based on this, the fingerprint information of the first session flow can be matched with the fingerprint library to obtain the corresponding classification result of the matched fingerprint information.
[0050] Step 102, respectively obtaining the traffic distribution of the second session flow belonging to the classification result existing in each load end.
[0051] In this step, in order to realize load balancing, the traffic distribution of the existing session flow belonging to the above classification result under each load end can be obtained, and then the load balancing of the first session flow is performed based on the traffic distribution. Therefore, the traffic distribution of the existing session flow of each load end is fully considered in the load balancing process.
[0052] Specifically, when obtaining the traffic distribution of the second session flow, the second session flow belonging to the classification result of each load end can be obtained from the existing session flow library, and then the traffic distribution of each second session flow is calculated. Specifically, the existing session flow library can mark each session flow to mark the category of the session flow. Based on this, the load balancing device can obtain the second session flow belonging to the classification result of each load end based on the category of the marked session flow.
[0053] Step 103, obtaining the remaining resources of each load end respectively.
[0054] In this step, since the load end consumes the resources of the load end when processing each session flow, the load end with less remaining resources may not be able to accept new session flows. Based on this, the remaining resources of each load end are considered in the load balancing process, and this step is performed in the embodiment.
[0055] It should be noted that the implementation order of steps 102 and 103 is not limited by the present application, that is, step 102 can be performed first and then step 103, of course, step 103 can be performed first and then step 102, or steps 102 and 103 can be performed simultaneously, which can be configured according to actual conditions. Figure 1
[0056] Step 104, distributing the first session flow to the load end satisfying the load balancing condition according to the traffic distribution of each load end and the remaining resources.
[0057] In this step, the load balancing condition can be set based on the traffic distribution and the remaining resources. In this way, after obtaining the traffic distribution of each load end and the remaining resources of each load end, the load balancing condition can be obtained, and then a load end satisfying the load balancing condition is selected, and the first session flow and the session flow used for session maintenance after the first session flow are distributed to the selected load end, thereby realizing load balancing processing based on the perceived state of the existing session flow of each load end, and solving the problem that the current load balancing algorithm cannot perceive the state change of the existing session flow of the load end in real time, resulting in unbalanced load.
[0058] Optionally, the load end can be but is not limited to a server or other electronic device.
[0059] In the load balancing method provided in the application, the obtained first session flow in the session establishment stage is classified and identified to obtain a classification result; the traffic distribution of the second session flow belonging to the classification result existing in each load end is obtained respectively; the remaining resources of each load end are obtained respectively; and the first session flow is distributed to the load end satisfying the load balancing condition according to the traffic distribution and the remaining resources of each load end.
[0060] In the foregoing method, when load balancing is performed, the session flow is classified first, and then the traffic distribution of the existing session flow corresponding to the classification result under each load end and the remaining resource condition of each load end are obtained based on the classification result, so that the traffic distribution of the existing session flow of the load end is perceived and the resource use condition of the load end is considered, thereby selecting a suitable load end for load balancing, solving the problem that the current load balancing algorithm cannot perceive the state change of the existing session flow of the load end in real time, and realizing adaptive load balancing.
[0061] Optionally, based on the foregoing embodiment, in the embodiment, step 104 can be performed according to the following process: the remaining resources of each load end are normalized to obtain the weight coefficient of the remaining resources of each load end; the traffic distribution of each load end is normalized by using the weight coefficient of the remaining resources of each load end to obtain the normalized traffic distribution of each load end; and the first session flow is distributed to the load end satisfying the load balancing condition according to the normalized traffic distribution of each load end.
[0062] Specifically, in order to facilitate the selection of a suitable load end, the embodiment proposes to associate the traffic distribution and the remaining resources of the load end, and then select the load end satisfying the load balancing condition based on the association result. Specifically, the remaining resources of each load end can be normalized first, and then the normalized result is associated with the traffic distribution, and load balancing is performed based on the association result.
[0063] In specific implementation, the remaining resources of each load end are normalized based on the maximum remaining resource in each load end, for example, the ratio of the remaining resources of each load end to the maximum remaining resource is taken as the weight coefficient of each load end. Then, when the traffic distribution is normalized by using the weight coefficient, the weight coefficient of each load end can be processed by taking the reciprocal, and the product of the reciprocal and the traffic distribution of the load end is taken as the normalized traffic distribution of the load end. On this basis, the first session flow is sent to the load end corresponding to the normalized traffic distribution satisfying the load balancing condition.
[0064] Optionally, based on any of the above embodiments, in this embodiment, step 102 can be performed according to the following process: for each load end, obtaining the traffic statistical features of each second session flow belonging to the classification result; and according to the traffic statistical features of each second session flow, counting the traffic distribution of the load end.
[0065] Specifically, each load end can provide session service for at least one classified session flow, and the same classified session flows served on different load ends are different, for example, the traffic sizes of the session flows are different, and accordingly, the resources of the load end consumed are also different, thereby affecting the load end to be selected when load balancing. Based on this, after obtaining the classification result of the first session flow, the second session flows belonging to the classification result of each load end can be obtained for traffic feature counting, thereby obtaining the traffic statistical features of each second session flow of the load end, and further, based on the traffic statistical features of each second session flow, the traffic distribution of the second session flows belonging to the classification result of the load end is calculated.
[0066] Further, the traffic statistical features of each second session flow at least include: session traffic, total occupied bandwidth, instantaneous occupied bandwidth, and session duration. On this basis, the step of counting the traffic distribution of the load end according to the traffic statistical features of each second session flow can be performed according to the following process: counting the flow number of the concurrent second session flows of the load end under the classification result; performing average processing on the session traffic of each second session flow to obtain the average session traffic of the load end under the classification result; performing average processing on the total occupied bandwidth of each second session flow to obtain the average occupied bandwidth of the load end under the classification result; performing summation processing on the current instantaneous occupied bandwidth of each second session flow to obtain the instantaneous total occupied bandwidth of the load end under the classification result; and performing average processing on the session duration of each second session flow to obtain the average session duration of the load end under the classification result.
[0067] Specifically, for each load end, the resource occupation of the second session flow on each load end can be monitored, and each second session flow can be characterized by the following traffic statistical features:
[0068] FS={session traffic, total occupied bandwidth, instantaneous occupied bandwidth, session duration}
[0069] ={fs 1 , fs 2 , fs 3 , fs 4}
[0070] wherein, fs i is the cumulative session traffic, fs i is the total occupied bandwidth, fs3 fs is the instantaneous occupied bandwidth 4 is the current session duration.
[0071] After obtaining the traffic statistical features of each concurrent second session flow, the traffic distribution of the existing second session flows belonging to the above classification results in each load end can be obtained according to the identified classification results, which can be described by the following statistical features:
[0072] If there are session flows of category 1, category 2, category 3 and category 4 in the i-th load end, then the traffic distribution of the second session flows in each category in the i-th load end is L i which can be shown as follows:
[0073] L i = {FM i1 , FM i2 , FM i3 , FM i4}
[0074] wherein, FM i1 represents the traffic distribution of the second session flows belonging to category 1 in the i-th load end;
[0075] FM i2 represents the traffic distribution of the second session flows belonging to category 2 in the i-th load end;
[0076] FM i3 represents the traffic distribution of the second session flows belonging to category 3 in the i-th load end;
[0077] FM i4 represents the traffic distribution of the second session flows belonging to category 4 in the i-th load end;
[0078] For the convenience of description, category 1 is taken as an example for description, and the traffic statistical features of the second session flows of category 1 can be shown as follows:
[0079]
[0080] wherein, represents the number of concurrent second session flows belonging to category 1 in the i-th load end, that is, the number of the second session flows of category 1 is counted.
[0081] represents the average session traffic of the i-th load end belonging to category 1, that is, the sum of the current cumulative session traffic of each second session flow is divided by the total number of concurrent session flows, which can be characterized by the following formula:
[0082]
[0083] wherein, represents the session traffic of the kth second session flow, k is between 1 and the number of flows determined above .
[0084] represents the average occupied bandwidth of the ith load end currently belonging to category 1, and can be expressed by the following formula:
[0085]
[0086] wherein, represents the total occupied bandwidth of the kth second session flow.
[0087] represents the instantaneous occupied total bandwidth of the current instantaneous occupied bandwidth of the second session flow of the ith load end currently belonging to category 1, that is, taking the sum of the instantaneous occupied bandwidth of each second session flow, and can be expressed as:
[0088]
[0089] wherein, represents the current instantaneous occupied bandwidth of the kth second session flow.
[0090] represents the average session duration of the ith load end currently belonging to category 1, and can be identified by the following formula:
[0091]
[0092] wherein, in the formula, represents the session duration of the kth second session flow.
[0093] Based on this, through the above formula, the traffic distribution of each load end in any category of second session flow can be obtained, for example, if the first session flow is currently identified to belong to category 1, the traffic distribution of the second session flow of the ith load end belonging to category 1 can be directly obtained, that is, the above FM i1 . If there are currently 4 load ends, the traffic distribution of the second session flow of each load end belonging to category 1 can be represented as follows:
[0094] D i ={FM 1i , FM 2i , FM 3i , FM 4i}
[0095] wherein, D i represents the traffic distribution of each load end under category 1.
[0096] When the categories to which the session flows of the service ends belong include Category 1-Category 4, the traffic distribution of each load end belonging to each category can refer to Table 1 shown as follows:
[0097] Table 1
[0098]
[0099]
[0100] Based on the above embodiment, in the embodiment, the remaining resources of each load end include the remaining computing resources of the load end, and / or the remaining link resources of the load end.
[0101] Specifically, the remaining computing resources can include but are not limited to CPU, memory, disk and the like; and the remaining link resources can include but are not limited to remaining bandwidth.
[0102] Specifically, when the remaining resources of each load end include the remaining computing resources of the load end, taking the idle rate of the remaining computing resources including CPU as an example, when the idle rate of the CPU is normalized, assuming that there are currently four load ends, the remaining computing resources of each load end can be respectively represented as:
[0103] {S1, S2, S3, S4}
[0104] wherein, S i represents the idle rate of the CPU of the i-th load end, based on which, the maximum idle rate of the CPU can be found, represented as: S max ={S1, S2, S3, S4}.
[0105] On this basis, the idle rate of the CPU of each load end can be normalized according to the maximum idle rate of the CPU, thereby obtaining the normalized weight coefficient of each load end, which can be represented as:
[0106]
[0107] It should be noted that when the remaining computing resources of each load end include the idle rate of the memory and the like, S i represents the idle rate of the memory of the i-th load end; and when the remaining computing resources of each load end include the idle rate of the CPU and the idle rate of the memory, S i is represented by the product of the idle rate of the CPU and the idle rate of the memory of the i-th load end. Wherein, the idle rate of the CPU = 1-CPU usage rate, and the idle rate of the memory = 1-memory usage rate.
[0108] Similarly, when the residual resource of each load end includes the residual link resource of the load end, taking the residual link resource including the residual bandwidth as an example for description, and taking the current four load ends as an example for description when the residual bandwidth is normalized, the residual link resource of each load end can be respectively represented as:
[0109] {D1, D2, D3, D4}
[0110] wherein, D i is the value of the residual bandwidth of the i-th load end; based on this, the maximum residual bandwidth can be found, represented as: D max =max{D1, D2, D3, D4}.
[0111] On this basis, the residual bandwidth of each load end can be normalized according to the maximum residual bandwidth, so as to obtain the normalized weight coefficient of each load end, which can be represented as:
[0112]
[0113] When the residual link resource of each load end includes other resources, D i represents the value of the other resources of the i-th load end; and when the residual link resource of each load end includes the residual bandwidth and other resources, D i is represented by the product of the residual bandwidth and the other resources of the i-th load end.
[0114] In addition, when the residual resource includes the residual computing resource and the residual link resource, the weight coefficient G norm obtained by normalizing the residual resource of each load end can be obtained by comprehensive processing of the weight coefficient obtained by normalizing the residual computing resource of each load end and the weight coefficient obtained by normalizing the residual link resource, which can be represented as:
[0115]
[0116] On this basis, after identifying the classification result of the new first session flow, the step of normalizing the traffic distribution of each load end according to the weight coefficient of the residual resource of each load end can be performed according to the following process: the traffic distribution of each load end belonging to the above classification result is corrected by using the weight coefficient of the residual resource, that is, the traffic distribution of each load end is normalized according to each weight coefficient. The more the normalized residual resource of the load end, the smaller the relative occupation amount of the load resource, and therefore the following correction method can be used:
[0117]
[0118] In the above formula, the processing capability of the remaining resources can be represented by L, and the relative occupied resources can be represented by L. The normalized traffic distribution obtained by the normalization can indicate that the smaller the ratio of the normalized traffic distribution, the smaller the occupied amount of resources required by the session flow, and the higher the idle degree of the load end.
[0119] On this basis, the step of assigning the first session flow to the load end satisfying the load balancing condition according to the normalized traffic distribution of each load end can be performed in the following process:
[0120] In one embodiment, the load balancing condition can be that the load end with the minimum instantaneous total bandwidth is selected from the normalized traffic distribution. That is, the load end with the minimum instantaneous total bandwidth after normalization in the classification result can be assigned as the load end satisfying the load balancing condition. It should be noted that the smaller the instantaneous total bandwidth of the load end, the lower the traffic of the current load end session flow, and the higher the possibility of the current load end to undertake a new session flow. Taking the current four load ends and the classification result of category 1 as an example, it can be represented as: The load end corresponding to the minimum value min is selected as the load end satisfying the load balancing condition.
[0121] In another possible embodiment, the load balancing condition can be that the load end with the minimum number of concurrent session flows is selected from the normalized traffic distribution. It should be noted that the fewer the number of concurrent flows in the load end, the more possible the current load end to have more remaining resources, and the higher the possibility of undertaking a new session flow. Taking the current four load ends and the classification result of category 1 as an example, the number of flows of the selected load end can be represented by the following formula:
[0122] In another possible embodiment, the load balancing condition can also be that the load end with the minimum product of the average occupied bandwidth and the average session duration is selected based on the normalized traffic distribution. Since the average occupied bandwidth can predict the future occupied bandwidth of the load end, and the evaluation of the session duration can also predict the future session duration of the load end, the selection of the load balancing based on these two parameters can achieve better load balancing. Taking the current four load ends and the classification result of category 1 as an example, the selected load end can satisfy the following formula:
[0123] In addition, other load balancing conditions can also be set based on the normalized traffic distribution, for example, the normalized traffic distribution of each load end is weighted, the corresponding load balancing condition is selected based on the weighted result, and then the appropriate load end is selected.
[0124] Optionally, after step 103 is performed, before step 104 is performed, in the embodiment, the following method is further provided: according to the residual resources of each load end, determining the load end whose residual resources are within the permitted residual resource range for load sharing.
[0125] Specifically, in actual application, there may be a case that the current residual resources of a certain load end are insufficient to undertake a new electronic flow. Based on this, after obtaining the residual resources of each load end, the residual resources of each load end can be first identified to confirm whether the residual resources of each load end are within the permitted resource range for load sharing, so as to identify the target load end within the permitted resource range.
[0126] It should be noted that when the residual resources include residual computing resources and residual link resources, the permitted computing resource range and the permitted link resource range need to be set respectively for the two resources. For each load end, only when the residual computing resource range of the load end is within the permitted computing resource range and the residual link resource of the load end is within the permitted link resource range, it means that the load end is within the permitted resource range and can be the target load end.
[0127] On this basis, step 104 can be performed according to the following process: according to the traffic distribution of the determined target load end and the residual resources of the corresponding load end, the first session flow is allocated to the load end that meets the load balancing condition.
[0128] Optionally, based on any one of the above embodiments, the embodiment further provides Figure 2 The flowchart shown includes the following steps:
[0129] Step 201, performing traffic feature statistical processing on the third session flow in the session maintenance phase after the first session flow, to obtain traffic statistical features.
[0130] In this step, after the first session flow selects a load end for undertaking the session flow, the session flow in the session maintenance phase after the first session flow will also be allocated to the load end. For the convenience of description, the session flow in the session maintenance phase is recorded as the third session flow. Based on this, since there are fewer features in the first session flow, when pre-classification is performed based on the fingerprint features in the first session flow, the classification result obtained may not be the true classification of the session flow.
[0131] Therefore, the embodiment proposes to perform feature extraction on the third session flow. Since the third session flow is a session flow in the session maintenance phase, the features in the third session flow are more than those in the first session flow. Therefore, secondary classification identification is performed based on the third session flow to obtain an accurate classification result, and the classification result of the first session flow is corrected.
[0132] Specifically, the load balancing device records the correspondence between the flow identifier of each new session flow and the classification result after each execution of step 101, and the flow identifiers corresponding to different session flows are different, as shown in Table 2. Based on this, the classification result of the corresponding session flow in the correspondence is corrected using the classification result obtained by the embodiment after the classification and identification based on the third session flow is performed.
[0133] Table 2
[0134] Session flow Stream identification Classification result Session flow 1 Stream identification 1 Category 1 Session flow 2 Stream identification 2 Category 2 Session flow 3 Stream identification 3 Category 3 Session flow 4 Stream identification 4 Category 1 …… …… ……
[0135] Specifically, the traffic statistical features can be extracted according to the following process: taking the third session flow as an example, monitoring the state information of the existing third session flow, and starting to extract the traffic statistical features after the third session flow is established for a period of time (generally 15 seconds). When extracting the traffic statistical features, many mature extraction methods and tools currently available can be used, such as the CICFLOWMETER analysis tool, and various traffic statistical features can be extracted to improve the accuracy of the classification and identification result.
[0136] Specifically, the traffic statistical features can include but are not limited to: session duration (different application session durations are different), uplink and downlink packet capacity dimension statistical features (such as packet size, number, average value, maximum packet, minimum packet, uplink and downlink traffic ratio, etc.), uplink and downlink packet time dimension statistical features (such as uplink and downlink packet time interval, session idle time, session active time, idle time to active time ratio, etc.), special protocol and character statistical features (specific session protocol identifier, identification bit, etc.), etc.
[0137] Step 202, identifying and processing the traffic statistical features using the trained classification model to obtain a new classification result.
[0138] The classification model is obtained by learning the mapping relationship between the traffic statistical features of the session flow in the session maintenance phase of the load end and the corrected classification result of the corresponding session flow.
[0139] In this step, the machine learning model can be trained in advance using the traffic statistical features of the session flow in the session maintenance phase and the classification result of the session flow, thereby obtaining the trained classification model.
[0140] Based on this, after obtaining the traffic statistical features of the third session flow, the traffic statistical features can be input into the trained classification model, thereby obtaining the classification result of the third session flow, i.e., the new classification result.
[0141] Step 203: Correct the classification result of the first session stream using the new classification result.
[0142] In this step, after obtaining the classification result of the third session stream, if the classification result of the third session stream is consistent with the classification result of the first session stream, the classification result of the first session stream remains unchanged; if the classification result of the third session stream is different, the classification result of the first session stream is updated to the classification result of the third session stream. Taking Table 2 as an example, if the stream identifier of the first session stream is stream identifier 1, and after executing this embodiment, the classification result of the third session stream is category 2, then the classification result of the first session stream can be changed to category 2, as shown in Table 3.
[0143] Table 3
[0144] Session flow Stream identification Classification result Session flow 1 Stream identification 1 Category 2 Session flow 2 Stream identification 2 Category 2 Session flow 3 Stream identification 3 Category 3 Session flow 4 Stream identification 4 Category 1 ……
[0145] Based on this, and taking Tables 2 and 3 as examples, after the category correction, the current status of each session flow on load side 1 is as follows: the second session flow included in category 1 has been updated from the original session flow 1 and session flow 4 to session flow 4; the second session flow included in category 2 has been updated from the original session flow 2 to session flow 1 and session flow 2; and the second session flow included in category 3 is session flow 4.
[0146] Based on this, when the load balancer receives a new first session stream again, the load balancer executes... Figure 1 In the load balancing process shown, if the classification result of the new first session flow is identified as category 2, then when the traffic distribution of the second session flow under category 2 of each load end is obtained, a new session flow 1 is added to the second session flow belonging to category 2 in load end 1. Accordingly, the traffic distribution of the second session flow belonging to category 2 in load end 1 will change, which will affect the load balancing result based on the traffic distribution. That is, it realizes adaptive load balancing based on the perceived changes in the session flow in the load end.
[0147] The traffic statistical features of each second session flow include session traffic, total occupied bandwidth, instantaneous occupied bandwidth, and session duration. As the second session flow belonging to category 2 in the load end is added with the session flow 1, the session flow 1 will affect the traffic distribution of the category 2 in the load end 1 based on the aforementioned traffic statistical features, that is, the traffic distribution of the category 2 in the load end 1 is changed from the traffic distribution calculated by the traffic statistical features of the session flow 2 to the traffic distribution calculated by the traffic statistical features of the session flow 1 and the session flow 2, which indicates that the session flow of the category 2 in the load end 1 is relatively more, and which will affect the selection of the load end in the load balancing process based on the traffic distribution, that is, the adaptive load balancing process based on the change of the session flow in the load end is realized.
[0148] Through the correction of the classification result of the session flow, the traffic statistical features of the concurrent session flow of the session flow under the corrected classification result of the load end to which the session flow belongs are more accurate, thereby improving the accuracy of the traffic distribution of the corrected classification result of the load end, and further improving the accuracy of the load balancing result.
[0149] It should be noted that the aforementioned classification result can include, but is not limited to, an application class, and further, the application class can further include a webpage traffic class, a streaming video class, an instant messaging class, a business shopping class, and the like. Of course, there can be other classification descriptions, for example, the session flow is classified according to the tolerance of the session flow to delay and packet loss, which can include the categories shown in Table 4:
[0150] Table 4
[0151] Stream category Latency tolerance Packet loss tolerance Category 1 Low Low Category 2 Low High Category 3 High Low Category 4 High High
[0152] Of course, the session flow can be classified more finely, but in the case of more classification, more device resources can be consumed, and when the classification is set, the fineness of the classification recognition and the device resources can be balanced to ensure the optimal experience.
[0153] Based on the above embodiment, in this embodiment, after the classification result of the first session flow is obtained in step 101, the load balancing can be performed according to the following process: based on the correspondence between the classification result and the load balancing algorithm, the load balancing algorithm corresponding to the classification result of the first session flow is determined, and then the first session flow is selected to the load end according to the determined load balancing algorithm. For example, the correspondence between each load balancing algorithm and the flow category of the session flow can be referred to Table 5:
[0154] Table 5
[0155] Stream category Load balancing algorithm Category 1 Fastest response algorithm Category 2 Dynamic feedback algorithm Category 3 Maximum bandwidth algorithm Category 4 Dynamic feedback algorithm Category 5 Weighted least connection algorithm …… ……
[0156] Based on this, if the classification result identified based on step 101 is class 1, the fastest response algorithm can be used to perform load balancing processing on the first session flow to select a load end for processing the first session flow.
[0157] In this way, the session flow is pre-classified and identified by extracting the fingerprint information of the session flow in the session establishment stage. According to the classification result of the session flow, the traffic distribution of the existing concurrent session flows of each load end and the remaining resources of each load end are combined to adaptively select a load end, thereby solving the problem that the current load balancing algorithm cannot perceive the state change of the session flow in real time for load balancing selection, and improving the intelligent level.
[0158] Based on the same inventive concept, the present application also provides a load balancing device corresponding to the above-mentioned load balancing method. The implementation of the load balancing device can be referred to the description of the load balancing method above, which will not be discussed one by one here.
[0159] Referring to Figure 3 , Figure 3 is a load balancing device provided by an exemplary embodiment of the present application, applied in a load balancing device, the device comprises:
[0160] A first classification and identification module 301 is configured to perform classification and identification processing on the obtained first session flow in the session establishment stage to obtain a classification result.
[0161] A first obtaining module 302 is configured to obtain the traffic distribution of the second session flow belonging to the classification result existing in each load end.
[0162] A second obtaining module 303 is configured to obtain the remaining resources of each load end.
[0163] A distribution module 304 is configured to distribute the first session flow to a load end satisfying a load balancing condition according to the traffic distribution and the remaining resources of each load end.
[0164] In this way, when performing load balancing, the session flow is first classified and processed, and then the traffic distribution of the existing session flow under the corresponding classification result of each load end and the remaining resources of each load end are obtained based on the classification result. The traffic distribution of the existing session flow of the load end is perceived, and the resource usage of the load end is also considered, so that a suitable load end is selected for load balancing, thereby solving the problem that the current load balancing algorithm cannot perceive the state change of the existing session flow of the load end in real time.
[0165] Optionally, based on the above-mentioned embodiments, in this embodiment, the distribution module 304 is specifically configured to normalize the residual resources of each load end to obtain a weight coefficient of the residual resources of each load end; normalize the traffic distribution of each load end by using the weight coefficient of the residual resources of each load end to obtain a normalized traffic distribution of each load end; and distribute the first session flow to a load end that meets the load balancing condition according to the normalized traffic distribution of each load end.
[0166] Optionally, based on the above-mentioned embodiments, in this embodiment, the first obtaining module 302 is specifically configured to obtain, for each load end, a traffic statistical feature of each second session flow belonging to the classification result; and obtain the traffic distribution of the load end according to the traffic statistical feature of each second session flow.
[0167] Further, in this embodiment, the traffic statistical feature of each second session flow at least includes: session traffic, total occupied bandwidth, instantaneous occupied bandwidth, session duration;
[0168] The first obtaining module 302 is specifically configured to count the number of concurrent second session flows of the load end under the classification result; average the session traffic of each second session flow to obtain the average session traffic of the load end under the classification result; average the total occupied bandwidth of each second session flow to obtain the average occupied bandwidth of the load end under the classification result; sum the current instantaneous occupied bandwidth of each second session flow to obtain the total instantaneous occupied bandwidth of the load end under the classification result; and average the session duration of each second session flow to obtain the average session duration of the load end under the classification result.
[0169] Based on any one of the above-mentioned embodiments, the load balancing device provided in this embodiment can further include:
[0170] A statistical module (not shown in the figure) is configured to perform traffic feature statistical processing on a third session flow in a session maintaining stage after the first session flow to obtain a traffic statistical feature;
[0171] A second classification and identification module (not shown in the figure) is configured to perform identification processing on the traffic statistical feature by using the trained classification model to obtain a new classification result;
[0172] A correction module (not shown in the figure) is configured to correct the classification result of the first session flow by using the new classification result;
[0173] The classification model is obtained by learning the mapping relationship between the traffic statistical feature of the session flow in the session maintaining stage of the load end and the corrected classification result of the corresponding session flow.
[0174] Based on the same inventive concept, the embodiments of the present application provide an electronic device, which can be but is not limited to the load balancing device described above. As shown in the figure, the electronic device includes a processor 401 and a machine readable storage medium 402, the machine readable storage medium 402 stores a computer program capable of being executed by the processor 401, and the processor 401 is prompted by the computer program to execute the load balancing method provided by any of the embodiments of the present application. In addition, the electronic device also includes a communication interface 403 and a communication bus 404, wherein the processor 401, the communication interface 403 and the machine readable storage medium 402 complete the communication among each other through the communication bus 404. Figure 4
[0175] The communication bus mentioned in the above electronic device can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or only one type of bus.
[0176] The communication interface is used for the communication between the above electronic device and other devices.
[0177] The above machine readable storage medium 402 can be a memory, which can include a random access memory (RAM), a DDR SRAM (double data rate synchronous dynamic random access memory), and can also include a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory can also be at least one storage device located away from the aforementioned processor.
[0178] The processor described above can be a general processor, including a central processing unit (CPU), a network processor (NP), etc.; can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component.
[0179] For the electronic device and the machine readable storage medium embodiments, since the method content involved is basically similar to the foregoing method embodiments, the description is relatively simple, and the related parts are described in the method embodiment part.
[0180] It should be noted that, in this document, the relationship terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the terms "include", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. Without more limitations, the element defined by the statement "including a" does not exclude the presence of another identical element in the process, method, article or device including the element.
[0181] The implementation process of the functions and roles of each unit / module in the above device is specifically described in the implementation process of the corresponding steps in the above method, which will not be repeated here.
[0182] For the device embodiment, since it basically corresponds to the method embodiment, the related parts are described in the method embodiment part. The device embodiments described above are only illustrative, and the units / modules described as separate components can or can not be physically separated, and the components shown as units / modules can or can not be physical units / modules, that is, they can be located in one place or distributed on multiple network units / modules. According to actual needs, part or all of the units / modules can be selected to achieve the purpose of the present application. Those skilled in the art can understand and implement it without creative labor.
[0183] The above only is the preferred embodiment of the present application, and is not used to limit the present application, any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application.
Claims
1. A load balancing method, characterized by, The method, applied in load balancing equipment, includes: The first session stream obtained during the session establishment phase is classified and identified to obtain the classification results; Obtain the traffic distribution of the second session stream belonging to the classification result in each load end; Obtain the remaining resources for each load end; Based on the traffic distribution and remaining resources of each load end, the first session flow is allocated to load ends that meet the load balancing conditions.
2. The method according to claim 1, characterized in that, Based on the traffic distribution and remaining resources of each load terminal, the first session flow is allocated to load terminals that meet the load balancing conditions, including: The remaining resources of each load end are normalized to obtain the weight coefficient of the remaining resources of each load end. By using the weighting coefficients of the remaining resources of each load end, the traffic distribution of each load end is normalized to obtain the normalized traffic distribution of each load end. Based on the normalized traffic distribution of each load end, the first session flow is allocated to the load ends that meet the load balancing conditions.
3. The method according to claim 1, characterized in that, Obtain the traffic distribution of the second session stream belonging to the classification result on each load end, including: For each load end, obtain the traffic statistics characteristics of each second session flow belonging to the classification results; Based on the traffic statistics characteristics of each second session stream, the traffic distribution of the load end is statistically obtained.
4. The method according to claim 3, characterized in that, The traffic statistics characteristics of each second session stream include at least: session traffic, total bandwidth occupied, instantaneous bandwidth occupied, and session duration; Based on the traffic statistics characteristics of each second session stream, the traffic distribution of the load end is statistically obtained, including: Count the number of concurrent second session streams on this load end under the classification results; The session traffic of each second session stream is averaged to obtain the average session traffic of the load end under the classification results. The average bandwidth occupied by each second session stream is averaged to obtain the average bandwidth occupied by the load end under the classification results. The instantaneous bandwidth occupied by each second session stream is summed to obtain the total instantaneous bandwidth occupied by the load end under the classification result. The average session duration of each second session stream is calculated to obtain the average session duration of the load end under the classification results.
5. The method according to claim 1, characterized in that, The remaining resources for each load end include the remaining computing resources of that load end, and / or the remaining link resources of that load end.
6. The method according to claim 1, characterized in that, Also includes: Traffic feature statistical processing is performed on the third session stream during the session hold phase following the first session stream to obtain traffic statistical features; The trained classification model is used to identify and process the traffic statistics features to obtain new classification results; The classification result of the first session stream is corrected using the new classification result; The classification model is obtained by learning the mapping relationship between the traffic statistics of the session flow during the session persistence phase on the load side and the corrected classification result of the corresponding session flow.
7. A load balancing device, characterized in that, The device, used in load balancing equipment, includes: The first classification and recognition module is used to classify and recognize the first session stream obtained during the session establishment phase to obtain the classification result; The first acquisition module is used to obtain the traffic distribution of the second session stream belonging to the classification result in each load end; The second acquisition module is used to acquire the remaining resources of each load end respectively; The allocation module is used to allocate the first session flow to load terminals that meet the load balancing conditions based on the traffic distribution of each load terminal and the remaining resources.
8. The apparatus according to claim 7, characterized in that, The allocation module is specifically used to normalize the remaining resources of each load end to obtain the weight coefficient of the remaining resources of each load end; using the weight coefficient of the remaining resources of each load end, normalize the traffic distribution of each load end to obtain the normalized traffic distribution of each load end; and allocate the first session flow to the load end that meets the load balancing conditions according to the normalized traffic distribution of each load end.
9. The apparatus according to claim 7, characterized in that, The first obtaining module is specifically used to obtain the traffic statistics characteristics of each second session flow belonging to the classification result for each load end; and to obtain the traffic distribution of the load end based on the traffic statistics characteristics of each second session flow.
10. The apparatus according to claim 8, characterized in that, The traffic statistics characteristics of each second session stream include at least: session traffic, total bandwidth occupied, instantaneous bandwidth occupied, and session duration; The first obtaining module is specifically used to count the number of concurrent second session streams of the load end under the classification result; to average the session traffic of each second session stream to obtain the average session traffic of the load end under the classification result; to average the total bandwidth occupied by each second session stream to obtain the average bandwidth occupied by the load end under the classification result; to sum the current instantaneous bandwidth occupied by each second session stream to obtain the instantaneous total bandwidth occupied by the load end under the classification result; and to average the session duration of each second session stream to obtain the average session duration of the load end under the classification result.
11. The apparatus according to claim 7, characterized in that, Also includes: The statistics module is used to perform traffic feature statistical processing on the third session stream during the session hold phase after the first session stream, and obtain traffic statistical features. The second classification and recognition module is used to identify and process the traffic statistics features using a trained classification model to obtain new classification results; A correction module is used to correct the classification result of the first session stream using the new classification result; The classification model is obtained by learning the mapping relationship between the traffic statistics of the session flow during the session persistence phase on the load side and the corrected classification result of the corresponding session flow.
Citation Information
Patent Citations
Load balancing method and load balancing system
CN105704059A
Load sharing method and system of link aggregation
CN109547341A