Application server load prediction methods, devices, electronic equipment, and storage media
By constructing an application server load prediction model, obtaining multi-dimensional load characteristics and generating allocation requests, the problem of application server overload is solved, real-time load monitoring and efficient resource management are achieved, and the user experience is improved.
Patent Information
- Application Number
- CN202411759536.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2044-12-03
AI Technical Summary
How to effectively predict the load on application servers and manage resources based on the prediction results to avoid response delays and service interruptions caused by overload.
By acquiring multi-dimensional load characteristics of application servers, such as average latency, number of active connections, and activity behavior, a load prediction model is built. A classification model is used for load prediction, and when overload is predicted, an allocation request is generated and a resource allocation strategy is invoked to balance the load.
It enables real-time monitoring and prediction of application server load, avoiding performance degradation and service interruption caused by overload, improving resource utilization efficiency and reducing operating costs.
Smart Images

Figure CN119718635B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of application servers, specifically to application server load prediction methods, apparatus, electronic devices, and storage media. Background Technology
[0002] With the development of modern internet services, the number of online users has grown rapidly, making application server load management a critical issue. In various online services, such as web applications, enterprise systems, and cloud computing platforms, tens of thousands of users are online simultaneously, and frequent interactive operations (such as read / write operations, interactive requests, and search requests) place a huge burden on application servers. The load status of application servers directly affects the user experience; overload can lead to increased response latency, performance degradation, and even service interruptions. Therefore, how to effectively predict application server load and manage resources based on the prediction results has become a pressing problem for various service providers. Summary of the Invention
[0003] This embodiment provides an application server load prediction method, apparatus, electronic device, and storage medium, exploring how to solve the problem of application server load prediction and resource management based on the prediction results.
[0004] In a first aspect, the present invention provides an application server load prediction method, comprising:
[0005] Obtain the first load vector of the application server. The characteristics of the first load vector include: average latency, number of active connections, and activity behavior. The expression for the first load vector is:
[0006] X1 = (Tr, C, B) i )
[0007] Where X1 is the first load vector, Tr is the average latency, representing the average round-trip time between the user and the application server; C is the number of active connections, representing the number of users maintaining active connections on the application server; B i For activity behavior, it represents the number of active connections for the i-th activity behavior in which the user participates;
[0008] Perform data preprocessing based on the data structure of the first load vector;
[0009] The second load vector is determined from the preprocessed first load vector;
[0010] The system receives the second load vector as the input feature of the classification model and outputs the L2 norm prediction value as the future load prediction label to iteratively train the load prediction model.
[0011] The trained load prediction model is deployed to the application server. After receiving the second load vector, it outputs the future load prediction label. If the future load prediction label is overloaded, an allocation request is generated. The allocation request is sent to the preset application server resource allocation strategy library to retrieve the application server resource classification strategy to balance the future load.
[0012] In some embodiments, obtaining the first load vector of the application server includes:
[0013] The application server receives heartbeat packets periodically sent by the client, records the round-trip time of each heartbeat, and calculates the average delay for that number of round-trip times after recording a set number of times. The calculation formula is as follows:
[0014]
[0015] Where n is the number of heartbeat round-trip times recorded, RTT i It is the round-trip time of the i-th heartbeat packet;
[0016] Also includes:
[0017] Obtain the user login time and user logout time recorded in the service logs of the application server. Determine the active duration based on the difference between the user logout time and the user login time. Determine the active duration exceeding the active duration threshold as active connections, and determine the total number of active connections as the active connection count.
[0018] Also includes:
[0019] Obtain user activities recorded in the service logs of the application server, as well as 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 embodiments, data preprocessing is performed based on the data structure of the first load vector, including:
[0021] Load the average latency, number of active connections, and activity behavior;
[0022] Average latency and active connection count are identified as numerical data, while activity behavior is identified as structured data.
[0023] The average latency and the number of active connections are normalized to obtain the normalized average latency Tr' and the normalized number of active connections C';
[0024] For connections exceeding the active connection threshold T c Select the activity behaviors and retain the activity behaviors with the highest number of active connections (B). i', B i '=[C′ F ,C′ T ,C′ E ,C′ S ,C′ O ]; where the active connection threshold T c This is the default value.
[0025] In some embodiments, a second load vector is determined from the preprocessed first load vector; including:
[0026] The normalized average latency, normalized active connection count, and selected normalized activity behavior are used as features to construct the second load vector;
[0027] Calculate the normalized average latency, normalized active connection count, and L2 norm of the selected normalized activity behavior, and use the L2 norm as the historical load label of the second load vector;
[0028] The expression for the L2 norm is:
[0029]
[0030] in, Denotes the L2 norm of the second load vector. Indicates the normalized average delay. Represents the normalized active connection count. It represents normalized activity behavior.
[0031] In some embodiments, a second load vector is received as a feature variable of the classification model, and an L2 norm predicted value is output as a future load prediction label to iteratively train the load prediction model, including:
[0032] Select the classification model;
[0033] Initialize the weight matrix and bias term matrix of the classification model;
[0034] Define the cross-entropy loss between historical load labels and future load prediction labels in the classification model, wherein the cross-entropy loss function is:
[0035]
[0036] Where N represents the number of second load vector samples, J represents the number of label categories, and y ij This represents the actual probability that the i-th sample belongs to the j-th category. Let L represent the predicted probability that the i-th sample belongs to the j-th class, and L be the average loss of all second load vector samples.
[0037] Receive the second load vector as a feature variable and output the future load prediction label;
[0038] The cross-entropy loss function is used to calculate the cross-entropy loss between the future load prediction label and the historical load label;
[0039] The weight matrix and bias term matrix of the classification model are updated using the gradient descent algorithm to minimize the cross-entropy loss;
[0040] If the cross-entropy loss is minimized, then the classification model with the current weight matrix and bias term matrix is derived as the load prediction model.
[0041] In some embodiments, the trained load prediction model is deployed to an application server. After receiving the second load vector, it outputs the future load prediction label. If the future load prediction label indicates overload, an allocation request is generated. The allocation request is sent to a preset application server resource allocation strategy library to retrieve application server resource classification strategies to balance the future load, including:
[0042] A second load vector is periodically obtained from the application server;
[0043] Input the second load vector into the load prediction model and output the future load prediction label of the application server within a future time period;
[0044] The future load prediction labels are converted into light overload, moderate overload, heavy overload and normal overload states according to a preset mapping; wherein, the preset mapping is the correspondence between the future load prediction labels and the load states output by the model.
[0045] An allocation request is generated based on the overload status, and the allocation request includes the overload status and its corresponding resource allocation strategy.
[0046] The allocation request is sent to the application server's resource allocation strategy library, and different resource allocation strategies or combinations of strategies are invoked according to the allocation request to balance the future load.
[0047] Compared with existing technologies, the application server load prediction method of the present invention can monitor and predict the load status of application servers in real time by acquiring multi-dimensional load characteristics of application servers, such as average latency, number of active connections, and activity behavior, and constructing corresponding load prediction models.
[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 the first load vector of the application server. The characteristics of the first load vector include: average latency, number of active connections, and activity behavior. The expression of the first load vector is:
[0050] X1 = (Tr, C, B) i )
[0051] Where X1 is the first load vector, Tr is the average latency, representing the average round-trip time between the user and the application server; C is the number of active connections, representing the number of users maintaining active connections on the application server; B i For activity behavior, it represents the number of active connections for the i-th activity behavior in which the user participates;
[0052] The preprocessing module is used to perform data preprocessing based on the data structure of the first load vector;
[0053] The second load vector acquisition module is used to determine the second load vector from the preprocessed first load vector;
[0054] The training module is used to receive the second load vector as the input feature of the classification model and output the L2 norm prediction value as the future load prediction label 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. After receiving the second load vector, it outputs the future load prediction label. If the future load prediction label is overloaded, it generates an allocation request. The allocation request is sent to a preset application server resource allocation strategy library to retrieve the application server resource classification strategy to balance the future load.
[0056] Thirdly, the present invention provides an electronic device, the electronic device including a memory and a processor, the memory storing at least one computer-executable instruction, the processor being configured to run the computer-executable instruction, the computer-executable instruction being run by the processor to implement the application server load prediction method described in this aspect.
[0057] Fourthly, the present invention provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the application server load prediction method described in this 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 application server load prediction method described above, so they will not be repeated here. Attached Figure Description
[0059] Figure 1 This is a schematic diagram illustrating the steps of the application server load prediction method in the embodiments provided by the present invention;
[0060] Figure 2This is a structural block diagram of the application server load prediction device provided in the embodiments of the present invention;
[0061] Figure 3 A diagram of an electronic device provided in an embodiment of the present invention; Detailed Implementation
[0062] To better understand the purpose, technical solution, and advantages of this application, the application is described and explained below in conjunction with the accompanying drawings and embodiments.
[0063] Unless otherwise defined, the technical or scientific terms used in this application shall have the general meaning as understood by one of ordinary skill in the art to which this application pertains. Words such as “a,” “an,” “an,” “the,” “the,” and “these,” used in this application, do not indicate quantitative limitation and may be singular or plural. The terms “comprising,” “including,” “having,” and any variations thereof used in this application are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or device that comprises a series of steps or modules (units) is not limited to the listed steps or modules (units) but may include steps or modules (units) not listed, or may include other steps or modules (units) inherent to such processes, methods, products, or devices. The terms “connected,” “linked,” and “coupled,” used in this application, are not limited to physical or mechanical connections but may include electrical connections, whether direct or indirect. The term “multiple” used in this application refers to two or more. The "and / or" operator describes the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: A alone, A and B simultaneously, and B alone. Typically, the character " / " indicates that the objects before and after it are in an "or" relationship. The terms "", "", and "third" used in this application are merely for distinguishing similar objects and do not represent a specific ordering of objects.
[0064] refer to Figures 1 to 3 This invention provides an application server load prediction method. Figure 1 This is a flowchart of the application server load prediction method of the present invention, which includes:
[0065] Step S1: Obtain the first load vector of the application server. The characteristics of the first load vector include: average latency, number of active connections, and activity behavior. The expression of the first load vector is:
[0066] X1 = (Tr, C, B) i )
[0067] Where X1 is the first load vector, Tr is the average latency, representing the average round-trip time between the user and the application server; C is the number of active connections, representing the number of users maintaining active connections on the application server; B i For activity behavior, it represents the number of active connections for the i-th activity behavior in which the user participates.
[0068] Step S1 also includes:
[0069] S1-1, the application server receives heartbeat packets periodically sent by the client, records the round-trip time of the heartbeat packets, and after recording a set number of times, calculates the average delay of the round-trip time for the set number of times; the calculation formula is:
[0070]
[0071] Where n is the number of heartbeat round-trip times recorded, RTT i It is the round-trip time of the i-th heartbeat packet.
[0072] Also includes:
[0073] S1-2, obtain the user login time and user logout time recorded in the service log of the application server, determine the active duration based on the difference between the user logout time and the user login time; determine the active duration exceeding the active duration threshold as active connections, and determine the total number of active connections as the active connection count;
[0074] Furthermore, for each user i, the formula for calculating the active duration is:
[0075] T online,i =T logout,i -T login,i
[0076] Among them, T online,i It is the online time of user i, T logout,i It is the login time of user i, T login,i This is the logout time of user i;
[0077] To determine how to identify active connections, a time threshold T needs to be set. threshold Determine if a user is active. If user i's online time exceeds a time threshold, it is considered an active connection. Therefore, the determination process can be represented by an exponential function I:
[0078]
[0079] This means that if user i's online time T online,i Exceeding the set time threshold T threshold If the condition is met, return 1; otherwise, return 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 user activities recorded in the service logs of the application server, as well as the number of active connections corresponding to the user activities; where user activities include: read and write operations, interactions, search requests, message sending / receiving, and others; construct activity behaviors from 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 that user activity b can be counted. b If there are M different activity behaviors preset, 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 It is the number of active connections performing read and write operations, C T C is the number of active connections for interactive behavior. E C is the number of active connections for search request behavior. S C is the number of active connections in the message sending / receiving phase. O It represents the number of active connections for other behaviors.
[0087] Therefore, the number C of active connections participating in user activity b b The formula can be defined as:
[0088]
[0089] Among them, C b Nb is the number of active connections in user activity b, and Nb is the total number of users participating in user activity b. i Let A represent the total number of active connections, and Bb represent the set of users participating in user activity b. It is an indicator function that represents if the player i In A and B bIf the intersection of the active connections and the active connections is found, then 1 is returned; otherwise, 0 is returned. That is, for each user activity b, calculating the sum of the number of users participating in user activity b and being active connections is equivalent to calculating the intersection of the total number of active connections and the number of elements in the intersection of the active connections and the active connections participating in user activity b.
[0090] The process also includes:
[0091] Step S2: Perform data preprocessing based on the data structure of the first load vector.
[0092] Step S2 is as follows:
[0093] Average loading latency, number of active connections, and activity behavior;
[0094] Average latency and active connection count are identified as numerical data, while activity behavior is identified as structured data.
[0095] The average latency and the number of active connections are normalized to obtain the normalized average latency and the normalized number of active connections.
[0096] For connections exceeding the active connection threshold T c Select the activity behaviors and retain the activity behaviors with the highest number of active connections (B). i ', B i '=[C′ F C′ T C′ E C′ S C′ O ]; where the active connection threshold T c This is the default value.
[0097] The process also includes:
[0098] Step S3: Determine the second load vector from the preprocessed first load vector;
[0099] Step S3 is as follows:
[0100] The normalized average latency, normalized active connection count, and selected normalized activity behavior are used as features to construct the second load vector;
[0101] Calculate the normalized average latency, normalized active connection count, and L2 norm of the selected normalized activity behavior, and use the L2 norm as the historical load label of the second load vector;
[0102] The expression for the L2 norm is:
[0103]
[0104] in, Denotes the L2 norm of the second load vector. Indicates the normalized average delay. Represents the normalized active connection count. Indicates normalized activity behavior;
[0105] The process also includes:
[0106] Step S4: Receive the second load vector as the input feature of the classification model, output the L2 norm prediction value as the future load prediction label, and iteratively train the load prediction model.
[0107] Step S4 is as follows:
[0108] S4-1, Select a classification model; the classification model can be logistic regression.
[0109] S4-2, Initialize the weight matrix and bias term matrix of the classification model; initializing parameters is to provide the model with a starting point, so that these parameters can be gradually adjusted during training through gradient descent or other optimization algorithms, so that the cross-entropy loss function of the model gradually decreases and eventually finds the optimal solution.
[0110] S4-3 defines the cross-entropy loss between 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 second load vector samples, J represents the number of label categories, and y ij This represents the actual probability that the i-th sample belongs to the j-th category. Let L represent the predicted probability that the i-th sample belongs to the j-th category, and L be the average loss of all second load vector samples.
[0113] S4-4: Receive the second load vector as a feature variable and output the future load prediction label;
[0114] S4-4 specifically refers to:
[0115] The cross-entropy loss function is used to calculate the cross-entropy loss between the future load prediction label and the historical load label.
[0116] The weight matrix and bias term matrix of the classification model are updated using the gradient descent algorithm to minimize the cross-entropy loss; that is, the stochastic gradient descent algorithm is used to minimize the cross-entropy loss function to update the weight matrix and bias term matrix of the classification model, i.e., the model parameters. The stochastic gradient descent algorithm is as follows:
[0117]
[0118] Where, θ tLet be the model parameters in round t, and α be the step size controlling each parameter update. The cross-entropy loss function L is given by parameter θ. t The gradient, which is based on a single sample. Perform calculations; For the i-th sample data pair of the second load vector, These are the feature variables (i.e., the second loading vector) input to the classification model. It is the target variable (i.e., historical load label) output by the classification model.
[0119] If the cross-entropy loss is minimized, then the classification model with the current weight matrix and bias term matrix is derived as the load prediction model.
[0120] The process also includes:
[0121] Step S5: Deploy the trained load prediction model to the application server. 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 strategy library to retrieve the application server resource classification strategy to balance the future load. Specifically, periodically obtain the second load vector from the application server.
[0122] Input the second load vector into the load prediction model and output the future load prediction label of the application server within a future time period;
[0123] The model converts future load prediction labels into four overload states: light overload, moderate overload, heavy overload, and normal overload, based on a pre-defined mapping. This pre-defined mapping establishes a correspondence between the model's output labels and the corresponding load states. In other words, the model directly outputs a label (e.g., 0, 1, 2, 3), and then the pre-defined mapping converts these labels into specific overload states (e.g., "normal," "light overload," "moderate overload," and "heavy overload"). This pre-defined mapping simplifies the processing flow and clarifies the meaning of each label.
[0124] An allocation request is generated based on the overload status. The allocation request includes the overload status and its corresponding resource allocation strategy.
[0125] The allocation request is sent to the application server's resource allocation strategy library, and different resource allocation strategies or combinations of strategies are invoked based on the allocation request to balance future load.
[0126] The resource allocation strategy includes:
[0127] Vertical scaling strategy: Increase the computing resources of the current application server, such as the number of CPU cores and the amount of memory;
[0128] Horizontal scaling strategy: Dynamically add new application server instances to distribute overloaded traffic;
[0129] Load balancing adjustment strategy: Adjust the load balancing strategy to offload some 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 consumption of low-priority tasks.
[0132] The application server load prediction method in this embodiment acquires multi-dimensional load characteristics of the application server, such as average latency, number of active connections, and activity behavior, and constructs a corresponding load prediction model. This enables real-time monitoring and prediction of the application server's load status. Load prediction helps the application server management system take proactive measures to avoid performance degradation or service interruptions caused by overload.
[0133] Furthermore, for different types of activities (such as read / write operations, interactions, search requests, etc.), this method can assess their impact on the application server load, thereby making more scientific load management allocation requests.
[0134] Furthermore, when application server overload is predicted, the system can automatically generate allocation requests and invoke corresponding strategies from the resource allocation strategy library (such as vertical scaling, horizontal scaling, load balancing, and traffic limiting) to quickly respond to load changes. The use of dynamic resource allocation strategies not only balances application server load in a timely manner but also improves resource utilization efficiency and reduces operating costs.
[0135] Furthermore, through accurate load prediction and resource allocation, application servers can maintain stable operation even under high load, reducing service latency, performance degradation, or connection interruptions caused by application server overload, and significantly improving the user experience.
[0136] This invention also provides an application server load prediction device for implementing the above-described method embodiments; details already described will not be repeated. The terms "module," "unit," and "subunit," etc., used below refer to combinations of software and / or hardware that perform a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0137] like Figure 2 As shown, Figure 2This is a structural block diagram of the application server load prediction device of the present invention, which includes:
[0138] The first load vector acquisition module 101 is used to acquire the first load vector of the application server. The characteristics of the first load vector include: average latency, 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 latency, representing the average round-trip time between the user and the application server; C a Active connections represent the number of users maintaining active connections on the application server; B i For activity behavior, it represents the number of active connections for the i-th activity behavior in which the user participates;
[0141] Preprocessing module 102 is used to perform data preprocessing based on the data structure of the first load vector;
[0142] The second load vector acquisition module 103 is used to determine the second load vector from the preprocessed first load vector;
[0143] The training module 104 is used to receive the second load vector as the input feature of the classification model and output the L2 norm prediction value as the 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. After receiving the second load vector, it outputs the future load prediction label. If the future load prediction label is overloaded, it generates an allocation request. The allocation request is sent to the preset application server resource allocation strategy library to retrieve the application server resource classification strategy to balance the future load.
[0145] In the above device, the first load vector is obtained by the first load vector acquisition module 101, the first load vector is preprocessed by the preprocessing module 102, the second load vector is determined by the second load vector acquisition module 103, the load prediction model is obtained by the training module 105, and the future load is balanced by the prediction balancing module 105, thereby solving the problem of predicting the load of the application server.
[0146] like Figure 3As shown, this embodiment of the invention also provides an electronic device, which includes a memory 230 and a processor 210. The memory 230 stores at least one computer-executable instruction, and the processor 210 is configured to run the computer-executable instruction. The computer-executable instruction is run by the processor 210 to implement the above-described application server load prediction method.
[0147] The electronic device may include a processor 210, a communications interface 220, a memory 230, and a communication bus 240, wherein the processor 210, the communications interface 220, and the memory 230 communicate with each other via the communication bus 240. The processor 210 may call logical instructions in the memory 230 to execute the application server load prediction method disclosed in this embodiment.
[0148] Furthermore, the logical instructions in the aforementioned memory 230 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, application server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0149] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0150] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, application server, or network device, etc.) to execute the methods described in the various embodiments 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, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate 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: Obtain the first load vector of the application server. The characteristics of the first load vector include: average latency, number of active connections, and activity behavior. The expression for the first load vector is: ; in, For the first load vector, Average latency represents the average round-trip time between the user and the application server; Active connections represent the number of users maintaining active connections on the application server; For activity behavior, representing the user's participation. The number of active connections for each activity behavior; Perform data preprocessing based on the data structure of the first load vector; The second load vector is determined from the preprocessed first load vector; Determining the second load vector from the preprocessed first load vector includes: The normalized average latency, normalized active connection count, and selected normalized activity behavior are used as features to construct the second load vector; Calculate the normalized average latency, normalized active connection count, and L2 norm of the selected normalized activity behavior, and use the L2 norm as the historical load label of the second load vector; The expression for the L2 norm is: ; in, Denotes the L2 norm of the second load vector. Indicates the normalized average delay. Represents the normalized active connection count. Indicates normalized activity behavior; The system receives the second load vector from historical data as the input feature of the classification model, uses the L2 norm of the second load vector as the historical load label, and outputs the L2 norm prediction value as the future load prediction label to iteratively train the load prediction model. The trained load prediction model is deployed to the application server. After receiving the second load vector, it outputs the future load prediction label. If the future load prediction label is overloaded, an allocation request is generated. The allocation request is sent to the preset application server resource allocation strategy library to retrieve the application server resource classification strategy to balance the future load.
2. The application server load prediction method according to claim 1, characterized in that: Obtain the first load vector of the application server, including: The application server receives heartbeat packets periodically sent by the client, records the round-trip time of each heartbeat, and calculates the average delay for that number of round-trip times after recording a set number of times. The calculation formula is as follows: ; Where n is the number of times the heartbeat packet round-trip time is recorded. It is the round-trip time of the i-th heartbeat packet; Also includes: Obtain the user login time and user logout time recorded in the service logs of the application server. Determine the active duration based on the difference between the user logout time and the user login time. Determine the active duration exceeding the active duration threshold as active connections, and determine the total number of active connections as the active connection count. Also includes: Obtain user activities recorded in the service logs of the application server, as well as 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: Based on the data structure of the first load vector, perform data preprocessing, including: Load the average latency, number of active connections, and activity behavior; Average latency and active connection count are identified as numerical data, while activity behavior is identified as structured data. The average latency and the number of active connections are normalized to obtain the normalized average latency and the normalized number of active connections. Activity behavior The type set is: ; in, It is the number of active connections performing read and write operations. It is the number of active connections for interactive behavior. It represents the number of active connections for search request behavior. It is the number of active connections in the message sending / receiving phase. It represents the number of active connections for other behaviors; For exceeding the active connection threshold Select the activity behaviors and retain those with a high number of active connections. Among them, the threshold for the number of active connections. This is the default value.
4. The application server load prediction method according to claim 1, characterized in that: The system receives a second load vector from historical data as input features to the classification model, uses the L2 norm of the second load vector as the historical load label, and outputs the L2 norm prediction value as the future load prediction label. This is used to iteratively train the load prediction model, including: Select the classification model; Initialize the weight matrix and bias term matrix of the classification model; Define the cross-entropy loss between historical load labels and future load prediction labels in the classification model, wherein the cross-entropy loss function is: ; Where N represents the number of samples in the second load vector. Indicates the number of label categories. This represents the actual probability that the i-th sample belongs to the j-th category. Let represent the predicted probability that the i-th sample belongs to the j-th class. The average loss for all second load vector samples; Receive the second load vector as a feature variable and output the future load prediction label; The cross-entropy loss function is used to calculate the cross-entropy loss between the future load prediction label and the historical load label; The weight matrix and bias term matrix of the classification model are updated using the gradient descent algorithm to minimize the cross-entropy loss; If the cross-entropy loss is minimized, then the classification model with the current weight matrix and bias term matrix is derived as the load prediction model.
5. The application server load prediction method according to claim 1, characterized in that: The trained load prediction model is deployed to the application server. After receiving the second load vector, it outputs the future load prediction label. If the future load prediction label indicates overload, an allocation request is generated. The allocation request is sent to a preset application server resource allocation strategy library to retrieve application server resource classification strategies to balance the future load, including: A second load vector is periodically obtained from the application server; Input the second load vector into the load prediction model and output the future load prediction label of the application server within a future time period; The future load prediction labels are converted into light overload, moderate overload, heavy overload, and normal overload states according to a preset mapping; wherein, the preset mapping is the correspondence between the future load prediction labels and the load states output by the model; wherein, the preset mapping is the correspondence between the future load prediction labels and the load states output by the model. An allocation request is generated based on the overload status, and the allocation request includes the overload status and its corresponding resource allocation strategy. The allocation request is sent to the application server's resource allocation strategy library, and different resource allocation strategies or combinations of strategies are invoked according to the allocation request to balance the future load.
6. An application server load prediction device, characterized in that, include: The first load vector acquisition module is used to acquire the first load vector of the application server. The characteristics of the first load vector include: average latency, number of active connections, and activity behavior. The expression of the first load vector is: ; in, For the first load vector, Average latency represents the average round-trip time between the user and the application server; Active connections represent the number of users maintaining active connections on the application server; For activity behavior, representing the user's participation. The number of active connections for each activity behavior; The preprocessing module is used to perform data preprocessing based on the data structure of the first load vector; The second load vector acquisition module is used to determine the second load vector from the preprocessed first load vector; The training module is used to receive the second load vector as the input feature of the classification model and output the L2 norm prediction value as the future load prediction label to iteratively train the load prediction model. The prediction balancing module is used to deploy the trained load prediction model to the application server. After receiving the second load vector, it outputs the future load prediction label. If the future load prediction label is overloaded, it generates an allocation request. The allocation request is sent to the preset application server resource allocation strategy library to retrieve the application server resource classification strategy to balance the future load. The normalized average latency, normalized active connection count, and selected normalized activity behavior are used as features to construct the second load vector; Calculate the normalized average latency, normalized active connection count, and L2 norm of the selected normalized activity behavior, and use the L2 norm as the historical load label of the second load vector; The expression for the L2 norm is: ; in, Denotes the L2 norm of the second load vector. Indicates the normalized average delay. Represents the normalized active connection count. It represents normalized activity behavior.
7. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory storing at least one computer-executable instruction, and the processor being configured to run the computer-executable instruction, which is executed by the processor to implement the application server load prediction method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, A computer-readable storage medium stores a computer program that, when executed by a processor, implements the application server load prediction method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Method and device for determining connection state, medium and computing equipment
CN115022393A
Distributed system service scheduling optimization method and device, equipment and medium
CN118590549A