Message flow control method, device, equipment and readable storage medium
By acquiring the previously predicted message traffic and historical traffic characteristics, and using a long short-term memory network to predict the target message traffic, the problem of traffic fluctuation in existing technologies is solved, and the stability of system traffic and throughput are improved.
Patent Information
- Application Number
- CN202411605301.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-12
- Publication Date
- 2026-02-24
- Estimated Expiration
- 2044-11-12
AI Technical Summary
Existing message queue rate limiting methods are prone to causing drastic traffic fluctuations when faced with instantaneous traffic fluctuations, and cannot effectively stabilize system traffic.
By acquiring the message traffic from the previous prediction and historical traffic characteristics, the target message traffic is predicted using a long short-term memory network. Based on the prediction results, rate limiting or de-limiting is applied, and the prediction network is optimized by combining the training set and the validation set.
It enables accurate prediction of future message traffic, avoids traffic fluctuations, and improves system stability and throughput.
Smart Images

Figure CN119449725B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to a message flow control method, apparatus, device, and readable storage medium. Background Technology
[0002] Message queues are an asynchronous inter-service communication method, primarily addressing issues such as asynchronous decoupling, peak shaving and valley filling, and asynchronous messaging in systems, achieving a high-performance, highly available, scalable, and eventually consistent system architecture. Message queues are indispensable middleware for large-scale distributed systems and are a cornerstone middleware for high-concurrency systems. Message queues can handle high-concurrency systems and provide highly available services thanks to their inherent message caching, asynchronous sending, and elegant design. To cope with high concurrency and achieve high throughput, rate limiting techniques are essential.
[0003] However, existing rate limiting methods monitor traffic in real time, limiting traffic when it exceeds a threshold and stopping when it falls below the threshold. This approach, when dealing with instantaneous traffic spikes, leads to drastic traffic fluctuations when rate limiting or de-limiting is based on instantaneous traffic. Summary of the Invention
[0004] The purpose of this application is to provide a message flow control method, apparatus, device, and readable storage medium to avoid the problem of drastic flow fluctuations in current message queue rate limiting processing.
[0005] To achieve the above objectives, embodiments of this application provide a message flow control method, executed by a network device, comprising:
[0006] Obtain the message traffic from the last predicted message traffic and the first historical traffic characteristics;
[0007] Based on the previously predicted message traffic and the first historical traffic characteristics, predict the target message traffic;
[0008] Rate limiting or de-rate limiting is performed based on the target message traffic.
[0009] Optionally, predicting the target message traffic based on the previously predicted message traffic and the first historical traffic characteristics includes:
[0010] Input the previously predicted message traffic and the first historical traffic features into the prediction network;
[0011] The output of the prediction network is used as the target message traffic.
[0012] Optionally, before predicting the target message traffic based on the previously predicted message traffic and the first historical traffic characteristics, the method further includes:
[0013] Obtain the training and validation sets;
[0014] The preset network is trained based on the training set and the validation set to obtain a pre-trained network, and the prediction network is determined based on the pre-trained network.
[0015] Optionally, determining the prediction network based on the pre-trained network includes:
[0016] The pre-trained network is used as the prediction network;
[0017] or,
[0018] The pre-trained network is adjusted based on the second historical traffic characteristics of the target user, and the adjusted pre-trained network is used as the prediction network.
[0019] Optionally, obtaining the training set and validation set includes:
[0020] Notify multiple virtual machines with different configurations to execute the target task;
[0021] Collect the target data generated by the target task;
[0022] The data from the first time period in the target data is used as the training set, and the data from the second time period in the target data is used as the validation set.
[0023] Optionally, training the preset network based on the training set and the validation set to obtain a pre-trained network includes:
[0024] The first data of the training set or the validation set is input into the preset network; wherein, the first data includes the third historical traffic characteristics of the third time period;
[0025] If the mean square error loss between the output of the preset network and the actual message traffic corresponding to the first data is within a specific range, then the pre-trained network is determined.
[0026] If the mean squared error loss of the output of the preset network and the actual message traffic corresponding to the first data is not within the specific range, then the first data is updated, and the updated first data is input into the preset network until the pre-trained network is determined; wherein, the time period corresponding to the fourth historical traffic feature in the updated first data partially overlaps with the third time period, and the start time is after the start time of the third time period.
[0027] Optionally, the first historical traffic feature, the second historical traffic feature, the third historical traffic feature, or the fourth historical traffic feature may each include:
[0028] Central processing unit (CPU) utilization, memory utilization, network bandwidth utilization, and disk read / write speed.
[0029] Optionally, the prediction network is a long short-term memory network.
[0030] To achieve the above objectives, embodiments of this application provide a message flow control device, comprising:
[0031] The first acquisition module is used to acquire the message traffic of the previous prediction and the first historical traffic characteristics;
[0032] The first processing module is used to predict the target message traffic based on the previously predicted message traffic and the first historical traffic characteristics;
[0033] The second processing module is used to limit or delimit the flow of the target message based on the flow rate.
[0034] Optionally, the first processing module includes:
[0035] The first processing submodule is used to input the previously predicted message traffic and the first historical traffic features into the prediction network;
[0036] The second processing submodule is used to take the output of the prediction network as the target message traffic.
[0037] Optionally, the device further includes:
[0038] The second acquisition module is used to acquire the training set and the validation set;
[0039] The training module is used to train a preset network based on the training set and the validation set to obtain a pre-trained network, and to determine the prediction network based on the pre-trained network.
[0040] Optionally, the device further includes:
[0041] The third processing module is used to use the pre-trained network as the prediction network;
[0042] or,
[0043] The pre-trained network is adjusted based on the second historical traffic characteristics of the target user, and the adjusted pre-trained network is used as the prediction network.
[0044] Optionally, the first acquisition module is further configured to:
[0045] Notify multiple virtual machines with different configurations to execute the target task;
[0046] Collect the target data generated by the target task;
[0047] The data from the first time period in the target data is used as the training set, and the data from the second time period in the target data is used as the validation set.
[0048] Optionally, the training module is further configured to:
[0049] The first data of the training set or the validation set is input into the preset network; wherein, the first data includes the third historical traffic characteristics of the third time period;
[0050] If the mean square error loss between the output of the preset network and the actual message traffic corresponding to the first data is within a specific range, then the pre-trained network is determined.
[0051] If the mean squared error loss of the output of the preset network and the actual message traffic corresponding to the first data is not within the specific range, then the first data is updated, and the updated first data is input into the preset network until the pre-trained network is determined; wherein, the time period corresponding to the fourth historical traffic feature in the updated first data partially overlaps with the third time period, and the start time is after the start time of the third time period.
[0052] Optionally, the first historical traffic feature, the second historical traffic feature, the third historical traffic feature, or the fourth historical traffic feature may each include:
[0053] Central processing unit (CPU) utilization, memory utilization, network bandwidth utilization, and disk read / write speed.
[0054] Optionally, the prediction network is a long short-term memory network.
[0055] To achieve the above objectives, embodiments of this application provide a network device, including a processor, the processor being used for:
[0056] Obtain the message traffic from the last predicted message traffic and the first historical traffic characteristics;
[0057] Based on the previously predicted message traffic and the first historical traffic characteristics, predict the target message traffic;
[0058] Rate limiting or de-rate limiting is performed based on the target message traffic.
[0059] To achieve the above objectives, embodiments of this application provide a network device, including: a transceiver, a processor, a memory, and a program or instructions stored in the memory and executable on the processor; when the processor executes the program or instructions, it implements the message flow control method described above.
[0060] To achieve the above objectives, embodiments of this application provide a readable storage medium storing a program or instructions thereon, which, when executed by a processor, implement the steps in the message flow control method described above.
[0061] To achieve the above objectives, embodiments of this application provide a computer program product, including computer instructions, which, when executed by a processor, implement the steps of the message flow control method described above.
[0062] The beneficial effects of the above technical solution in this application are as follows:
[0063] The method in this application embodiment obtains the previously predicted message traffic and the first historical traffic characteristics, and uses these two to predict the target message traffic, providing a reasonable judgment for rate limiting or de-limiting in the future, ensuring the stability of system traffic, and improving the system throughput. Attached Figure Description
[0064] Figure 1 This is a flowchart of a message flow control method according to an embodiment of this application;
[0065] Figure 2 This is a schematic diagram of the LSTM network structure in the embodiments of this application;
[0066] Figure 3 This is one of the schematic diagrams for generating experimental data;
[0067] Figure 4 The second schematic diagram for generating experimental data;
[0068] Figure 5 The third diagram for generating experimental data;
[0069] Figure 6 The fourth diagram for generating experimental data;
[0070] Figure 7 This is a schematic diagram of the training process;
[0071] Figure 8 This is a schematic diagram of the training results;
[0072] Figure 9 This is a schematic diagram of the module structure of the message flow control device according to an embodiment of this application;
[0073] Figure 10 This is a structural diagram of a network device according to an embodiment of this application;
[0074] Figure 11 This is a structural diagram of a network device according to another embodiment of this application. Detailed Implementation
[0075] To make the technical problems, technical solutions and advantages of this application clearer, a detailed description will be provided below in conjunction with the accompanying drawings and specific embodiments.
[0076] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments.
[0077] In the various embodiments of this application, it should be understood that the sequence number of each process described below does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0078] In addition, the terms "system" and "network" are often used interchangeably in this article.
[0079] In the embodiments provided in this application, it should be understood that "B corresponding to A" means that B is associated with A, and B can be determined based on A. However, it should also be understood that determining B based on A does not mean determining B solely based on A; B can also be determined based on A and / or other information.
[0080] For ease of understanding, the following describes some aspects of the embodiments of this application:
[0081] Message queue rate limiting typically occurs when a server faces a huge amount of traffic. It is a degradation measure taken to ensure system availability and security by discarding traffic that cannot be handled and protecting the server through fast failure.
[0082] If instantaneous traffic exceeds a threshold but remains below it for an extended period, rate limiting is unnecessary. Conversely, if rate limiting is in effect and instantaneous traffic exceeds the threshold, but remains above it for an extended period, rate limiting should not be lifted. Therefore, rate limiting strategies that monitor traffic in real-time and control it based on thresholds can be affected by instantaneous traffic fluctuations, leading to drastic traffic volatility. Furthermore, using the same strategy for all systems fails to adapt to different system requirements and cannot fully leverage the advantages of various application systems.
[0083] Recurrent Neural Networks (RNNs) are a type of neural network used to process sequential and temporal data. Unlike traditional feedforward neural networks, RNNs have feedback connections, allowing them to process each element in the sequence while retaining previously processed information. Their key feature is the ability to utilize previous computations to process the current input, thereby capturing temporal information and contextual relationships within the sequential data. Long Short-Term Memory (LSTM) networks are a commonly used feedback neural network architecture that introduces gating mechanisms to better capture and process long-term dependencies.
[0084] RNNs use the output at time t-1 as the input at time t, thus preserving historical information. LSTM is a variant of RNN that introduces a gating mechanism to effectively control the flow of information and the updating of memory. It mainly consists of three gates (Forget Gate, Input Gate, and Output Gate) and a memory cell. The Forget Gate uses the sigmoid activation function to determine which information from the previous time step's cell state needs to be forgotten. The Input Gate determines which information from the current input needs to be added to the Cell state, using the sigmoid activation function to control the information update and the tanh activation function to generate a candidate value vector for updating the Cell state. LSTM can better capture and process long-term dependencies in sequential data, enabling the network to effectively transfer and utilize information across time steps. Furthermore, LSTM is also suitable for predicting time series data. Message queue traffic information is a type of time series data.
[0085] Message traffic typically exhibits certain patterns, showing a periodicity over time. Fully utilizing these patterns can more effectively improve the accuracy of rate limiting, thereby further enhancing system stability and security.
[0086] Message queues typically consist of components such as producers, consumers, and servers. Producers send messages to the server, and consumers pull messages from the server. When the server's processing capacity reaches its limit or the producer's message production rate is too fast for the server to process in time, message backlog will occur on the server, leading to a decrease in system throughput. Message sending requests in high-concurrency systems usually exhibit a regularity over time.
[0087] like Figure 1 As shown, a message flow control method according to an embodiment of this application is executed by a network device and includes:
[0088] Step 11: Obtain the message traffic from the last prediction and the first historical traffic characteristics;
[0089] Step 12: Based on the previously predicted message traffic and the first historical traffic characteristics, predict the target message traffic;
[0090] Step 13: Limit or delimit the rate based on the target message traffic.
[0091] In this embodiment, traffic characteristics are metrics that affect message traffic. Here, the first historical traffic characteristic is the traffic characteristic over a period of time prior to the current time, and it can provide guidance for rate limiting of the message queue. The target message traffic is the message traffic over a future period.
[0092] Thus, the method of this application embodiment takes into account the regularity of message traffic, obtains the previously predicted message traffic and the first historical traffic characteristics, and uses these two to predict the target message traffic, providing a reasonable judgment for rate limiting or de-limiting in the future, ensuring the stability of system traffic, and improving the system throughput.
[0093] It should be noted that there is a certain ratio between the time period corresponding to the first historical traffic feature and the time period corresponding to the target message traffic, such as 720:1. That is, the first historical traffic feature is the traffic feature of the 30 days (30*24 hours) before the current time, and the target message traffic is the traffic feature of the next hour.
[0094] It should also be noted that in this embodiment, the network device is a server, such as a server.
[0095] In this embodiment, traffic characteristics include, but are not limited to, central processing unit (CPU) utilization, memory utilization, network bandwidth utilization, and disk read / write speed. Optionally, CPU utilization, memory utilization, or disk read / write speed can be used as device-side characteristics, and network bandwidth utilization can be used as network-side characteristics.
[0096] In addition, optionally, in this embodiment, predicting the target message traffic based on the previously predicted message traffic and the first historical traffic characteristics includes:
[0097] Input the previously predicted message traffic and the first historical traffic features into the prediction network;
[0098] The output of the prediction network is used as the target message traffic.
[0099] That is, since the prediction network can understand the patterns of message traffic, in order to better predict message traffic, after inputting the previously predicted message traffic and the first historical traffic features obtained in step 11 into the prediction network, the output of the prediction network is used as the target message traffic. For example, if the previously predicted message traffic and the historical traffic features of the previous 30 days are input into the prediction network, the prediction network will output the message traffic for the next hour.
[0100] Optionally, before predicting the target message traffic based on the previously predicted message traffic and the first historical traffic characteristics, the method further includes:
[0101] Obtain the training and validation sets;
[0102] The preset network is trained based on the training set and the validation set to obtain a pre-trained network, and the prediction network is determined based on the pre-trained network.
[0103] In other words, a training set and a validation set are obtained by collecting data. Then, a pre-trained network is trained based on the training set and the validation set to obtain a pre-trained network. The prediction network is then determined based on the pre-trained network. In this way, the pre-trained network can basically grasp the patterns of message traffic.
[0104] For the preset network, its inputs and outputs must first be determined. In this embodiment, considering that it is needed for traffic prediction, the magnitude of message traffic is the output of the preset network. Traffic characteristics affecting message traffic must all be used as feature inputs. Thus, the preset network is implemented as follows:
[0105]
[0106] O(x) represents the output at time t, i.e., the message flow, which can also be understood as the number of messages processed per second (Transactions Per Second, TPS); ω is the weight matrix; x ti h represents the traffic characteristics at time t of network layer i; t-1 This represents the network output at time t-1, which is the previously predicted message flow; b i ω represents the bias of network layer i; n is the number of network layers. Training the pre-defined network involves determining the appropriate ω and b. i .
[0107] Optionally, in this embodiment, determining the prediction network based on the pre-trained network includes:
[0108] The pre-trained network is used as the prediction network;
[0109] or,
[0110] The pre-trained network is adjusted based on the second historical traffic characteristics of the target user, and the adjusted pre-trained network is used as the prediction network.
[0111] That is, on the one hand, the pre-trained network is directly used as the prediction network. At this time, after training, the pre-trained network has learned the pattern of message traffic and can predict message traffic.
[0112] On the other hand, considering the differences in message sending and consumption patterns among different users, the pre-trained network needs to be adjusted based on the target user's second historical traffic characteristics to learn the target user's message sending and receiving patterns. This adjusted pre-trained network then serves as the prediction network, enabling more accurate message traffic prediction and control. One implementation approach is to deploy the pre-trained network alongside the message queue product. In the live network, the target user's second historical traffic characteristics and the target user's previously predicted message traffic are input into the pre-trained network. The output of the pre-trained network and the actual consumption traffic then adjust the pre-trained network accordingly. This dynamically integrates the pre-trained network with the target user's individual patterns, enabling precise flow control for the target user in the future.
[0113] Optionally, in this embodiment, the prediction network is a long short-term memory network.
[0114] Because the traffic characteristics are relatively simple, and considering the high concurrency and high throughput requirements of message queues, LSTM networks should adopt a relatively simple structure. One implementation method is... Figure 2 As shown, a single hidden layer is used.
[0115] Optionally, in this embodiment, obtaining the training set and validation set includes:
[0116] Notify multiple virtual machines with different configurations to execute the target task;
[0117] Collect the target data generated by the target task;
[0118] The data from the first time period in the target data is used as the training set, and the data from the second time period in the target data is used as the validation set.
[0119] Here, different virtual machine configurations are pre-configured to obtain diverse target data. The virtual machines can be configured as one master and one slave, two masters and one slave, or two masters and two slaves, etc. As one implementation method, taking the RocketMQ message queue as an example, the target task is the RocketMQ service. In response to the notification to execute the target task, the virtual machine starts the RocketMQ service. In this way, the network device can collect the target data and further obtain training and validation sets.
[0120] The virtual machine will simulate different traffic characteristics to generate experimental data, such as... Figure 3 As shown (CPU utilization), Figure 4 As shown (memory usage), Figure 5 As shown (disk read / write speed), Figure 6 As shown (network bandwidth utilization). Thus, the target data includes simulated traffic characteristics, the size of message traffic resulting from different traffic characteristics, etc.
[0121] Of course, to ensure the effectiveness of training, a sufficient amount of data is needed. Therefore, after collecting the target data, the least squares method can be used to fit the target data and generate more data to be added to the training set and / or validation set.
[0122] In this embodiment, the data volume parameters for the training set and / or validation set can be preset to obtain the required amount of data to meet training needs. For example, with a data volume parameter of 60,000 (6w), 4*6w training data points are generated based on four traffic characteristics. Adding time-series perturbation data to simulate the data from the previous 32 days yields 32*4*6w data points. Of these, 30*4*6w are used as the training set, and 2*4*6w are used as the validation set.
[0123] Optionally, in this embodiment, training the preset network based on the training set and the validation set to obtain a pre-trained network includes:
[0124] The first data of the training set or the validation set is input into the preset network; wherein, the first data includes the third historical traffic characteristics of the third time period;
[0125] If the mean square error loss between the output of the preset network and the actual message traffic corresponding to the first data is within a specific range, then the pre-trained network is determined.
[0126] If the mean squared error loss of the output of the preset network and the actual message traffic corresponding to the first data is not within the specific range, then the first data is updated, and the updated first data is input into the preset network until the pre-trained network is determined; wherein, the time period corresponding to the fourth historical traffic feature in the updated first data partially overlaps with the third time period, and the start time is after the start time of the third time period.
[0127] That is, during the training process, a pre-trained network is trained based on mean squared error loss to predict message traffic in the future based on historical traffic characteristics.
[0128] For example, during training, the flow rate for the next hour can be predicted based on the first 30 days, resulting in a ratio of 720:1, where 720 is 30 * 24, meaning the output is calculated hourly for 30 days. Figure 7 As shown, the first round of calculation uses CPU utilization, memory utilization, disk read / write speed, network bandwidth utilization, and message traffic data collected from time 0h to 719h. The second round of calculation uses the attribute values from time 1h to 720h, and so on. In this data collection process, message traffic data serves as guiding information; that is, message traffic data is the output data. It is used to adjust the weights and biases in the network during the entire network training process.
[0129] The mean squared error loss (MSE) is calculated as follows:
[0130]
[0131] y i This represents the output of the preset model, o i This represents the actual message flow, where n is the number of output data items.
[0132] As one implementation method, the specific range corresponding to the mean squared error loss can be different for the training set and the validation set data. For example, the specific range of the validation set is smaller than that of the training set.
[0133] Specifically, the pre-trained LSTM-based network is trained as follows:
[0134] Step 1, training data preparation, i.e., obtaining the training set and validation set;
[0135] Step 2: Normalize the training data to the range [0,1].
[0136] Step 3: Input the training set data into the preset LSTM-based network;
[0137] Step 4: If the mean squared error loss is within a specific range, use validation set data to fine-tune the hyperparameters; otherwise, continue training.
[0138] During training, a dropout layer can also be used to prevent overfitting.
[0139] Furthermore, if a set number of training epochs is set, training ends once the epoch is reached, even if the mean squared error loss is not within a specific range. Hyperparameter tuning using validation set data is then necessary; otherwise, training continues. Through training, the output of the preset network can closely approximate actual message traffic, such as... Figure 8 As shown.
[0140] Optionally, in this embodiment, the step of rate limiting or de-rate limiting based on the target message traffic includes:
[0141] Compare the target message traffic with a specific traffic threshold;
[0142] If the target message traffic exceeds the specific traffic threshold, rate limiting will be applied.
[0143] If the target message traffic is less than or equal to the specific traffic threshold, then the flow restriction is lifted.
[0144] In this way, when the target message traffic exceeds the specific traffic threshold, rate limiting is applied, requests are dropped, and server pressure is reduced through fast failure, thus protecting the server and improving system throughput. If the target message traffic is less than or equal to the specific traffic threshold, and rate limiting is currently in effect, rate limiting is lifted. Therefore, even if the instantaneous traffic exceeds the specific traffic threshold, if the predicted message traffic remains below the specific traffic threshold for a future period, rate limiting is not required.
[0145] Optionally, the first historical traffic feature, the second historical traffic feature, the third historical traffic feature, or the fourth historical traffic feature includes:
[0146] Central processing unit (CPU) utilization, memory utilization, network bandwidth utilization, and disk read / write speed.
[0147] Thus, based on the correlation between message traffic and CPU utilization, memory utilization, network bandwidth utilization, and disk read / write speed, the system can learn the causal relationship between message traffic and the aforementioned information. The patterns within this relationship are general, allowing for a deeper understanding of the factors influencing traffic changes. Furthermore, it can learn the impact of CPU utilization, memory utilization, network bandwidth utilization, and disk read / write speed on message traffic, thereby possessing learning capabilities and enabling more reasonable rate limiting and de-limiting.
[0148] In summary, the method of this application embodiment can predict message traffic over future time periods, avoid the impact of instantaneous traffic, and accurately determine when instantaneous traffic is higher or lower than a threshold, thus ensuring the stability of application system traffic. Furthermore, it can predict message queue traffic based on historical traffic characteristics and learn the patterns of traffic changes with the environment, enabling more accurate predictions.
[0149] like Figure 9 As shown in the figure, a message flow control device according to an embodiment of this application includes:
[0150] The first acquisition module 91 is used to acquire the message traffic of the previous prediction and the first historical traffic characteristics;
[0151] The first processing module 92 is used to predict the target message traffic based on the previously predicted message traffic and the first historical traffic characteristics;
[0152] The second processing module 93 is used to limit or delimit the flow of the target message traffic.
[0153] Optionally, the first processing module includes:
[0154] The first processing submodule is used to input the previously predicted message traffic and the first historical traffic features into the prediction network;
[0155] The second processing submodule is used to take the output of the prediction network as the target message traffic.
[0156] Optionally, the device further includes:
[0157] The second acquisition module is used to acquire the training set and the validation set;
[0158] The training module is used to train a preset network based on the training set and the validation set to obtain a pre-trained network, and to determine the prediction network based on the pre-trained network.
[0159] Optionally, the device further includes:
[0160] The third processing module is used to use the pre-trained network as the prediction network;
[0161] or,
[0162] The pre-trained network is adjusted based on the second historical traffic characteristics of the target user, and the adjusted pre-trained network is used as the prediction network.
[0163] Optionally, the first acquisition module is further configured to:
[0164] Notify multiple virtual machines with different configurations to execute the target task;
[0165] Collect the target data generated by the target task;
[0166] The data from the first time period in the target data is used as the training set, and the data from the second time period in the target data is used as the validation set.
[0167] Optionally, the training module is further configured to:
[0168] The first data of the training set or the validation set is input into the preset network; wherein, the first data includes the third historical traffic characteristics of the third time period;
[0169] If the mean square error loss between the output of the preset network and the actual message traffic corresponding to the first data is within a specific range, then the pre-trained network is determined.
[0170] If the mean squared error loss of the output of the preset network and the actual message traffic corresponding to the first data is not within the specific range, then the first data is updated, and the updated first data is input into the preset network until the pre-trained network is determined; wherein, the time period corresponding to the fourth historical traffic feature in the updated first data partially overlaps with the third time period, and the start time is after the start time of the third time period.
[0171] Optionally, the first historical traffic feature, the second historical traffic feature, the third historical traffic feature, or the fourth historical traffic feature may each include:
[0172] Central processing unit (CPU) utilization, memory utilization, network bandwidth utilization, and disk read / write speed.
[0173] Optionally, the prediction network is a long short-term memory network.
[0174] It should be noted that the device uses the above-mentioned message flow control method, and the implementation of the above method embodiment is applicable to this device and can achieve the same technical effect.
[0175] like Figure 10 As shown, a network device 1000 according to an embodiment of this application includes a processor 1010, wherein the processor is used for:
[0176] Obtain the message traffic from the last predicted message traffic and the first historical traffic characteristics;
[0177] Based on the previously predicted message traffic and the first historical traffic characteristics, predict the target message traffic;
[0178] Rate limiting or de-rate limiting is performed based on the target message traffic.
[0179] Optionally, the processor is further configured to:
[0180] Input the previously predicted message traffic and the first historical traffic features into the prediction network;
[0181] The output of the prediction network is used as the target message traffic.
[0182] Optionally, the processor is further configured to:
[0183] Obtain the training and validation sets;
[0184] The preset network is trained based on the training set and the validation set to obtain a pre-trained network, and the prediction network is determined based on the pre-trained network.
[0185] Optionally, the processor is further configured to:
[0186] The pre-trained network is used as the prediction network;
[0187] or,
[0188] The pre-trained network is adjusted based on the second historical traffic characteristics of the target user, and the adjusted pre-trained network is used as the prediction network.
[0189] Optionally, the processor is further configured to:
[0190] Notify multiple virtual machines with different configurations to execute the target task;
[0191] Collect the target data generated by the target task;
[0192] The data from the first time period in the target data is used as the training set, and the data from the second time period in the target data is used as the validation set.
[0193] Optionally, the processor is further configured to:
[0194] The first data of the training set or the validation set is input into the preset network; wherein, the first data includes the third historical traffic characteristics of the third time period;
[0195] If the mean square error loss between the output of the preset network and the actual message traffic corresponding to the first data is within a specific range, then the pre-trained network is determined.
[0196] If the mean squared error loss of the output of the preset network and the actual message traffic corresponding to the first data is not within the specific range, then the first data is updated, and the updated first data is input into the preset network until the pre-trained network is determined; wherein, the time period corresponding to the fourth historical traffic feature in the updated first data partially overlaps with the third time period, and the start time is after the start time of the third time period.
[0197] Optionally, the first historical traffic feature, the second historical traffic feature, the third historical traffic feature, or the fourth historical traffic feature may each include:
[0198] Central processing unit (CPU) utilization, memory utilization, network bandwidth utilization, and disk read / write speed.
[0199] Optionally, the prediction network is a long short-term memory network.
[0200] The network device also includes a transceiver 1020 for receiving and sending data under the control of the processor 1010.
[0201] Another embodiment of the network device in this application, such as Figure 11As shown, it includes a transceiver 1110, a processor 1100, a memory 1120, and a program or instructions stored in the memory 1120 and executable on the processor 1100; when the processor 1100 executes the program or instructions, it implements the above-described message flow control method.
[0202] The transceiver 1110 is used to receive and send data under the control of the processor 1100.
[0203] Among them, Figure 11 In this context, the bus architecture may include any number of interconnected buses and bridges, specifically linking various circuits together, represented by one or more processors (processor 1100) and memory (memory 1120). The bus architecture may also link together various other circuits such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and therefore will not be described further herein. The bus interface provides an interface. The transceiver 1110 may be multiple elements, including transmitters and receivers, providing a unit for communicating with various other devices over a transmission medium. The processor 1100 is responsible for managing the bus architecture and general processing, and the memory 1120 may store data used by the processor 1100 during operation.
[0204] This application provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the steps in the message flow control method described above and achieve the same technical effect. To avoid repetition, this will not be repeated here.
[0205] The processor mentioned above is the processor in the network device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0206] This application also provides a computer program product, including computer instructions, which, when executed by a processor, implement the above-described... Figure 1 The various processes of the method embodiments shown can achieve the same technical effect, and will not be described again here to avoid repetition.
[0207] It should be further noted that many of the functional components described in this specification are referred to as modules in order to emphasize the independence of their implementation.
[0208] In this embodiment, the module can be implemented in software so that it can be executed by various types of processors. For example, an identified executable code module may include one or more physical or logical blocks of computer instructions, which may be constructed as objects, procedures, or functions. Nevertheless, the executable code of the identified module does not need to be physically located together, but may include different instructions stored in different bits, which, when logically combined, constitute the module and achieve the module's intended purpose.
[0209] In practice, an executable code module can be a single instruction or many instructions, and can even be distributed across multiple different code segments, different programs, and across multiple memory devices. Similarly, operational data can be identified within the module and can be implemented in any suitable form and organized within any suitable type of data structure. This operational data can be collected as a single dataset or distributed across different locations (including different storage devices), and can exist, at least in part, solely as electronic signals within the system or network.
[0210] When a module can be implemented using software, considering the current level of hardware technology, modules that can be implemented in software can be implemented using hardware circuits by those skilled in the art to achieve the corresponding functions, without considering cost. These hardware circuits include conventional very-large-scale integrated circuits (VLSI) or gate arrays, as well as existing semiconductors such as logic chips and transistors, or other discrete components. Modules can also be implemented using programmable hardware devices, such as field-programmable gate arrays, programmable array logic, and programmable logic devices.
[0211] The exemplary embodiments described above are with reference to the accompanying drawings. Many different forms and embodiments are feasible without departing from the spirit and teachings of this application. Therefore, this application should not be construed as limiting the exemplary embodiments set forth herein. Rather, these exemplary embodiments are provided to make this application complete and convey the scope of this application to those skilled in the art. In these drawings, component dimensions and relative dimensions may be exaggerated for clarity. The terminology used herein is for the purpose of describing particular exemplary embodiments only and is not intended to be limiting. As used herein, unless clearly indicated otherwise, the singular forms “a,” “an,” and “the” are intended to include all such forms. It will be further understood that the terms “comprising” and / or “including”, when used in this specification, indicate the presence of the stated features, integers, steps, operations, components, and / or elements, but do not exclude the presence or addition of one or more other features, integers, steps, operations, components, and / or groups thereof. Unless otherwise indicated, when stated, a range of values includes the upper and lower limits of the range and any subranges in between.
[0212] The above description is the preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principles described in this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A message flow control method, characterized in that, Performed by network devices, including: Obtain the message traffic from the last predicted message traffic and the first historical traffic characteristics; Based on the previously predicted message traffic and the first historical traffic characteristics, predict the target message traffic; Rate limiting or de-rate limiting is performed based on the target message traffic; The first historical traffic characteristics include: Central processing unit (CPU) utilization, memory utilization, network bandwidth utilization, and disk read / write speed.
2. The method according to claim 1, characterized in that, The step of predicting the target message traffic based on the previously predicted message traffic and the first historical traffic characteristics includes: Input the previously predicted message traffic and the first historical traffic features into the prediction network; The output of the prediction network is used as the target message traffic.
3. The method according to claim 2, characterized in that, Before predicting the target message traffic based on the previously predicted message traffic and the first historical traffic characteristics, the method further includes: Obtain the training and validation sets; The preset network is trained based on the training set and the validation set to obtain a pre-trained network, and the prediction network is determined based on the pre-trained network.
4. The method according to claim 3, characterized in that, Determining the prediction network based on the pre-trained network includes: The pre-trained network is used as the prediction network; or, The pre-trained network is adjusted based on the second historical traffic characteristics of the target user, and the adjusted pre-trained network is used as the prediction network.
5. The method according to claim 3 or 4, characterized in that, The acquisition of the training set and validation set includes: Notify multiple virtual machines with different configurations to execute the target task; Collect the target data generated by the target task; The data from the first time period in the target data is used as the training set, and the data from the second time period in the target data is used as the validation set.
6. The method according to claim 3 or 4, characterized in that, The step of training a preset network based on the training set and the validation set to obtain a pre-trained network includes: The first data of the training set or the validation set is input into the preset network; wherein, the first data includes the third historical traffic characteristics of the third time period; If the mean square error loss between the output of the preset network and the actual message traffic corresponding to the first data is within a specific range, then the pre-trained network is determined. If the mean squared error loss of the output of the preset network and the actual message traffic corresponding to the first data is not within the specific range, then the first data is updated, and the updated first data is input into the preset network until the pre-trained network is determined; wherein, the time period corresponding to the fourth historical traffic feature in the updated first data partially overlaps with the third time period, and the start time is after the start time of the third time period.
7. The method according to claim 6, characterized in that, The second, third, or fourth historical flow characteristics all include: Central processing unit (CPU) utilization, memory utilization, network bandwidth utilization, and disk read / write speed.
8. The method according to claim 2, characterized in that, The prediction network is a long short-term memory network.
9. A message flow control device, characterized in that, include: The first acquisition module is used to acquire the message traffic of the previous prediction and the first historical traffic characteristics; The first processing module is used to predict the target message traffic based on the previously predicted message traffic and the first historical traffic characteristics; The second processing module is used to limit or delimit the flow of the target message traffic. The first historical traffic characteristics include: Central processing unit (CPU) utilization, memory utilization, network bandwidth utilization, and disk read / write speed.
10. A network device, characterized in that, Includes a processor, the processor being used for: Obtain the message traffic from the last predicted message traffic and the first historical traffic characteristics; Based on the previously predicted message traffic and the first historical traffic characteristics, predict the target message traffic; Rate limiting or de-rate limiting is performed based on the target message traffic; The first historical traffic characteristics include: Central processing unit (CPU) utilization, memory utilization, network bandwidth utilization, and disk read / write speed.
11. A network device, comprising: A transceiver, a processor, a memory, and a program or instructions stored in the memory and executable on the processor; characterized in that, when the processor executes the program or instructions, it implements the message flow control method as described in any one of claims 1-8.
12. A readable storage medium having a program or instructions stored thereon, characterized in that, When the program or instructions are executed by the processor, they implement the steps in the message flow control method as described in any one of claims 1-8.
13. A computer program product, characterized in that, It includes computer instructions that, when executed by a processor, implement the steps of the message flow control method as described in any one of claims 1-8.
Citation Information
Patent Citations
Training method and device for fault prediction neural network model
CN112115024A
Load balancing method and device for heterogeneous network, equipment, storage medium and product
CN118869605A