Application server load prediction method and device, electronic equipment and storage medium
By building an application server load prediction model, using multi-dimensional load characteristics for real-time monitoring and prediction, and calling resource allocation strategies based on the prediction results, the problems of application server load prediction and resource management are solved, and accurate prediction and effective management of load are achieved.
Patent Information
- Application Number
- CN202411759536.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2044-12-03
AI Technical Summary
How to effectively predict the load status of the application server and manage resources based on the predicted results to avoid response delays, performance degradation or service interruptions caused by overload.
By obtaining multi-dimensional load characteristics of the application server, such as average latency, number of active connections and active behavior, a load prediction model is built to monitor and predict load status in real time. When an overload is predicted, an allocation request is generated and policies in the resource allocation policy library are called, such as vertical scaling, horizontal scaling, load balancing, etc., to balance the load.
Accurate prediction and real-time management of application server loads is realized, performance degradation and service interruption caused by overload is avoided, user experience is improved, and resource utilization efficiency is improved.
Smart Images

Figure CN119718635A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of application servers, and specifically to a method, device, electronic device and storage medium for predicting application server load. Background Art
[0002] With the development of modern Internet services, the number of online users has grown rapidly, and the load management of application servers has become a key issue. In various online services, such as Web applications, enterprise systems, and cloud computing platforms, tens of thousands of users are online at the same time, and frequent interactive operations (such as read and write operations, interactive requests, and search requests) have brought a huge burden to the application server. The load status of the application server directly affects the user experience. Overload will lead to increased response delays, performance degradation, and even service interruptions. Therefore, how to effectively predict the load of the application server and manage resources based on the prediction results has become a problem that needs to be solved by various service providers. Summary of the invention
[0003] This embodiment provides an application server load prediction method, device, electronic device and storage medium to explore how to solve the problem of load prediction for an application server and perform resource management based on the prediction results.
[0004] In a first aspect, the present invention provides an application server load prediction method, comprising:
[0005] A first load vector of the application server is obtained. The characteristics of the first load vector include: average delay, number of active connections, and activity behavior. The expression of the first load vector is:
[0006] X1=(Tr,C,B i )
[0007] Among them, X1 is the first load vector, Tr is the average delay, which represents the average round-trip time between the user and the application server; C is the number of active connections, which represents the number of users who maintain active connections in the application server; B i is the activity behavior, representing the number of active connections of the i-th activity behavior in which the user participates;
[0008] performing data preprocessing according to the data structure of the first load vector;
[0009] Determining a second load vector from the preprocessed first load vector;
[0010] receiving the second load vector as an input feature of the classification model, and outputting an L2 norm prediction value as a future load prediction label to iteratively train the load prediction model;
[0011] The trained load prediction model is deployed in the application server, and after receiving the second load vector, the future load prediction label is output; if the future load prediction label is overloaded, an allocation request is generated; the allocation request is sent to a preset application server resource allocation policy library, and the application server resource classification policy is called to balance the future load.
[0012] In some embodiments, obtaining a first load vector of an application server includes:
[0013] The application server receives the heartbeat packets sent periodically by the client, records the round-trip time of the heartbeat packets, and after recording the rated number of times, calculates the average delay of the rated number of round-trip times; the calculation formula is:
[0014]
[0015] Among them, n is the number of recorded heartbeat packet round trip times, RTT i is the round trip time of the i-th heartbeat packet;
[0016] Also includes:
[0017] Obtain the user login time and the user logout time recorded in the service log of the application server, and determine the active duration according to the difference between the user logout time and the user login time; determine the active duration that exceeds the active duration threshold as an active connection, and determine the number of all active connections as the number of active connections;
[0018] Also includes:
[0019] Obtain user activities recorded in service logs in an application server, and the number of active connections corresponding to the user activities; wherein the user activities include: read and write operations, interactions, search requests, message sending / receiving, and others; construct the activity behavior based on the user activities and the number of active connections corresponding to the user activities.
[0020] In some of the embodiments, data preprocessing is performed according to the data structure of the first load vector, including:
[0021] Load the average latency, number of active connections, and activity behavior;
[0022] Identify average latency and number of active connections as numerical data, and activity behavior as structural data;
[0023] The average delay and the number of active connections are normalized to obtain the normalized average delay Tr' and the normalized number of active connections C';
[0024] For the number of active connections exceeding the threshold T c Select the activity behavior of B and keep the activity behavior B with high active connections i', B i '=[C′ F ,C′ T ,C′ E ,C′ S ,C′ O ]; where the active connection number threshold T c is the default value.
[0025] In some embodiments, determining the second load vector from the preprocessed first load vector comprises:
[0026] constructing the second load vector using the normalized average delay, the normalized number of active connections, and the selected normalized activity behavior as features;
[0027] Calculating an L2 norm of the normalized average delay, the normalized number of active connections, and the selected normalized activity behavior, and using the L2 norm as a historical load label of a second load vector;
[0028] Wherein, the expression of the L2 norm is:
[0029]
[0030] in, represents the L2 norm of the second load vector, represents the normalized average delay, Indicates the normalized number of active connections. Represents normalized activity behavior.
[0031] In some embodiments, receiving the second load vector as a feature variable of a classification model, outputting an L2 norm prediction value as a future load prediction label, and iteratively training the load prediction model includes:
[0032] selecting the classification model;
[0033] Initializing the weight matrix and bias matrix of the classification model;
[0034] The cross entropy loss between the historical load label and the future load prediction label in the classification model is defined as:
[0035]
[0036] Where N represents the number of samples in the second load vector, J represents the number of label categories, and y ij represents the actual probability that the i-th sample belongs to the j-th category, represents the predicted probability that the i-th sample belongs to the j-th category, and L is the average loss of all second load vector samples;
[0037] receiving the second load vector as a feature variable and outputting a future load prediction label;
[0038] Calculate the cross entropy loss of the future load prediction label and the historical load label using the cross entropy loss function;
[0039] Using a gradient descent algorithm to update the weight matrix and bias matrix of the classification model to minimize the cross entropy loss;
[0040] If the cross entropy loss is minimized, a classification model with the current weight matrix and bias matrix is derived as the load prediction model.
[0041] In some embodiments, the trained load prediction model is deployed in the application server, and after receiving the second load vector, the future load prediction label is output; if the future load prediction label is overload, an allocation request is generated; the allocation request is sent to a preset application server resource allocation policy library, and the application server resource classification policy is called to balance the future load, including:
[0042] Periodically obtaining a second load vector from the application server;
[0043] inputting the second load vector into the load prediction model, and outputting a future load prediction label for the application server in a future time period;
[0044] Convert the future load prediction label into a light overload, a moderate overload, a severe overload and a normal overload state according to a preset mapping; wherein the preset mapping is a correspondence between the future load prediction label and the load state output by the model;
[0045] Generate an allocation request according to the overload state, wherein the allocation request includes the overload state and its corresponding resource allocation strategy;
[0046] The allocation request is sent to the application server resource allocation policy library, and different resource allocation policies or policy combinations are called according to the allocation request to balance the future load.
[0047] Compared with the prior art, the application server load prediction method of the present invention can monitor and predict the load status of the application server in real time by acquiring multi-dimensional load characteristics of the application server such as average delay, number of active connections, and activity behavior, and constructing a corresponding load prediction model.
[0048] In a second aspect, the present invention provides an application server load prediction device, comprising:
[0049] The first load vector acquisition module is used to acquire a first load vector of the application server. The characteristics of the first load vector include: average delay, number of active connections and activity behavior. The expression of the first load vector is:
[0050] X1=(Tr,C,B i )
[0051] Among them, X1 is the first load vector, Tr is the average delay, which represents the average round-trip time between the user and the application server; C is the number of active connections, which represents the number of users who maintain active connections in the application server; B i is the activity behavior, representing the number of active connections of the i-th activity behavior in which the user participates;
[0052] A preprocessing module, used for performing data preprocessing according to the data structure of the first load vector;
[0053] A second load vector acquisition module, used to determine a second load vector from the preprocessed first load vector;
[0054] A training module, configured to receive the second load vector as an input feature of the classification model, and output an L2 norm prediction value as a future load prediction label, so as to iteratively train the load prediction model;
[0055] The prediction balancing module is used to deploy the trained load prediction model to the application server, and after receiving the second load vector, output the future load prediction label; if the future load prediction label is overloaded, generate an allocation request; send the allocation request to a preset application server resource allocation policy library, and call the application server resource classification policy to balance the future load.
[0056] In a third aspect, the present invention provides an electronic device, comprising a memory and a processor, wherein the memory stores at least one computer executable instruction, and the processor is configured to run the computer executable instruction, and when the computer executable instruction is executed by the processor, the application server load prediction method described in the aspect is implemented.
[0057] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method for predicting the application server load described in the fourth aspect.
[0058] Compared with the prior art, the beneficial effects of the application server load prediction device, electronic device and storage medium of the present invention are the same as the beneficial effects of the above-mentioned application server load prediction method, so they are not repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Figure 1 A schematic diagram of the steps of the application server load prediction method in the embodiment provided by the present invention;
[0060] Figure 2A structural block diagram of an application server load prediction device in an embodiment provided by the present invention;
[0061] Figure 3 A diagram of an electronic device in an embodiment of the present invention; DETAILED DESCRIPTION
[0062] In order to more clearly understand the purpose, technical solutions and advantages of the present application, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments.
[0063] Unless otherwise defined, the technical terms or scientific terms involved in this application shall have the general meaning understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the", "these" and the like in this application do not represent quantitative restrictions, and they can be singular or plural. The terms "include", "comprise", "have" and any variants thereof involved in this application are intended to cover non-exclusive inclusions; for example, a process, method and system, product or device comprising a series of steps or modules (units) is not limited to the listed steps or modules (units), but may include unlisted steps or modules (units), or may include other steps or modules (units) inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether directly or indirectly. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: A exists alone, A and B exist at the same time, and B exists alone. Usually, the character " / " indicates that the objects associated with each other are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.
[0064] refer to Figures 1 to 3 In an embodiment of the present invention, a method for predicting application server load is provided. Figure 1 : is a flow chart of the application server load prediction method of the present invention, the process includes:
[0065] Step S1: Obtain a first load vector of the application server. The characteristics of the first load vector include: average delay, number of active connections, and activity behavior. The expression of the first load vector is:
[0066] X1=(Tr,C,B i )
[0067] Among them, X1 is the first load vector, Tr is the average delay, which represents the average round-trip time between the user and the application server; C is the number of active connections, which represents the number of users who maintain active connections in the application server; B i is the activity behavior, which represents the number of active connections of the i-th activity behavior in which the user participates.
[0068] Step S1 also includes:
[0069] S1-1, the application server receives the heartbeat packet sent regularly by the client, records the round-trip time of the heartbeat packet, and after recording the rated number of times, calculates the average delay of the rated number of round-trip times; the calculation formula is:
[0070]
[0071] Among them, n is the number of recorded heartbeat packet round trip times, RTT i is the round trip time of the i-th heartbeat packet.
[0072] Also includes:
[0073] S1-2, obtaining the user login time and the user logout time recorded in the service log of the application server, and determining the active duration according to the difference between the user logout time and the user login time; determining the active duration exceeding the active duration threshold as an active connection, and determining the number of all active connections as the number of active connections;
[0074] Furthermore, for each user i, the calculation formula for active time is:
[0075] T online,i =T logout,i -T login,i
[0076] Among them, T online,i is the online time of user i, T logout,i is the login time of user i, T login,i is the logout time of user i;
[0077] As for how to determine the active connection, a time threshold T needs to be set. threshold Determine whether the user is active. If the online time of user i exceeds the time threshold, it is considered an active connection. Therefore, the judgment process can be expressed by an exponential function I:
[0078]
[0079] This means that if user i’s online time is T online,i Exceeds the set time threshold T threshold , then it returns 1, otherwise it returns 0.
[0080] Therefore, the number of active connections C a The calculation formula can be defined as:
[0081] Where K is the total number of users.
[0082] Also includes:
[0083] S1-3, obtain the user activities recorded in the service log of the application server, and the number of active connections corresponding to the user activities; wherein the user activities include: read and write operations, interactions, search requests, message sending / receiving and others; construct the activity behavior based on the user activities and the number of active connections corresponding to the user activities.
[0084] Specifically, for each user activity b, the number of active connections C participating in the user activity b can be counted. b If there are M different activity behaviors, then activity behavior B i The type set is:
[0085] B i =[C F , C T , C E , C S , C O ]
[0086] Among them, C F is the number of active connections for read and write operations, C T is the number of active connections for interactive behavior, C E is the number of active connections for search request behavior, C S is the number of active connections in the message sending / receiving phase, C O is the number of active connections for other behaviors.
[0087] Therefore, the number of active connections participating in user activity b is C b The formula can be defined as:
[0088]
[0089] Among them, C b is the number of active connections of user activity b, Nb is the total number of users participating in user activity b, player i is the i-th user, A represents the total number of active connections, Bb represents the set of users participating in user activity b, is an indicator function that indicates if player i In A and B bIf the number of active connections is in the intersection of , 1 is returned, otherwise 0 is returned. That is, for each user activity b, the sum of the number of users who participate in user activity b and are active connections is calculated, which is equivalent to calculating the number of elements in the intersection of the total number of active connections and the number of elements participating in user activity b.
[0090] The process also includes:
[0091] Step S2: performing data preprocessing according to the data structure of the first load vector.
[0092] Step S2 specifically includes:
[0093] Load average latency, number of active connections, and activity behavior;
[0094] Identify average latency and number of active connections as numerical data, and activity behavior as structural data;
[0095] The average delay and the number of active connections are normalized to obtain the normalized average delay and the normalized number of active connections;
[0096] For the number of active connections exceeding the threshold T c Select the activity behavior of B and keep the activity behavior B with high active connections i ', B i '=[C′ F , C′ T , C′ E , C′ S , C′ O ]; where the active connection number threshold T c is the default value.
[0097] The process also includes:
[0098] Step S3, determining a second load vector based on the preprocessed first load vector;
[0099] Step S3 specifically includes:
[0100] constructing a second load vector using the normalized average delay, the normalized number of active connections, and the selected normalized activity behavior as features;
[0101] Calculate the L2 norm of the normalized average delay, the normalized number of active connections, and the selected normalized activity behavior, and use the L2 norm as a historical load label of the second load vector;
[0102] Among them, the expression of L2 norm is:
[0103]
[0104] in, represents the L2 norm of the second load vector, represents the normalized average delay, Indicates the normalized number of active connections. Represents normalized activity behavior;
[0105] The process also includes:
[0106] Step S4, receiving the second load vector as an input feature of the classification model, and outputting the L2 norm prediction value as a future load prediction label to iteratively train the load prediction model.
[0107] Step S4 specifically includes:
[0108] S4-1, select a classification model; the classification model can be a logistic regression classification model.
[0109] S4-2, initialize the weight matrix and bias matrix of the classification model; the initialization parameters are to provide a starting point for the model, so that these parameters can be gradually adjusted through gradient descent or other optimization algorithms during training, so that the cross entropy loss function of the model gradually decreases and finally the optimal solution is found.
[0110] S4-3, define the cross entropy loss of historical load labels and future load prediction labels in the classification model. The cross entropy loss function is:
[0111]
[0112] Where N represents the number of samples in the second load vector, J represents the number of label categories, and y ij represents the actual probability that the i-th sample belongs to the j-th category, represents the predicted probability that the i-th sample belongs to the j-th category, and L is the average loss of all second load vector samples.
[0113] S4-4, receiving the second load vector as a feature variable and outputting a future load prediction label;
[0114] S4-4 specifically:
[0115] Use the cross entropy loss function to calculate the cross entropy loss between the future load prediction label and the historical load label;
[0116] Use the gradient descent algorithm to update the weight matrix and bias matrix of the classification model to minimize the cross entropy loss; that is, use the stochastic gradient descent algorithm to minimize the cross entropy loss function to update the weight matrix and bias matrix of the classification model, that is, the model parameters. The stochastic gradient descent algorithm is:
[0117]
[0118] Among them, θ tis the model parameter of the tth round, α is the step size for controlling each parameter update, is the cross entropy loss function L for parameter θ t The gradient of Perform calculations; is the sample data pair of the i-th second load vector, is the characteristic variable of the input of the classification model (i.e., the second load vector), is the target variable output by the classification model (i.e., historical load label).
[0119] If the minimized cross entropy loss is obtained, the classification model with the current weight matrix and bias matrix is derived as the load prediction model.
[0120] The process also includes:
[0121] Step S5, deploying the trained load prediction model to the application server, and outputting a future load prediction label after receiving the second load vector; if the future load prediction label is overload, generating an allocation request; sending the allocation request to a preset application server resource allocation policy library, and retrieving the application server resource classification policy to balance the future load; specifically, periodically obtaining the second load vector from the application server;
[0122] inputting the second load vector into the load prediction model, and outputting a future load prediction label for the application server in a future time period;
[0123] The future load prediction labels are converted into light overload, moderate overload, severe overload and normal overload states according to the preset mapping; the preset mapping is the correspondence between the future load prediction labels and the load states output by the model; that is, the model directly outputs a label (such as 0, 1, 2, 3), and then these labels are converted into specific overload states (such as "normal", "light overload", "moderate overload", "severe overload") through the preset mapping relationship. This preset mapping relationship can simplify the processing flow and clarify the specific meaning of each label.
[0124] Generate an allocation request according to the overload state, the allocation request including the overload state and its corresponding resource allocation strategy;
[0125] The allocation request is sent to the application server resource allocation policy library, and different resource allocation policies or policy combinations are called according to the allocation request to balance future loads.
[0126] The resource allocation strategy includes:
[0127] Vertical expansion strategy: Increase the computing resources of the current application server, such as the number of CPU cores and memory size;
[0128] Horizontal expansion strategy: dynamically add new application server instances to share overload traffic;
[0129] Load balancing adjustment strategy: Adjust the load balancing strategy to divert part of the traffic to other idle or low-load application servers
[0130] Traffic limiting strategy: limit or delay some non-critical requests to reduce the load on the application server;
[0131] Task priority adjustment strategy: Adjust the priority of tasks within the application server to ensure that high-priority tasks are processed first and reduce the resource usage of low-priority tasks.
[0132] The application server load prediction method in this embodiment can monitor and predict the load status of the application server in real time by obtaining multi-dimensional load characteristics of the application server, such as average delay, number of active connections, and activity behavior, and building a corresponding load prediction model. Load prediction can help the application server management system take measures in advance to avoid performance degradation or service interruption caused by overload.
[0133] Furthermore, for different types of activity behaviors (such as read and write operations, interactions, search requests, etc.), this method can evaluate their impact on the application server load, thereby making more scientific load management allocation requests.
[0134] Furthermore, when the application server is predicted to be overloaded, the system can automatically generate allocation requests and call the corresponding strategies in the resource allocation strategy library (such as vertical expansion, horizontal expansion, load balancing, flow restriction, etc.) to quickly respond to load changes. The use of dynamic resource allocation strategies can not only balance the application server load in a timely manner, but also improve resource utilization efficiency and reduce operating costs.
[0135] Furthermore, through accurate load prediction and resource allocation, the application server can maintain a stable operating state under high load conditions, reduce service delays, performance degradation or connection interruptions caused by application server overload, and significantly improve the user experience.
[0136] The embodiment of the present invention also provides an application server load prediction device, which is used to implement the above method embodiment, and the description has been made no further. The terms "module", "unit", "subunit" and the like used below can implement a combination of software and / or hardware for a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware is also possible and conceivable.
[0137] like Figure 2 As shown, Figure 2: is a structural block diagram of an application server load prediction device of the present invention, the device comprises:
[0138] The first load vector acquisition module 101 is used to acquire a first load vector of the application server. The characteristics of the first load vector include: average delay, number of active connections and activity behavior. The expression of the first load vector is:
[0139] X1=(Tr,C a ,B i )
[0140] Where X1 is the first load vector, Tr is the average delay, representing the average round-trip time between the user and the application server; C a is the number of active connections, which represents the number of users who maintain active connections in the application server; B i is the activity behavior, representing the number of active connections of the i-th activity behavior in which the user participates;
[0141] A preprocessing module 102, configured to perform data preprocessing according to the data structure of the first load vector;
[0142] A second load vector acquisition module 103, used to determine a second load vector from the preprocessed first load vector;
[0143] A training module 104 is used to receive the second load vector as an input feature of the classification model, and output an L2 norm prediction value as a future load prediction label to iteratively train the load prediction model;
[0144] The prediction balancing module 105 is used to deploy the trained load prediction model to the application server, and after receiving the second load vector, output the future load prediction label; if the future load prediction label is overloaded, generate an allocation request; send the allocation request to the preset application server resource allocation policy library, and call the application server resource classification policy to balance the future load.
[0145] In the above-mentioned device, the first load vector is acquired through the first load vector acquisition module 101, the preprocessing operation is performed on the first load vector through the preprocessing module 102, the second load vector is determined through the second load vector acquisition module 103, the load prediction model is obtained through the training module 105, and the future load is balanced through the prediction balancing module 105, thereby solving the problem of predicting the load of the application server.
[0146] like Figure 3As shown, an embodiment of the present invention further provides an electronic device, which includes a memory 230 and a processor 210, wherein the memory 230 stores at least one computer executable instruction, and the processor 210 is configured to run the computer executable instruction, and when the computer executable instruction is run by the processor 210, the above-mentioned application server load prediction method is implemented.
[0147] The electronic device may include a processor 210, a communications interface 220, a memory 230, and a communications bus 240, wherein the processor 210, the communications interface 220, and the memory 230 communicate with each other via the communications bus 240. The processor 210 may call the logic instructions in the memory 230 to execute the application server load prediction method disclosed in this embodiment.
[0148] In addition, the logic instructions in the above-mentioned memory 230 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, an application server, or a network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0149] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, i.e., they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement it without creative effort.
[0150] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, an application server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0151] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. An application server load prediction method, characterized in that: include: A first load vector of the application server is obtained. The characteristics of the first load vector include: average delay, number of active connections, and activity behavior. The expression of the first load vector is: X1=(Tr,C a ,B i ) Where X1 is the first load vector, Tr is the average delay, representing the average round-trip time between the user and the application server; C a is the number of active connections, which represents the number of users who maintain active connections in the application server; B i is the activity behavior, representing the number of active connections of the i-th activity behavior in which the user participates; performing data preprocessing according to the data structure of the first load vector; Determining a second load vector from the preprocessed first load vector; Receiving a second load vector in historical data as an input feature of a classification model, an L2 norm of the second load vector as a historical load label, and outputting an L2 norm prediction value as a future load prediction label to iteratively train a load prediction model; The trained load prediction model is deployed in the application server, and after receiving the second load vector, the future load prediction label is output; if the future load prediction label is overloaded, an allocation request is generated; the allocation request is sent to a preset application server resource allocation policy library, and the application server resource classification policy is called to balance the future load.
2. The method for predicting application server load according to claim 1, characterized in that: Obtaining a first load vector of the application server includes: The application server receives the heartbeat packets sent periodically by the client, records the round-trip time of the heartbeat packets, and after recording the rated number of times, calculates the average delay of the rated number of round-trip times; the calculation formula is: Among them, n is the number of recorded heartbeat packet round trip times, RTT i is the round trip time of the i-th heartbeat packet; Also includes: Obtain the user login time and the user logout time recorded in the service log of the application server, and determine the active duration according to the difference between the user logout time and the user login time; determine the active duration that exceeds the active duration threshold as an active connection, and determine the number of all active connections as the number of active connections; Also includes: Obtain user activities recorded in service logs in an application server, and the number of active connections corresponding to the user activities; wherein the user activities include: read and write operations, interactions, search requests, message sending / receiving, and others; construct the activity behavior based on the user activities and the number of active connections corresponding to the user activities.
3. The application server load prediction method according to claim 1, characterized in that: According to the data structure of the first load vector, data preprocessing is performed, including: Load the average latency, number of active connections, and activity behavior; Identify average latency and number of active connections as numerical data, and activity behavior as structural data; The average delay and the number of active connections are normalized to obtain the normalized average delay and the normalized number of active connections; For the number of active connections exceeding the threshold T c Select the activity behavior of B and keep the activity behavior B with high active connections i ', B i '=[C′ F ,C′ T ,C′ E ,C′ S ,C′ O ]; where the active connection number threshold T c is the default value.
4. The application server load prediction method according to claim 1, characterized in that: Determining a second load vector from the preprocessed first load vector; include: constructing the second load vector using the normalized average delay, the normalized number of active connections, and the selected normalized activity behavior as features; Calculating an L2 norm of the normalized average delay, the normalized number of active connections, and the selected normalized activity behavior, and using the L2 norm as a historical load label of a second load vector; Wherein, the expression of the L2 norm is: in, represents the L2 norm of the second load vector, represents the normalized average delay, Indicates the normalized number of active connections. Represents normalized activity behavior.
5. The method for predicting application server load according to claim 1, characterized in that: Receiving a second load vector in historical data as an input feature of a classification model, using an L2 norm of the second load vector as a historical load label, and outputting an L2 norm prediction value as a future load prediction label to iteratively train a load prediction model, including: selecting the classification model; Initializing the weight matrix and bias matrix of the classification model; The cross entropy loss between the historical load label and the future load prediction label in the classification model is defined as: Where N represents the number of samples in the second load vector, J represents the number of label categories, and y ij represents the actual probability that the i-th sample belongs to the j-th category, represents the predicted probability that the i-th sample belongs to the j-th category, and L is the average loss of all second load vector samples; receiving the second load vector as a feature variable and outputting a future load prediction label; Calculate the cross entropy loss of the future load prediction label and the historical load label using the cross entropy loss function; Using a gradient descent algorithm to update the weight matrix and bias matrix of the classification model to minimize the cross entropy loss; If the cross entropy loss is minimized, a classification model with the current weight matrix and bias matrix is derived as the load prediction model.
6. The method for predicting application server load according to claim 1, characterized in that: The trained load prediction model is deployed in the application server, and after receiving the second load vector, the future load prediction label is output; if the future load prediction label is overload, an allocation request is generated; The allocation request is sent to a preset application server resource allocation policy library, and an application server resource classification policy is retrieved to balance the future load, including: Periodically obtaining a second load vector from the application server; inputting the second load vector into the load prediction model, and outputting a future load prediction label for the application server in a future time period; Converting the future load prediction label into a light overload, a moderate overload, a severe overload and a normal overload state according to a preset mapping; wherein the preset mapping is a correspondence between the future load prediction label and the load state output by the model; wherein the preset mapping is a correspondence between the future load prediction label and the load state output by the model; Generate an allocation request according to the overload state, wherein the allocation request includes the overload state and its corresponding resource allocation strategy; The allocation request is sent to the application server resource allocation policy library, and different resource allocation policies or policy combinations are called according to the allocation request to balance the future load.
7. The application server load prediction device is characterized in that: include: The first load vector acquisition module is used to acquire a first load vector of the application server. The characteristics of the first load vector include: average delay, number of active connections and activity behavior. The expression of the first load vector is: X1=(Tr,C,B i ) Among them, X1 is the first load vector, Tr is the average delay, which represents the average round-trip time between the user and the application server; C is the number of active connections, which represents the number of users who maintain active connections in the application server; B i is the activity behavior, representing the number of active connections of the i-th activity behavior in which the user participates; A preprocessing module, used for performing data preprocessing according to the data structure of the first load vector; A second load vector acquisition module, used to determine a second load vector from the preprocessed first load vector; A training module, configured to receive the second load vector as an input feature of the classification model, and output an L2 norm prediction value as a future load prediction label, so as to iteratively train the load prediction model; The prediction balancing module is used to deploy the trained load prediction model to the application server, and after receiving the second load vector, output the future load prediction label; if the future load prediction label is overloaded, generate an allocation request; send the allocation request to a preset application server resource allocation policy library, and call the application server resource classification policy to balance the future load.
8. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory stores at least one computer executable instruction, the processor is configured to execute the computer executable instruction, and the computer executable instruction, when executed by the processor, implements the application server load prediction method according to any one of claims 1 to 7.
9. A computer-readable storage medium, characterized in that: A computer program is stored on a computer-readable storage medium, and when the computer program is executed by a processor, the application server load prediction method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Neural network model training method and device, equipment and storage medium
CN114943330A
Method and device for determining connection state, medium and computing equipment
CN115022393A
Load balancing method and device, computer equipment and storage medium
CN116737373A
Method and system for reducing tenant tail delay of content distribution network based on machine learning
CN116962204A
Load balancing method, device and equipment and storage medium thereof
CN117395253A