CN111274026A - Load balancing method and device and electronic equipment - Google Patents
Load balancing method and device and electronic equipment Download PDFInfo
- Publication number
- CN111274026A CN111274026A CN202010016641.1A CN202010016641A CN111274026A CN 111274026 A CN111274026 A CN 111274026A CN 202010016641 A CN202010016641 A CN 202010016641A CN 111274026 A CN111274026 A CN 111274026A
- Authority
- CN
- China
- Prior art keywords
- software
- node
- load balancing
- server
- resource data
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 69
- 238000004590 computer program Methods 0.000 claims description 13
- 238000005516 engineering process Methods 0.000 abstract description 2
- 238000013468 resource allocation Methods 0.000 abstract description 2
- 238000004458 analytical method Methods 0.000 description 8
- 238000005311 autocorrelation function Methods 0.000 description 8
- 238000010586 diagram Methods 0.000 description 8
- 230000008569 process Effects 0.000 description 6
- 230000006870 function Effects 0.000 description 5
- 241001123248 Arma Species 0.000 description 4
- 230000009471 action Effects 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 3
- 230000003068 static effect Effects 0.000 description 3
- 230000009466 transformation Effects 0.000 description 3
- 230000036961 partial effect Effects 0.000 description 2
- 238000007476 Maximum Likelihood Methods 0.000 description 1
- 230000002159 abnormal effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000005314 correlation function Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000000670 limiting effect Effects 0.000 description 1
- 239000011159 matrix material Substances 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 238000010606 normalization Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 230000002829 reductive effect Effects 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 230000002441 reversible effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5083—Techniques for rebalancing the load in a distributed system
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5011—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
- G06F9/5016—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5061—Partitioning or combining of resources
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The present application relates to the field of load balancing technologies, and in particular, to a load balancing method, an apparatus, and an electronic device. The load balancing method provided by the embodiment of the application comprises the following steps: the method comprises the steps of receiving a software use request sent by a terminal device, obtaining historical software use information corresponding to the software use request, obtaining real-time state information of each node server in a server cluster, and determining a target node from the server cluster according to the historical software use information and the real-time state information of each node server in the server cluster so as to establish connection between the terminal device and the target node. The load balancing method, the load balancing device and the electronic equipment can improve the reasonability of server cluster resource allocation.
Description
Technical Field
The present application relates to the field of load balancing technologies, and in particular, to a load balancing method, an apparatus, and an electronic device.
Background
In a cloud platform, a server cluster generally comprises a plurality of node servers, each node server has certain difference in hardware configuration and access heat, and due to diversity, real-time performance and application complexity of users, unbalance of loads of the node servers in the server cluster is possibly caused, so that system performance is influenced, resource utilization rate is reduced, and even some overloaded node servers are down. Therefore, to ensure the safe operation of the system and to utilize the resources to the maximum extent, the entire workload of the system should be distributed to each node server so that all the server nodes are neither overloaded nor unloaded, and this process is called load balancing.
Currently, load balancing can be divided into a static load balancing policy and a dynamic load balancing policy according to the execution period of load balancing. The static load balancing strategy refers to an operation algorithm which is preset according to the hardware configuration of each node server, so that the system works according to the operation algorithm and does not change along with the operation time. The dynamic load balancing strategy means that during the operation of the system, the server nodes continuously send real-time state information to the load balancing server, and adjustment is made in advance according to an operation algorithm set by the hardware configuration of each node server and the real-time state information. However, the inventor finds that the server cluster resource allocation realized based on the static load balancing policy and the dynamic load policy only considers the server node state, so that the degree of rationality still needs to be improved.
Disclosure of Invention
An object of the present invention is to provide a load balancing method, a load balancing device and an electronic device, so as to solve the above problems.
In a first aspect, a load balancing method provided in an embodiment of the present application includes:
the load balancing method is characterized by comprising the following steps:
receiving a software use request sent by terminal equipment;
acquiring historical software use information corresponding to the software use request;
acquiring real-time state information of each node server in a server cluster;
and determining a target node from the server cluster according to the historical use information of the software and the real-time state information of each node server in the server cluster so as to establish connection between the terminal equipment and the target node.
The load balancing method provided by the embodiment of the application comprises the following steps: the method comprises the steps of receiving a software use request sent by a terminal device, then obtaining software historical use information corresponding to the software use request, obtaining real-time state information of each node server in a server cluster, and determining a target node from the server cluster according to the software historical use information and the real-time state information of each node server in the server cluster so as to establish connection between the terminal device and the target node. Therefore, in the load balancing process, the real-time state information of each node server is considered, and the historical software use information corresponding to the software use request is combined, so that the reasonability of server cluster resource distribution can be improved.
With reference to the first aspect, an embodiment of the present application further provides a first optional implementation manner of the first aspect, where the software use request includes a user identifier and a software identifier, and the load balancing method further includes:
and acquiring running resource data occupied by a software user corresponding to the user identifier when the software user uses the application software corresponding to the software identifier every a first preset time interval, wherein the running resource data comprises N types of first resource data.
With reference to the first optional implementation manner of the first aspect, an embodiment of the present application further provides a second optional implementation manner of the first aspect, where the obtaining of historical software usage information corresponding to the software usage request includes:
aiming at each type of first resource data included in the N types of first resource data, creating a corresponding resource time sequence to obtain N columns of resource time sequences;
and analyzing the N rows of resource time sequences to obtain the historical software use information corresponding to the software use request.
With reference to the second optional implementation manner of the first aspect, an embodiment of the present application further provides a third optional implementation manner of the first aspect, where analyzing the time series of the N columns of resources to obtain historical software usage information corresponding to the software usage request includes:
judging the attribute property of the resource time sequence aiming at each row of resource time sequences in the N rows of resource time sequences;
selecting an original recognition model according to the attribute properties of the resource time sequence, and estimating model parameters of the original recognition model to obtain a standard recognition model;
analyzing the resource time sequence through a standard identification model to obtain sub-history use information corresponding to the resource time sequence;
and taking N pieces of sub-history use information corresponding to the N columns of resource time sequences as the software history use information corresponding to the software use request.
With reference to the first aspect, an embodiment of the present application further provides a fourth optional implementation manner of the first aspect, where the load balancing method further includes:
and acquiring residual resource data of the node servers at intervals of second preset duration for each node server included in the server cluster, wherein the residual resource data comprises N types of second resource data.
With reference to the fourth optional implementation manner of the first aspect, an embodiment of the present application further provides a fifth optional implementation manner of the first aspect, where the obtaining of the real-time status information of each node server in the server cluster includes:
aiming at each node server included in the server cluster, acquiring a preset number of pieces of residual resource data after the acquisition time from all the residual resource data of the node servers as target resource data;
and obtaining the average value of each type of second resource data in the preset number of item resource data, and using the average value as the real-time state information of the node server.
With reference to the first aspect, an embodiment of the present application further provides a sixth optional implementation manner of the first aspect, where determining a target node from a server cluster according to historical software usage information and real-time state information of each node server in the server cluster includes:
selecting an available node set from the server cluster according to the historical use information of the software and the real-time state information of each node server in the server cluster;
and selecting the optimal node from the available node set as a target node.
In a second aspect, a load balancing apparatus provided in an embodiment of the present application includes:
the request receiving module is used for receiving a software use request sent by the terminal equipment;
the first information acquisition module is used for acquiring historical software use information corresponding to the software use request;
the second information acquisition module is used for acquiring real-time state information of each node server in the server cluster;
and the node determining module is used for determining a target node from the server cluster according to the historical software use information and the real-time state information of each node server in the server cluster so as to establish connection between the terminal equipment and the target node.
The load balancing device provided in the embodiment of the present application has the same beneficial effects as the load balancing method described above, and details are not described here.
In a third aspect, an electronic device provided in an embodiment of the present application includes a processor and a memory, where the memory stores a computer program, and the processor is configured to execute the computer program to implement the load balancing method provided in the first aspect or any optional implementation manner of the first aspect.
The electronic device provided in the embodiment of the present application has the same beneficial effects as the load balancing method described above, and details are not described here.
In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed, the load balancing method provided in the first aspect or any optional implementation manner of the first aspect is implemented.
The computer-readable storage medium provided in the embodiment of the present application has the same beneficial effects as the load balancing method described above, and details are not described here.
Drawings
To more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and that for those skilled in the art, other related drawings can be obtained from the drawings without inventive effort.
Fig. 1 is a schematic structural block diagram of an electronic device according to an embodiment of the present application.
Fig. 2 is a flowchart illustrating steps of a load balancing method according to an embodiment of the present disclosure.
Fig. 3 is a schematic structural block diagram of a software application system according to an embodiment of the present application.
Fig. 4 is a schematic structural block diagram of a load balancing apparatus according to an embodiment of the present application
Reference numerals: 100-an electronic device; 110-a processor; 120-a memory; 200-a terminal device; 300-a cluster of servers; 310-a node server; 400-load balancing means; 410-a request receiving module; 420-a first information acquisition module; 430-a second information acquisition module; 440-node determination module.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
Referring to fig. 1, a schematic block diagram of an electronic device 100 applying a load balancing method according to an embodiment of the present application is provided, where the electronic device may be a server, such as a network server, a database server, and the like.
Structurally, the electronic device 100 provided by the embodiments of the present application may include a processor 110 and a memory 120.
The processor 110 and the memory 120 are electrically connected directly or indirectly to enable data transmission or interaction, for example, the components may be electrically connected to each other via one or more communication buses or signal lines. The load balancing means comprises at least one software module which may be stored in the memory 120 in the form of software or Firmware (Firmware) or may be fixed in an Operating System (OS) of the electronic device 100. The processor 110 is configured to execute executable modules stored in the memory 120, such as software functional modules and computer programs included in the load balancing apparatus, so as to implement the data processing method. The processor 110 may execute the computer program upon receiving the execution instruction.
The processor 110 may be an integrated circuit chip having signal processing capabilities. The Processor 110 may also be a general-purpose Processor, for example, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a discrete gate or transistor logic device, a discrete hardware component, and may implement or execute the methods, steps, and logic blocks disclosed in the embodiments of the present Application. A general purpose processor may be a microprocessor or any conventional processor or the like.
The Memory 120 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Programmable Read-Only Memory (EPROM), and an electrically Erasable Programmable Read-Only Memory (EEPROM). The memory 120 is used for storing a program, and the processor 110 executes the program after receiving the execution instruction.
It should be understood that the structure shown in fig. 1 is merely an illustration, and the electronic device 100 provided in the embodiment of the present application may have fewer or more components than those shown in fig. 1, or may have a different configuration than that shown in fig. 1.
Referring to fig. 1, fig. 1 is a schematic flow chart of a load balancing method according to an embodiment of the present application, and it should be noted that the load balancing method according to the embodiment of the present application is not limited by the sequence shown in fig. 1 and the following, and specific flows and steps of the load balancing method are described below with reference to fig. 1.
Step S100, receiving a software use request sent by the terminal equipment.
In the embodiment of the present application, the terminal Device may be a computer, a smart phone, a tablet, a personal digital Assistant (PAD), a Mobile Internet Device (MID), or the like. In addition, in this embodiment of the application, each terminal device is connected to an electronic device, and the electronic device is connected to each node server included in the server cluster, so as to form the software application system shown in fig. 3. Based on this, the terminal device may generate a software use request including the user identification and the software identification in response to the user software use operation, and transmit the software use request to the electronic device. The user identifier may be user account information, such as a custom nickname, a mobile phone number, and the like, and the software identifier may be a software number.
And step S200, acquiring historical software use information corresponding to the software use request.
Based on step S200, the load balancing method provided in this embodiment of the present application may further include step S001 of, every interval of a first preset duration, acquiring running resource data occupied by a software user corresponding to the user identifier when using application software corresponding to the software identifier, where the running resource data includes N types of first resource data, and the acquired running resource data may be stored in a memory included in the electronic device.
The first preset time period may be 10s or 20s, which is not limited in this embodiment of the application. In addition, in this embodiment of the present application, N is greater than or equal to 2 and is an integer, and is used to represent the attribute category number of the first resource data or the second resource data, for example, when the value of N is 3, the first resource data is of 3 categories, and in this embodiment of the present application, for convenience of description, the first resource data is defined as a first-category first resource data, a second-category first resource data, and a third-category first resource data, respectively. The first resource data of one category is used for representing software users corresponding to the user identification, when application software corresponding to the software identification is used, occupied Central Processing Unit (CPU) resources, the first resource data of the second category is used for representing software users corresponding to the user identification, when application software corresponding to the software identification is used, occupied Graphics Processing Unit (GPU) resources, and the first resource data of the third category is used for representing software users corresponding to the user identification, and when application software corresponding to the software identification is used, occupied memory resources.
In addition, it can be understood that, in the embodiment of the present application, the run resource data may include, in addition to the three types described above, four types of first resource data used for characterizing a disk resource occupied by a software user corresponding to the user identifier when using application software corresponding to the software identifier.
Based on the above description, in the embodiment of the present application, step S200 may include step S210 and step S220.
Step S210, for each type of first resource data included in the N types of first resource data, a corresponding resource time sequence is created to obtain N columns of resource time sequences.
In the embodiment of the application, whether null data exists in the first resource data of the type N is judged for each type of first resource data included in the first resource data of the type N, and when the null data exists in the first resource data of the type N, filling data is obtained to fill the null data, where the filling data may be in all the first resource data of the type N except for the null dataAnd (4) the mean value of other first resource data besides the data. Assume that a first set of resource data of some type, x (t) ═ x1,x2,…,x′,…,xm) Wherein x isiRepresenting the first resource data collected when the software is in normal working state, x' representing the null data collected when the software is in abnormal working state, and filling data
It should be noted that, in this embodiment of the application, when there is null data in some type of first resource data, the type of first resource data whose acquisition time is before the null data and is adjacent to the null data may also be used as padding data, or the type of first resource data whose acquisition time is after the null data and is adjacent to the null data may also be used as padding data.
Step S220, analyzing the time series of the N rows of resources to obtain historical software usage information corresponding to the software usage request.
In the embodiment of the present application, step S220 may include step S221, step S222, step S223, and step S224.
Step S221, determining attribute properties of the resource time series for each resource time series included in the N resource time series.
In the embodiment of the present application, for each resource time sequence included in the N resource time sequences, firstly, the resource time sequence may be subjected to stationarity processing to ensure stationarity of the resource time sequence. In the process, a stability processing strategy specifically adopted can be that logarithmic transformation and differential operation are carried out on the resource time sequence, or the logarithmic transformation and the differential operation are combined for use, namely, the resource time sequence is converted from an exponential trend to a linear trend through the logarithmic transformation, and then the instability of the resource time sequence is eliminated through the differential operation. After a stationary resource time series is obtained, the autocorrelation function and the partial correlation function of the resource time series are analyzed.
Definition of AutoCorrelation Function (ACF):
definition of Partial Auto Correlation Function (PACF):
let us assume that the autocorrelation function sequence is ρ1,ρ2,Λ,ρq,Λ,ρkΛ, if present, when k is>After q, there is ρkIf 0 is always true, it is said that the resource time series has truncation, and ρ is a value of k regardless of how large k iskAnd a non-zero value is always obtained, but the attenuation is carried out according to a negative exponential function, so that the resource time sequence is called to have trailing property.
Step S222, selecting an original recognition model according to the attribute property of the resource time sequence, and estimating the model parameters of the original recognition model to obtain a standard recognition model.
In the embodiment of the application, if the ACF is trailing and the PACF is p-order truncation, an ar (p) model is selected as an original identification model, if the ACF is q-order truncation and the PACF is trailing, an ma (q) model is selected as an original identification model, and if both the ACF and the PACF are trailing, an ARMA (p, q) model is selected as an original identification model.
The MA (q) model is: x is the number oft=εt-θ1εt-1-θ2εt-2-…-θqεt-qWherein, epsilontIs zero mean and variance ofThe stationary white noise.
After the original identification model is selected, the parameters of the estimated original identification model can be identified through Akaike Information Criterion (AIC). The AIC criteria are defined as:
AIC=2k-2ln(L)
wherein k is the number of model parameters, and L is the maximum likelihood under the model. It should be noted that, in the embodiment of the present application, when the original recognition model is an ARMA model, since the value of the ARMA model is usually small, the values of p and q may be gradually selected from low to high, and the values of p and q may be taken as the order of the original recognition when the AIC value reaches a minimum value.
After the above steps, the model parameters of the original recognition model can be estimated by the following estimation strategy to obtain the standard recognition model.
The residual terms are: epsilont=xt-F (β), the sum of the squared residuals being:
in the embodiment of the present application, when the sum of squared residuals reaches a minimum, the corresponding parameter value is the least square estimation value of β.
Step S223, analyzing the resource time sequence through the standard identification model, and obtaining the sub-history use information corresponding to the resource time sequence.
After obtaining the standard identification model, the resource time series may be input into the standard identification model to obtain sub-history usage information corresponding to the resource time series.
Step S224, using the N pieces of sub-history use information corresponding to the N-column resource time series as the software history use information corresponding to the software use request.
Taking the value of N as 3, that is, the first resource data is of 3 types, and the 3 types of first resource data include one type of first resource data, two types of first resource data, and three types of first resource data as an example, the obtained software historical use information can be represented as a vectorWherein,used for representing software users corresponding to the user identification, and when using the application software corresponding to the software identification, the CPU resource required to be occupied,used for representing software users corresponding to the user identification, and when the application software corresponding to the software identification is used, the GPU resources required to be occupied,for characterizing software users corresponding to user identifications, using the softwareAnd when the corresponding application software is identified, the memory resource which needs to be occupied is identified.
Step S300, acquiring real-time state information of each node server in the server cluster.
Based on step S300, the load balancing method provided in this embodiment of the present application may further include step S002, for each node server included in the server cluster, acquiring remaining resource data of the node server every second preset duration, where the remaining resource data includes N types of second resource data, and the acquired remaining resource data may be stored in a memory included in the electronic device.
The second preset time period may be 5s, 10s, or 20s, which is not specifically limited in the embodiment of the present application. It should be noted that, in this embodiment of the application, the category of the N-type second resource data is the same as the category of the N-type first resource data, that is, when the first resource data is of 3 types and includes one type of first resource data, two types of first resource data, and three types of first resource data, the second resource data is also of 3 types and includes one type of second resource data, two types of second resource data, and three types of second resource data, where the one type of second resource data is used to represent the remaining CPU resources of the node server, the two types of second resource data is used to represent the remaining GPU resources of the node server, and the three types of second resource data is used to represent the remaining memory resources of the node server. When the first resource data is of 4 types, that is, the first resource data includes four types of first resource data in addition to the three types, the second resource data is also of four types, and the second resource data also includes four types of second resource data, which are used for representing the remaining disk resources of the node server.
In addition, it can be understood that, in the embodiment of the present application, the remaining CPU resources and the remaining GPU resources of the node server may be collected by a monitoring tool.
In addition, because different server nodes have different processing performances, it is difficult to directly compare occupation conditions of CPU resources and GPU resources when different server nodes run the same software, and therefore, in the embodiment of the present application, normalization processing may be performed on the first-type second resource data and the second-type second resource data, respectively, with the following processing logic.
Wherein, Pi' remaining resource data for characterizing a server node, PminMinimum remaining resources, P, for characterizing a server nodemaxFor characterizing the maximum remaining resources of the server node.
Based on the above description, in the embodiment of the present application, step S300 may include step S310 and step S320.
Step S310, for each node server included in the server cluster, obtaining a preset number of pieces of remaining resource data after the collection time from all the remaining resource data of the node server, as target resource data.
In the embodiment of the application, after all the remaining resource data of each node server included in the server cluster are determined, a preset number of remaining resource data are acquired from back to front according to the sequence of the acquisition time as target resource data. The first preset number of strips may be 100 strips or 200 strips, which is not particularly limited in the embodiment of the present application.
In addition, in order to save the memory space of the electronic device, in this embodiment of the application, in step S002, for each node server included in the server cluster, the remaining resource data of the node server is collected every second preset duration, where the remaining resource data includes N types of second resource data, and the collected remaining resource data is stored in the memory included in the electronic device, the remaining resource data stored in the memory may be updated immediately, that is, a preset number of remaining resource data after the collection time is reserved, and other running resource data is deleted.
Step S320, obtaining an average value of each type of second resource data in the preset number of item resource data, and using the average value as the real-time status information of the node server.
In the embodiment of the application, the average value of each type of second resource data in the preset number of item resource data can be obtained through the following operation logic.
In this embodiment, the real-time status information of each node server may also be represented by a vector, for example, when the second resource data is of type 3, the real-time status information may be represented by a vector Ni ═ p (p)i1,p12,p13) Is represented by the formula, wherein pi1For characterizing the remaining CPU resources of the node servers, pi2Remaining GPU resources, p, for characterizing node serversi3And the method is used for representing the residual memory resources of the node server.
Based on this, in the server cluster, the real-time status information of each node server can be represented as:
the matrix N can be explained by table 1 as follows:
table 1
Based on the above description, in this embodiment of the application, when the value of l is 3 and N node servers are included in the server cluster, the real-time status information of the first node server is represented as N1 ═ (p)11,p12,p13) The real-time status information of the second node server is represented as N2 ═ p (p)21,p22,p23) The real-time status information of the nth node server is represented as Nn ═ pn1,pn2,pn3)。
And S400, determining a target node from the server cluster according to the historical use information of the software and the real-time state information of each node server in the server cluster, so that the terminal equipment can be connected with the target node.
In the embodiment of the present application, step S400 may include step S410 and step S420.
And step S410, selecting an available node set from the server cluster according to the historical use information of the software and the real-time state information of each node server in the server cluster.
For each node server included in the server cluster, whether the node server is an available server is determined by the following operation logic.
Ri=P-Nij=(aij-pij)1×l
Obtaining RiIf the negative value does not exist, the node server is taken as an available server, and the vector N corresponding to the available server is usediAs a load vector. Thereafter, all available servers are grouped into a set of available nodes.
Step S420, selecting an optimal node from the available node set as a target node.
In the embodiment of the present application, the vector P (u _ id, s _ id) and each load vector N can be determined by cosine similarityiThe smaller the cosine similarity between the node servers is, the more suitable the corresponding node server is for running the application software corresponding to the software use request. In the embodiment of the present application, in order to ensure load balance of each server node, the node server with the stronger acquisition processing capability may also be used as the node server most suitable for running the application software corresponding to the software use request, so that the node server most suitable for running the application software corresponding to the software use request may be obtained through the following operation logic.
Wherein I is 1,2, …, r, I obtainedbestThe node server number is the node server number which is most suitable for the application software corresponding to the running software using request.
Based on the same inventive concept as the load balancing method described above, the embodiment of the present application further provides a load balancing apparatus 400, which includes a request receiving module 410, a first information obtaining module 420, a second information obtaining module 430, and a node determining module 440.
A request receiving module 410, configured to receive a software usage request sent by a terminal device.
For the description of the request receiving module 410, reference may be made to the above-mentioned load balancing method embodiment, and the detailed description of step S100 is described, that is, step S100 may be executed by the request receiving module 410.
The first information obtaining module 420 is configured to obtain historical software use information corresponding to the software use request.
For the description of the first information obtaining module 420, reference may be made to the above-mentioned load balancing method embodiment, and the detailed description of step S200 is described, that is, step S200 may be executed by the first information obtaining module 420.
The second information obtaining module 430 is configured to obtain real-time status information of each node server in the server cluster.
For the description of the second information obtaining module 430, reference may be made to the above-mentioned load balancing method embodiment, and the detailed description of step S300 is described, that is, step S300 may be executed by the second information obtaining module 430.
And a node determining module 440, configured to determine a target node from the server cluster according to the historical software usage information and the real-time status information of each node server in the server cluster, so that the terminal device establishes a connection with the target node.
For the description of the node determining module 440, reference may be made to the above-mentioned load balancing method embodiment, and the detailed description of step S400 is described, that is, step S400 may be executed by the node determining module 440.
The load balancing apparatus 400 provided in the embodiment of the present application may further include a first data obtaining module.
The first data acquisition module is used for acquiring running resource data occupied by a software user corresponding to the user identifier when the software user uses application software corresponding to the software identifier every interval with a first preset duration, wherein the running resource data comprises N types of first resource data.
For the description of the first data obtaining module, reference may be made to the above-mentioned load balancing method embodiment, and the detailed description of step S001 is described, that is, step S001 may be performed by the first data obtaining module.
In this embodiment, the first information obtaining module 420 may include a sequence obtaining unit and an analyzing unit.
And the sequence acquisition unit is used for creating a corresponding resource time sequence aiming at each type of first resource data included in the N types of first resource data so as to obtain N columns of resource time sequences.
The description of the sequence obtaining unit may refer to the above-mentioned load balancing method embodiment, and the detailed description of step S210, that is, step S210 may be executed by the sequence obtaining unit.
And the analysis unit is used for analyzing the N-column resource time sequences to obtain the historical software use information corresponding to the software use request.
The description of the analysis unit may refer to the above-mentioned load balancing method embodiment, and the detailed description of step S220, that is, step S220 may be executed by the analysis unit.
In the embodiment of the present application, the analysis unit may include an attribute obtaining subunit, a model obtaining unit, an analysis subunit, and an information obtaining subunit.
And the attribute acquisition subunit is used for judging the attribute property of the resource time sequence aiming at each row of resource time sequences included in the N rows of resource time sequences.
For the description of the attribute obtaining subunit, reference may be made to the above-mentioned load balancing method embodiment, and the detailed description of step S221 is described, that is, step S221 may be performed by the attribute obtaining subunit.
And the model acquisition unit is used for selecting the original recognition model according to the attribute property of the resource time sequence and estimating the model parameters of the original recognition model to obtain the standard recognition model.
The description of the model obtaining unit may refer to the above-mentioned load balancing method embodiment, and the detailed description of step S222, that is, step S222 may be executed by the model obtaining unit.
And the analysis subunit is used for analyzing the resource time sequence through the standard identification model to obtain the sub-history use information corresponding to the resource time sequence.
The description of the analysis subunit may refer to the above-mentioned load balancing method embodiment, and the detailed description of step S223, that is, step S223 may be executed by the analysis subunit.
And the information acquisition subunit is used for taking the N pieces of sub-history use information corresponding to the N columns of resource time sequences as the software history use information corresponding to the software use request.
The description of the information obtaining subunit may refer to the above-mentioned load balancing method embodiment, and the detailed description of step S224, that is, step S224 may be performed by the information obtaining subunit.
The load balancing apparatus 400 provided in this embodiment of the application may further include a second data obtaining module.
And the second data acquisition module is used for acquiring the residual resource data of the node servers at intervals of second preset duration for each node server included in the server cluster, wherein the residual resource data comprises N types of second resource data.
The description of the second data acquiring module may refer to the above-mentioned load balancing method embodiment, and the detailed description of step S002, that is, step S002 may be executed by the second data acquiring module.
In this embodiment, the second information obtaining module 430 may include a resource data obtaining unit and a status information obtaining unit.
And the resource data acquisition unit is used for acquiring a preset number of pieces of residual resource data after the acquisition time from all the residual resource data of the node servers as target resource data for each node server included in the server cluster.
For the description of the resource data obtaining unit, reference may be made to the above-mentioned load balancing method embodiment, and the detailed description of step S310, that is, step S310 may be performed by the resource data obtaining unit.
And the state information acquisition unit is used for acquiring the average value of each type of second resource data in the preset number of item resource data, and the average values are jointly used as the real-time state information of the node server.
The description of the status information obtaining unit may refer to the above-mentioned load balancing method embodiment, and the detailed description of step S320, that is, step S320 may be performed by the status information obtaining unit.
In this embodiment, the node determining module 440 may include a set determining unit and a node determining unit.
And the set determining unit is used for selecting an available node set from the server cluster according to the historical software use information and the real-time state information of each node server in the server cluster.
The description of the set determining unit may refer to the above-mentioned load balancing method embodiment, and the detailed description of step S410, that is, step S410 may be performed by the set determining unit.
And the node determining unit is used for selecting the optimal node from the available node set as the target node.
For the description of the node determining unit, reference may be made to the above-mentioned load balancing method embodiment, and the detailed description of step S420, that is, step S420 may be performed by the node determining unit.
The application embodiment also provides a computer readable storage medium, on which a computer program is stored, and when the computer program is executed, the load balancing method can be implemented.
To sum up, the load balancing method, apparatus and electronic device provided in the embodiments of the present application include: the method comprises the steps of receiving a software use request sent by a terminal device, then obtaining software historical use information corresponding to the software use request, obtaining real-time state information of each node server in a server cluster, and determining a target node from the server cluster according to the software historical use information and the real-time state information of each node server in the server cluster so as to establish connection between the terminal device and the target node. Therefore, in the load balancing process, the real-time state information of each node server is considered, and the historical software use information corresponding to the software use request is combined, so that the reasonability of server cluster resource distribution can be improved.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, the functional modules in each embodiment of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method described in each embodiment of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a U disk, a removable hard disk, a RAM, a ROM, a magnetic disk, or an optical disk.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
It is noted that, herein, relational terms such as "first," "second," and "third," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus.
Claims (10)
1. A method of load balancing, comprising:
receiving a software use request sent by terminal equipment;
acquiring historical software use information corresponding to the software use request;
acquiring real-time state information of each node server in a server cluster;
and determining a target node from the server cluster according to the historical software use information and the real-time state information of each node server in the server cluster, so that the terminal equipment can be connected with the target node.
2. The load balancing method according to claim 1, wherein the software usage request includes a user identifier and a software identifier, the load balancing method further comprising:
and acquiring running resource data occupied by a software user corresponding to the user identifier when the software user uses the application software corresponding to the software identifier every a first preset time interval, wherein the running resource data comprises N types of first resource data.
3. The load balancing method according to claim 2, wherein the obtaining of the historical software usage information corresponding to the software usage request includes:
aiming at each type of the first resource data included in the N types of first resource data, creating a corresponding resource time sequence to obtain N columns of resource time sequences;
and analyzing the N rows of resource time sequences to obtain the historical software use information corresponding to the software use request.
4. The load balancing method according to claim 3, wherein the analyzing the N columns of resource time series to obtain historical software usage information corresponding to the software usage request includes:
judging the attribute property of the resource time sequence aiming at each row of resource time sequences included in the N rows of resource time sequences;
selecting an original recognition model according to the attribute properties of the resource time sequence, and estimating model parameters of the original recognition model to obtain a standard recognition model;
analyzing the resource time sequence through the standard identification model to obtain sub-history use information corresponding to the resource time sequence;
and taking the N pieces of sub-history use information corresponding to the N columns of resource time sequences as the software history use information corresponding to the software use request.
5. The load balancing method according to claim 1, further comprising:
and aiming at each node server included in the server cluster, acquiring residual resource data of the node server at intervals of second preset duration, wherein the residual resource data comprise N types of second resource data.
6. The load balancing method according to claim 5, wherein the obtaining the real-time status information of each node server in the server cluster comprises:
aiming at each node server included in the server cluster, acquiring a preset number of pieces of residual resource data after the acquisition time from all the residual resource data of the node server to serve as target resource data;
and obtaining the average value of each type of second resource data in a preset number of pieces of target resource data, and using the average value as the real-time state information of the node server.
7. The load balancing method according to claim 1, wherein the determining a target node from the server cluster according to the historical software usage information and the real-time status information of each node server in the server cluster comprises:
selecting an available node set from the server cluster according to the historical software use information and the real-time state information of each node server in the server cluster;
and selecting an optimal node from the available node set as the target node.
8. A load balancing apparatus, comprising:
the request receiving module is used for receiving a software use request sent by the terminal equipment;
the first information acquisition module is used for acquiring historical software use information corresponding to the software use request;
the second information acquisition module is used for acquiring real-time state information of each node server in the server cluster;
and the node determining module is used for determining a target node from the server cluster according to the historical software use information and the real-time state information of each node server in the server cluster so as to establish connection between the terminal equipment and the target node.
9. An electronic device comprising a processor and a memory, wherein the memory stores a computer program thereon, and the processor is configured to execute the computer program to implement the load balancing method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed, implements the load balancing method of any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010016641.1A CN111274026A (en) | 2020-01-08 | 2020-01-08 | Load balancing method and device and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010016641.1A CN111274026A (en) | 2020-01-08 | 2020-01-08 | Load balancing method and device and electronic equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111274026A true CN111274026A (en) | 2020-06-12 |
Family
ID=71001595
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010016641.1A Pending CN111274026A (en) | 2020-01-08 | 2020-01-08 | Load balancing method and device and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111274026A (en) |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113052691A (en) * | 2021-04-30 | 2021-06-29 | 中国工商银行股份有限公司 | Distributed account checking system service balancing method, node and cluster |
CN114003378A (en) * | 2021-10-26 | 2022-02-01 | 深圳证券信息有限公司 | Container cluster load balancing method, device, equipment and storage medium |
CN114416376A (en) * | 2022-01-27 | 2022-04-29 | 济南点量软件有限公司 | Load balancing method and system for multiple display cards among different applications |
CN114979154A (en) * | 2022-06-06 | 2022-08-30 | 北京月新时代科技股份有限公司 | Load balancing method and system |
CN114978951A (en) * | 2022-06-07 | 2022-08-30 | 武汉大学 | Cloud platform load balancing method |
CN115474215A (en) * | 2022-09-06 | 2022-12-13 | 广东九博科技股份有限公司 | Router-based networking method and system |
CN116860464A (en) * | 2023-09-05 | 2023-10-10 | 苏州浪潮智能科技有限公司 | Load resource allocation method and device, storage medium and electronic device |
CN117519948A (en) * | 2023-12-11 | 2024-02-06 | 广东筠诚建筑科技有限公司 | Method and system for realizing computing resource adjustment under building construction based on cloud platform |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090157678A1 (en) * | 2007-12-18 | 2009-06-18 | Mladen Turk | Content Based Load Balancer |
CN105338082A (en) * | 2015-10-30 | 2016-02-17 | 浪潮(北京)电子信息产业有限公司 | Load balancing method and load balancing device based on application proxy server |
CN106681803A (en) * | 2016-08-04 | 2017-05-17 | 腾讯科技(深圳)有限公司 | Task scheduling method and server |
CN110515734A (en) * | 2019-08-27 | 2019-11-29 | 第四范式(北京)技术有限公司 | The load processing method and device of data processing task |
-
2020
- 2020-01-08 CN CN202010016641.1A patent/CN111274026A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090157678A1 (en) * | 2007-12-18 | 2009-06-18 | Mladen Turk | Content Based Load Balancer |
CN105338082A (en) * | 2015-10-30 | 2016-02-17 | 浪潮(北京)电子信息产业有限公司 | Load balancing method and load balancing device based on application proxy server |
CN106681803A (en) * | 2016-08-04 | 2017-05-17 | 腾讯科技(深圳)有限公司 | Task scheduling method and server |
CN110515734A (en) * | 2019-08-27 | 2019-11-29 | 第四范式(北京)技术有限公司 | The load processing method and device of data processing task |
Cited By (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113052691A (en) * | 2021-04-30 | 2021-06-29 | 中国工商银行股份有限公司 | Distributed account checking system service balancing method, node and cluster |
CN114003378A (en) * | 2021-10-26 | 2022-02-01 | 深圳证券信息有限公司 | Container cluster load balancing method, device, equipment and storage medium |
CN114416376A (en) * | 2022-01-27 | 2022-04-29 | 济南点量软件有限公司 | Load balancing method and system for multiple display cards among different applications |
CN114979154A (en) * | 2022-06-06 | 2022-08-30 | 北京月新时代科技股份有限公司 | Load balancing method and system |
CN114979154B (en) * | 2022-06-06 | 2023-10-03 | 北京月新时代科技股份有限公司 | Load balancing method and system |
CN114978951B (en) * | 2022-06-07 | 2023-08-18 | 武汉大学 | Cloud platform load balancing method |
CN114978951A (en) * | 2022-06-07 | 2022-08-30 | 武汉大学 | Cloud platform load balancing method |
CN115474215B (en) * | 2022-09-06 | 2023-03-21 | 广东九博科技股份有限公司 | Router-based networking method and system |
CN115474215A (en) * | 2022-09-06 | 2022-12-13 | 广东九博科技股份有限公司 | Router-based networking method and system |
CN116860464A (en) * | 2023-09-05 | 2023-10-10 | 苏州浪潮智能科技有限公司 | Load resource allocation method and device, storage medium and electronic device |
CN116860464B (en) * | 2023-09-05 | 2024-01-09 | 苏州浪潮智能科技有限公司 | Load resource allocation method and device, storage medium and electronic device |
CN117519948A (en) * | 2023-12-11 | 2024-02-06 | 广东筠诚建筑科技有限公司 | Method and system for realizing computing resource adjustment under building construction based on cloud platform |
CN117519948B (en) * | 2023-12-11 | 2024-04-26 | 广东筠诚建筑科技有限公司 | Method and system for realizing computing resource adjustment under building construction based on cloud platform |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111274026A (en) | Load balancing method and device and electronic equipment | |
CN108279974B (en) | Cloud resource allocation method and device | |
WO2006112988A2 (en) | Prescriptive architecture recommendations | |
EP3217296A1 (en) | Data query method and apparatus | |
CN105871983A (en) | Method and device for selecting servers | |
CN115220916A (en) | Automatic computing power scheduling method, device and system for video intelligent analysis platform | |
CN107608781A (en) | A kind of load predicting method, device and network element | |
CN111491027A (en) | Load balancing method, load balancing device and readable storage medium | |
CN115525394A (en) | Method and device for adjusting number of containers | |
CN111159131A (en) | Performance optimization method, device, equipment and computer readable storage medium | |
CN114492742A (en) | Neural network structure searching method, model issuing method, electronic device, and storage medium | |
CN110995856B (en) | Method, device and equipment for server expansion and storage medium | |
CN110580265B (en) | ETL task processing method, device, equipment and storage medium | |
CN113626282B (en) | Cloud computing physical node load monitoring method, device, terminal and storage medium | |
CN107908555B (en) | SQL script abnormity detection method and terminal thereof | |
CN116303418A (en) | Mass rule processing method, system and storage medium based on Internet of things platform | |
CN110781410A (en) | Community detection method and device | |
CN116776030A (en) | Gray release method, device, computer equipment and storage medium | |
CN112463378B (en) | Server asset scanning method, system, electronic equipment and storage medium | |
CN112257977B (en) | Logistics project construction period optimization method and system with resource limitation under fuzzy man-hour | |
CN115883391A (en) | Single-user service selection method and device | |
CN112379978A (en) | Back-end service calling method, device, equipment and storage medium | |
CN114491416A (en) | Characteristic information processing method and device, electronic equipment and storage medium | |
CN114201306A (en) | Multi-dimensional geographic space entity distribution method and system based on load balancing technology | |
CN113364648A (en) | Flow control method, system, device, service equipment and storage medium |
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 |