Data compensation method and device, storage medium and program product
By acquiring a set of data packet features and using a predictive model to adjust the data compensation strategy, the problem of low network transmission efficiency was solved, and efficient and reliable data transmission was achieved in changing network environments.
Patent Information
- Application Number
- CN202411487556.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2044-10-23
AI Technical Summary
Existing network transmission methods are not effective at compensating for changes in the network environment, resulting in low network transmission efficiency.
By acquiring the feature set of data packets, the packet loss rate is predicted using a predictive model. Based on the packet loss rate and the preset packet loss rate, the data compensation strategy is dynamically adjusted, including adjusting the retransmission timeout, the number of retransmissions, and the redundancy, to adapt to different network environments.
It improves the efficiency and reliability of data transmission, ensuring stable data transmission in dynamic network environments.
Smart Images

Figure CN119519898B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data transmission technology, and more specifically, to a data compensation method and apparatus, storage medium, and program product. Background Technology
[0002] During network transmission, data packets may be lost on their way from the sender to the receiver; this is known as packet loss. Packet loss impacts network communication performance. A high packet loss rate can lead to increased overall latency, decreased throughput, stuttering, intermittent connections, degraded application performance, and a compromised user experience.
[0003] Therefore, in the event of network packet loss, packet loss compensation techniques are needed to retransmit lost data packets or recover lost data packets to improve network stability and quality of service. However, current technologies typically employ a single network compensation method, which proves ineffective in the face of changing network environments.
[0004] There is currently no effective solution to the problem of low efficiency in existing network transmission methods. Summary of the Invention
[0005] This application provides a data compensation method and apparatus, storage medium and program product to at least solve the technical problem of low efficiency in current network transmission methods in related technologies.
[0006] According to one embodiment of this application, a data compensation method is provided, comprising: obtaining a first feature set of data packets transmitted within a first time period, wherein the first feature set is used to indicate attribute information of data packets transmitted within the first time period; inputting the first feature set into a prediction model to obtain a first packet loss rate, wherein the first packet loss rate is used to indicate the packet loss rate of data packets within a second time period; and determining a target data compensation strategy corresponding to the second time period based on the first packet loss rate and a preset packet loss rate.
[0007] In one exemplary embodiment, determining the data compensation strategy corresponding to the second time period based on the first packet loss rate and the preset packet loss rate includes: when the first packet loss rate is greater than the preset packet loss rate and the data compensation strategy corresponding to the current time is the first data compensation strategy, adjusting the first data compensation strategy to the second data compensation strategy and determining the second data compensation strategy as the target data compensation strategy; when the first packet loss rate is less than the preset packet loss rate and the data compensation strategy corresponding to the current time is the second data compensation strategy, adjusting the second data compensation strategy to the first data compensation strategy and determining the first data compensation strategy as the target data compensation strategy.
[0008] In an exemplary embodiment, the above-mentioned determination of the data compensation strategy corresponding to the second time period based on the first packet loss rate and the preset packet loss rate includes: updating the retransmission timeout of the first data compensation strategy based on the preset time and the first packet loss rate; and updating the retransmission count of the first data compensation strategy based on the preset number of times and the first packet loss rate.
[0009] In an exemplary embodiment, the above-mentioned determination of the data compensation strategy corresponding to the second time period based on the first packet loss rate and the preset packet loss rate includes: updating the redundancy of the second data compensation strategy based on the first packet loss rate.
[0010] In an exemplary embodiment, obtaining the first feature set of data packets transmitted within a first time period includes at least one of the following: obtaining a first information set of data packets transmitted within the first time period and processing the first information set to obtain a first feature set; determining the mean, variance, and standard deviation of the data packets transmitted within the first time period based on the first information set, and determining the mean, variance, and standard deviation as the first feature set; determining the packet loss rate of the first time period, and determining the packet loss rate of the first time period as the first feature set.
[0011] In one exemplary embodiment, obtaining the first information set of data packets transmitted within a first time period includes: determining the first information set of data packets transmitted within the first time period at a network interface; storing the first information set in a log file; and retrieving the first information set from the log file.
[0012] In an exemplary embodiment, the above-mentioned inputting the first feature set into the prediction model to obtain the first packet loss rate includes: inputting the first feature set into the input layer of the prediction model; obtaining a second feature set through the hidden layer of the prediction model; performing a nonlinear transformation on the second feature set to obtain the first packet loss rate.
[0013] In an exemplary embodiment, the training process of the above-mentioned prediction model includes: determining a target parameter set for the prediction model; determining a prediction model to be trained based on the target parameter set; and training the prediction model to be trained to obtain the prediction model.
[0014] In an exemplary embodiment, determining the target parameter set of the prediction model includes: obtaining an initial parameter set of the prediction model; training an initial prediction model corresponding to the initial parameter set and determining the fitness of the initial prediction model; performing p iterations on the initial parameter set: in the first iteration, determining the initial parameter set as the first parameter set and updating the second parameter set using the first parameter set; training the prediction model corresponding to the second parameter set and determining the fitness of the prediction model corresponding to the second parameter set; determining the parameter set corresponding to the larger value between the fitness of the initial prediction model and the fitness of the prediction model corresponding to the second parameter set as the optimal parameter set. The optimal parameter set is determined based on the optimal parameter set and the q-th parameter set in the q-th iteration. The fitness of the prediction model corresponding to the q+1 parameter set is also determined. The parameter set corresponding to the larger value among the fitness of the initial prediction model and the fitness of the prediction models corresponding to the 2nd to q+1th parameter sets is updated as the optimal parameter set. If the fitness of the prediction model corresponding to the t-th parameter set is greater than the preset fitness threshold or q equals p, the optimal parameter set is determined as the target parameter set, where p is an integer greater than 0, q is an integer greater than 0 and less than or equal to p, and t is an integer greater than 0 and less than or equal to p.
[0015] According to another embodiment of this application, a data compensation device is provided, comprising: a first acquisition module, configured to acquire a first feature set of data packets transmitted within a first time period, wherein the first feature set is used to indicate attribute information of the data packets transmitted within the first time period; a prediction module, configured to input the first feature set into a prediction model to obtain a first packet loss rate, wherein the first packet loss rate is used to indicate the packet loss rate of data packets within a second time period; and a strategy determination module, configured to determine a target data compensation strategy corresponding to the second time period based on the first packet loss rate and a preset packet loss rate.
[0016] According to yet another embodiment of this application, a computer-readable storage medium is also provided, wherein a computer program is stored therein, and the computer program is configured to perform the steps in any of the above method embodiments when it is run.
[0017] According to yet another embodiment of this application, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0018] This application obtains a first feature set of data packets transmitted within a first time period, wherein the first feature set indicates the attribute information of the data packets transmitted within the first time period; the first feature set is input into a prediction model to obtain a first packet loss rate, wherein the first packet loss rate indicates the packet loss rate of data packets within a second time period; based on the first packet loss rate and a preset packet loss rate, a target data compensation strategy corresponding to the second time period is determined. The packet loss rate of the second time period can be predicted based on the characteristics of the data packets monitored in real time, and a data compensation strategy can be determined based on the packet loss rate to adapt to different network environments and ensure high efficiency and reliability of data transmission. This solves the technical problem of low efficiency in current network transmission methods in related technologies. Attached Figure Description
[0019] Figure 1 This is a hardware structure block diagram of an optional data compensation method according to an embodiment of this application;
[0020] Figure 2 This is a flowchart of an optional data compensation method according to an embodiment of this application;
[0021] Figure 3 This is a schematic diagram of an optional data compensation method according to an embodiment of this application;
[0022] Figure 4 This is a schematic diagram of another optional data compensation method according to an embodiment of this application;
[0023] Figure 5 This is a schematic diagram of another optional data compensation method according to an embodiment of this application;
[0024] Figure 6 This is a structural block diagram of an optional data compensation device according to an embodiment of this application. Detailed Implementation
[0025] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0026] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0027] According to one aspect of the embodiments of this application, a data compensation method is provided. As an optional implementation, the above-described data compensation method can be applied to, but is not limited to, [examples of other methods]. Figure 1 The data compensation system in the hardware environment shown may include, but is not limited to, terminal device 102, network 110, server 112, and database 114. Terminal device 102 runs a target client. Terminal device 102 includes a display 108, processor 106, and memory 104. Display 108 provides a human-computer interaction interface to receive human-computer interaction operations. The processor generates interaction instructions in response to the human-computer interaction operations and sends these instructions to the server. The memory stores data.
[0028] In addition, server 112 includes processing engine 116, which is used to perform store or read operations on database 114. Specifically, processing engine 116 reads data and data characteristics from database 114.
[0029] Assumption Figure 1 The terminal device 102 runs a client for data interaction. The specific process in this embodiment is as follows: In step S102, the terminal device 102 can transmit data packets with the server 112 via network 110. Then, step S104 is executed to obtain a first feature set of data packets transmitted within a first time period. The server 112 then executes step S106 to input the first feature set into a prediction model to obtain a first packet loss rate. Finally, step S108 is executed to determine the target data compensation strategy.
[0030] Optionally, in this embodiment, the terminal device 102 can be a terminal device configured with a target client, which may include, but is not limited to, at least one of the following: mobile phone (such as Android phone, iOS phone, etc.), laptop computer, tablet computer, PDA, MID (Mobile Internet Devices), PAD, desktop computer, smart TV, etc. The target client can be a video client, browser client, or other client that supports providing data compensation tasks. The network may include, but is not limited to, wired networks and wireless networks. The wired network includes local area networks (LANs), metropolitan area networks (MANs), and wide area networks (WANs). The wireless network includes Bluetooth, Wi-Fi, and other networks that enable wireless communication. The server may be a single server, a server cluster consisting of multiple servers, or a cloud server. The above is merely an example, and no limitation is made in this embodiment.
[0031] This application obtains a first feature set of data packets transmitted within a first time period, wherein the first feature set indicates the attribute information of the data packets transmitted within the first time period; the first feature set is input into a prediction model to obtain a first packet loss rate, wherein the first packet loss rate indicates the packet loss rate of data packets within a second time period; based on the first packet loss rate and a preset packet loss rate, a target data compensation strategy corresponding to the second time period is determined. The packet loss rate of the second time period can be predicted based on the characteristics of the data packets monitored in real time, and a data compensation strategy can be determined based on the packet loss rate to adapt to different network environments and ensure high efficiency and reliability of data transmission. This solves the technical problem of low efficiency in current network transmission methods in related technologies.
[0032] This embodiment provides a data compensation method. Figure 2 This is a flowchart of an optional data compensation method according to an embodiment of this application, such as... Figure 2 As shown, the data compensation method includes:
[0033] Step S202: Obtain a first feature set of data packets transmitted within a first time period, wherein the first feature set is used to indicate the attribute information of data packets transmitted within the first time period;
[0034] It should be noted that the first feature set can be features obtained after processing the data packet, or information obtained when acquiring the data packet.
[0035] Step S204: Input the first feature set into the prediction model to obtain the first packet loss rate, wherein the first packet loss rate is used to indicate the packet loss rate of data packets in the second time period;
[0036] It should be noted that the prediction model is a pre-trained model that can predict packet loss rate, and its input is the characteristics of the data packets.
[0037] Step S206: Based on the first packet loss rate and the preset packet loss rate, determine the target data compensation strategy corresponding to the second time period.
[0038] It should be noted that the preset packet loss rate can be set as needed, and the data compensation strategy to be used in the future can be determined based on the first packet loss rate and the preset packet loss rate. The packet loss rate refers to the proportion of data packets lost within a specific time period to the total number of data packets sent.
[0039] This application obtains a first feature set of data packets transmitted within a first time period, wherein the first feature set indicates the attribute information of the data packets transmitted within the first time period; the first feature set is input into a prediction model to obtain a first packet loss rate, wherein the first packet loss rate indicates the packet loss rate of data packets within a second time period; based on the first packet loss rate and a preset packet loss rate, a target data compensation strategy corresponding to the second time period is determined. The packet loss rate of the second time period can be predicted based on the characteristics of the data packets monitored in real time, and a data compensation strategy can be determined based on the packet loss rate to adapt to different network environments and ensure high efficiency and reliability of data transmission. This solves the technical problem of low efficiency in current network transmission methods in related technologies.
[0040] In an optional implementation, the above-mentioned determination of the data compensation strategy corresponding to the second time period based on the first packet loss rate and the preset packet loss rate includes: when the first packet loss rate is greater than the preset packet loss rate and the data compensation strategy corresponding to the current time is the first data compensation strategy, adjusting the first data compensation strategy to the second data compensation strategy and determining the second data compensation strategy as the target data compensation strategy; when the first packet loss rate is less than the preset packet loss rate and the data compensation strategy corresponding to the current time is the second data compensation strategy, adjusting the second data compensation strategy to the first data compensation strategy and determining the first data compensation strategy as the target data compensation strategy.
[0041] In an optional implementation, the target data compensation strategy can be set as the first data compensation strategy in the initial state of the network. The initial state of the network can be under good network conditions, such as low packet loss rate and low latency. The first data compensation strategy can utilize a retransmission mechanism. Automatic Repeat Request (ARQ) is an error correction protocol used by the data link layer and transport layer to ensure the reliability of data transmission. If the sender does not receive an acknowledgment from the receiver within a certain period of time, it assumes that the data packet was lost or corrupted during transmission and retransmits the data packet.
[0042] In an alternative implementation, when network conditions are good, such as a low packet loss rate, the problem can be solved by requesting retransmission. The retransmission mechanism can determine whether lost data packets can be retransmitted. However, when the network packet loss rate is high or there is significant network latency, using the first data compensation strategy may result in low performance. Therefore, when the packet loss rate is high, the first data compensation strategy can be switched to a second data compensation strategy.
[0043] In an optional implementation, the second data compensation strategy can be forward error correction (FEC), a technique used to improve reliability in data transmission. It enables the receiving end to detect and recover lost data packets without retransmission by sending additional redundant data (encoded packets).
[0044] In an alternative implementation, forward error correction consumes more bandwidth resources because it requires transmitting additional redundant information. Therefore, when the network packet loss rate is low, the second data compensation strategy can be switched to the first data compensation strategy.
[0045] In an optional implementation, the packet loss rate of the network can be determined by a preset packet loss rate. It can be considered that if the current packet loss rate of the network is greater than the preset packet loss rate, the packet loss rate of the network is relatively large, and if it is less than or equal to the preset packet loss rate, the packet loss rate of the network is relatively small.
[0046] The embodiments described above in this application compare the predicted first packet loss rate with a preset packet loss rate to determine the future network environment state. Based on the predicted network state, an appropriate data compensation strategy is selected to dynamically adjust the packet loss recovery strategy according to the real-time monitored network state, adapting to different networks. This improves the efficiency and reliability of data transmission.
[0047] In an optional implementation, the above-mentioned determination of the data compensation strategy corresponding to the second time period based on the first packet loss rate and the preset packet loss rate includes: updating the retransmission timeout of the first data compensation strategy based on the preset time and the first packet loss rate; and updating the retransmission count of the first data compensation strategy based on the preset number of times and the first packet loss rate.
[0048] In an optional implementation, the above-mentioned determination of the data compensation strategy corresponding to the second time period based on the first packet loss rate and the preset packet loss rate includes: updating the redundancy of the second data compensation strategy based on the first packet loss rate.
[0049] In an optional implementation, if the data compensation strategy does not need to be changed, the parameters of the first and second data compensation strategies can be adjusted. For example, the parameters of the first data compensation strategy may include retransmission timeout time and the number of retransmissions. The sending end starts a timer after sending a data packet. If no acknowledgment is received within the specified time, the data packet will be retransmitted. This time is the timeout period. The TCP implementation sets a maximum retransmission limit. If this limit is reached, TCP may abandon retransmission and report an error. This limit value can be adjusted through configuration parameters to adapt to different network environments and application requirements.
[0050] In an optional implementation, the retransmission timeout can be adjusted according to the packet loss rate, as shown in the following formula:
[0051] T timeout =T base ×(1+k×P)
[0052] Among them, T timeout This is the retransmission timeout period. base This is the basic timeout. `k` is an adjustment factor reflecting the impact of packet loss rate on the timeout. `P` is the initial packet loss rate (a value between 0 and 1). The basic timeout and adjustment factor can be set.
[0053] In an optional implementation, the number of retransmissions can be adjusted according to the packet loss rate, as shown in the following formula:
[0054] N retries =max(N) min ,ceil(α·P))
[0055] Where, N retries It is the maximum number of retransmissions, N. min This is the minimum number of retransmissions set, α is an adjustment factor related to the packet loss rate, P is the first packet loss rate (a value between 0 and 1), and ceil() is the floor function. The minimum number of retransmissions and the adjustment factor can be set.
[0056] In optional implementations, the parameters of the second data compensation strategy may have redundancy. FEC (Forward Error Correction) redundancy refers to the proportion of extra encoded data added to the original data to achieve error detection and correction. In practical applications, selecting an appropriate redundancy requires balancing error correction capability and bandwidth utilization. For example, in bandwidth-constrained environments, a lower redundancy may be chosen to reduce bandwidth consumption, even if this means sacrificing some error correction capability. Conversely, in bandwidth-sufficient environments, a higher redundancy can be chosen to improve error correction capability.
[0057] In an optional implementation, the redundancy can be adjusted according to the packet loss rate, as shown in the following formula:
[0058]
[0059] Where R is redundancy and P is the first packet loss rate (a value between 0 and 1).
[0060] In an optional implementation, when switching between the first data compensation strategy and the second data compensation strategy, the above parameters can be gradually adjusted to achieve a smooth transition between different strategies.
[0061] Figure 3 This is a schematic diagram of an optional data compensation method according to an embodiment of this application. In the case of unknown network conditions or reloading methods, the data compensation strategy can be initialized, defaulting to a first data compensation strategy (retransmission mechanism). After acquiring data for the first time period of the current network, a prediction model can be used to predict the network conditions for the second time period, such as predicting the packet loss rate to obtain a first packet loss rate. After determining the first packet loss rate, the predicted first packet loss rate can be compared with a preset packet loss rate (threshold). If the first packet loss rate is greater than the preset packet loss rate, the target data compensation strategy is determined to be the second data compensation strategy (forward error correction); if the first packet loss rate is less than the preset packet loss rate, the target data compensation strategy is determined to be the first data compensation strategy. The current data compensation strategy is then considered to determine whether to switch the data compensation strategy. If the current data compensation strategy and the target data compensation strategy are consistent, there is no need to switch the data compensation strategy; the current strategy can continue, and the parameters of the current target data compensation strategy can be updated based on the predicted first packet loss rate. If the current data compensation strategy and the target data compensation strategy are inconsistent, the current data compensation strategy needs to be switched to the target data compensation strategy. During the switching process, the parameters of the first or second data compensation strategy can be gradually changed to achieve a smooth transition. Once the target data compensation strategy is determined, it can be used in the current network state.
[0062] Through the above-described embodiments of this application, a data compensation strategy can be determined based on the predicted first packet loss rate. If the data compensation strategy remains unchanged, its parameters can be updated to better adapt to the current network environment. If the data compensation strategy changes, a smooth strategy switch can be achieved by gradually changing the parameters. This maintains service stability while improving data transmission efficiency.
[0063] In an optional implementation, obtaining the first feature set of data packets transmitted within the first time period includes at least one of the following: obtaining a first information set of data packets transmitted within the first time period, and processing the first information set to obtain a first feature set; determining the mean, variance, and standard deviation of the data packets transmitted within the first time period based on the first information set, and defining the mean, variance, and standard deviation as the first feature set; determining the packet loss rate of the first time period, and defining the packet loss rate of the first time period as the first feature set.
[0064] In an optional implementation, the above-mentioned acquisition of the first information set of data packets transmitted within the first time period includes: determining the first information set of data packets transmitted within the first time period at the network interface; storing the first information set in a log file; and retrieving the first information set from the log file.
[0065] It should be noted that the first set of information may include the source IP address, destination IP address, port, and size information of data packets within the first time period.
[0066] In an optional implementation, kernel-level network traffic monitoring and collection can be achieved using Extended Berkeley Packet Filter (eBPF) technology. The kernel space manages and processes the sending and receiving of network packets. When a packet arrives at the kernel's network protocol stack, the kernel attempts to pass the packet to the user-space application. User-space applications typically interact with the kernel space's network protocol stack through socket interfaces. When an application sends data, the data is passed to the kernel space, which then handles the transmission over the network. When receiving data, the kernel passes the packet to the user-space application. User space and kernel space are two main parts of the operating system architecture.
[0067] In an alternative implementation, an eBPF program can be written that may include the following components: defining a map to store counters, for example, a map to count TCP and UDP packets separately; code hooking onto the input and output paths, using BPF instructions to capture packets entering and leaving the network interface; checking the packet type, distinguishing between TCP and UDP packets, and updating the corresponding counters; extracting the source IP address, destination IP address, port, and size information of the packets, and processing or logging them as needed. Packet loss events can be detected by analyzing packet sequence numbers and their TCP / UDP fields. For example, if the sequence number of a TCP packet does not match the expected sequence number, or if packets with the same sequence number are received consecutively, it may indicate that packet loss has occurred.
[0068] In an optional implementation, `bpf_perf_event_output` or `bpf_map_update_elem` can be used to transfer data from the kernel to user space. The source IP address, destination IP address, port, and size information of each extracted packet can be stored in a map or sent to user space via `bpf_perf_event_output()`. `bpf_map_update_elem` can be used to update the eBPF map, a data structure that shares data between kernel space and user space.
[0069] In an alternative implementation, data collected by an eBPF program can be accessed in user space via the bpf system call or the libbpf library. User space can process the data read from the eBPF mapping, such as analyzing, filtering, or aggregating it. The processed data is then written to a log file to obtain a first set of information using standard file I / O operations.
[0070] In an optional implementation, after obtaining the first information set, data preprocessing can be performed. This includes checking for and removing duplicate data: databases or data processing tools (such as SQL, Pandas, etc.) can be used to identify and delete duplicate records. Missing values can also be handled; for numerical data, statistical methods such as mean, median, mode, or linear interpolation can be used to fill in missing values. If there are many missing values or interpolation cannot be performed reasonably, records containing missing values can be deleted. Data formats can also be standardized, such as converting timestamps to a standard time format, and regular expressions or string processing functions can be used to format IP addresses and ports. After data preprocessing, the updated first information set can be determined as the first feature set.
[0071] In an optional implementation, data packets can be grouped according to time windows and network interfaces, and the mean, variance, and standard deviation of the data packet size corresponding to each time window or each network interface can be calculated. A network interface is the connection point between a computer and a network, allowing the computer to send and receive data. In network monitoring, data packets can be captured on specific network interfaces to analyze network traffic passing through that interface. A time window is a period of time used to define the range of data for analysis within a specific time period. The mean, variance, and standard deviation of the data packet size corresponding to each time window or each network interface can be used as the first feature set.
[0072] In an optional implementation, the packet loss rate within a specified time window can be calculated. A time window can be defined: the length of each time window can be determined, for example, 5 seconds, 10 seconds, or 1 minute. The number of sliding windows, N, is determined to determine how many time windows' packet loss rates are tracked simultaneously. N sliding windows are created, each window used to track packet loss within a specific time period. A counter can be set for each window to record the number of lost packets and the total number of packets sent within that window. During data transmission, each sent data packet is tracked and recorded in the corresponding time window. When a data packet is acknowledged as received, the received packet counter for the corresponding window is updated. If no acknowledgment is received after a timeout, it is considered a lost packet, and the packet loss counter for the corresponding window is updated. Whenever a new data packet arrives, the oldest window is slid forward (i.e., the oldest data is discarded), and the new data packet is added to the latest window. The packet loss rate for each window is updated and calculated using the formula: Packet Loss Rate = (Number of Lost Packets / Total Number of Sends) × 100%. The packet loss rate corresponding to the first time period can be determined as the first characteristic.
[0073] Through the above-described embodiments of this application, real-time monitoring of network traffic and precise counting of data packets are achieved using kernel-level monitoring technology to ensure data transmission to user space. Data packets within the first time period are processed and analyzed to extract key features, forming a first feature set to provide high-quality input to the model and improve prediction accuracy. This allows for better adjustment of data compensation strategies.
[0074] In an optional implementation, the above-mentioned inputting the first feature set into the prediction model to obtain the first packet loss rate includes: inputting the first feature set into the input layer of the prediction model; obtaining the second feature set through the hidden layer of the prediction model; performing a nonlinear transformation on the second feature set to obtain the first packet loss rate.
[0075] Figure 4 This is a schematic diagram of another optional data compensation method according to an embodiment of this application. In an optional implementation, a first feature set is fed into the input layer of the prediction model and then passed layer by layer. The output of each layer becomes the input of the next layer until the last layer (output layer) produces the final output to obtain the first packet loss rate. During the forward propagation process, the input of each layer can be weighted by the weights connected to it, then a bias term is added, and finally an activation function is used to calculate the output of that layer to obtain higher features, i.e., a second feature set. The activation function is then used to process the second feature set. The activation function introduces nonlinearity, enabling the prediction model to learn and simulate nonlinear relationships and complex patterns to obtain the first packet loss rate.
[0076] In an optional implementation, the training process of the above-mentioned prediction model includes: determining the target parameter set of the prediction model; determining the prediction model to be trained based on the target parameter set, and training the prediction model to be trained to obtain the prediction model.
[0077] In optional implementations, the set of target parameters can be selected empirically or through a selection algorithm. The set of target parameters may include parameters such as the number of layers in the prediction model, the number of neurons per layer, and the learning rate. Specifically, the number of layers indicates the number of hidden layers. The number of neurons indicates the number of neurons in each hidden layer. The learning rate indicates the step size for weight updates during training. It may also include the type of activation function used in the hidden and output layers, such as ReLU, Sigmoid, or Tanh. The type of algorithm used for weight updates, such as SGD, Adam, RMSprop, etc., and the number of samples used in each training iteration.
[0078] In an optional implementation, after determining the target parameter set, the network's performance can be evaluated by calculating a loss function (such as mean squared error or cross-entropy loss) by comparing the output of the predictive model with the true values. The gradient of the loss function is then used for backpropagation through the network, employing the chain rule to calculate the impact of each weight on the final loss. Gradient descent or its variants are then used to update the weights and biases in the network based on the backpropagated gradients.
[0079] In an optional implementation, determining the target parameter set of the prediction model includes: obtaining an initial parameter set of the prediction model; training an initial prediction model corresponding to the initial parameter set and determining the fitness of the initial prediction model; performing p iterations on the initial parameter set: in the first iteration, determining the initial parameter set as the first parameter set, and updating the second parameter set using the first parameter set; training the prediction model corresponding to the second parameter set and determining the fitness of the prediction model corresponding to the second parameter set; determining the parameter set corresponding to the larger value between the fitness of the initial prediction model and the fitness of the prediction model corresponding to the second parameter set as the optimal set. Parameter set; In the q-th iteration, the (q+1)-th parameter set is determined based on the optimal parameter set and the q-th parameter set, and the fitness of the prediction model corresponding to the (q+1)-th parameter set is determined; The parameter set corresponding to the larger value among the fitness of the initial prediction model and the fitness of the prediction model corresponding to the 2nd parameter set to the (q+1)-th parameter set is updated as the optimal parameter set; If the fitness of the prediction model corresponding to the t-th parameter set is greater than the preset fitness threshold or q equals p, the optimal parameter set is determined as the target parameter set, where p is an integer greater than 0, q is an integer greater than 0 and less than or equal to p, and t is an integer greater than 0 and less than or equal to p.
[0080] In an optional implementation, initialization can be performed by randomly generating an initial set of parameters as the initial positions of individuals in the population. Each individual represents a set of hyperparameters, such as the learning rate, number of layers, and number of neurons per layer. Then, a search space is defined: for each hyperparameter, a search range is defined. For example, the learning rate might be between 0.001 and 0.1, and the number of layers might be between 1 and 5. The prediction model is trained using the current combination of hyperparameters, and its performance is evaluated on a validation set, typically using mean squared error (MSE) or other metrics as the fitness function. The parameter set can then be updated using a preset update method. After updating the parameter set, it can be checked whether the new parameter set exceeds the defined search space. The prediction model is retrained, and the corresponding fitness is calculated. If the latest fitness is better than the fitness corresponding to the current best parameter set, the best parameter set can be updated.
[0081] In an optional implementation, the training set can be obtained by acquiring user-space log files. The user-space logs can utilize the kernel-level monitoring methods described above to obtain the characteristic information of data packets within a time window or network interface. The acquired characteristic information and data packets can be divided into training, validation, and test sets according to a certain ratio, such as 70% for the training set, 15% for the validation set, and 15% for the test set.
[0082] In an optional implementation, the parameter set can be updated using the following formula:
[0083]
[0084] in, It is the position of the i-th individual in the next iteration. R1 and R2 are random numbers, and x1 and x2 are the golden ratio coefficients. The random numbers increase the randomness of the search, allowing the individual to explore different regions; the golden ratio coefficients control the search range and determine the movement range of the individual in each iteration.
[0085] Figure 5 This is a schematic diagram of another optional data compensation method according to an embodiment of this application; as shown Figure 5As shown, before training the prediction model, the parameter set of the prediction model can be determined first. The parameter set can be the hyperparameters of the prediction model. Initialization can be performed first to obtain an initial parameter set, which can be a set of hyperparameter solutions, and each hyperparameter solution represents a potential set of hyperparameters. The prediction model can be constructed using the hyperparameter solutions and trained to obtain a trained initial prediction model. The fitness of this model can be evaluated using a validation set. After determining the fitness, the initial parameter set can be updated, and the model can be trained again to obtain the corresponding prediction model and its fitness. The updated fitness of each individual can be compared with its optimal fitness. If the individual's optimal fitness exceeds its optimal fitness, the optimal fitness is updated. Then, the optimal fitness of the individual is compared to see if it exceeds the current global optimal fitness. If it does, the global optimal fitness is updated, and the parameter update step size is determined based on the global optimal fitness and the optimal fitness of the individual. This process is repeated until the stopping condition is met to continuously update the parameters. When the stopping condition is met, the update process ends, and the parameter set corresponding to the current global optimal fitness is output. The stopping conditions can be reaching the maximum number of iterations, fitness exceeding the preset fitness, or fitness stabilizing.
[0086] Through the above-described embodiments of this application, optimal prediction model parameters can be pre-selected, and a trained prediction model can be obtained based on the obtained target parameter set. The prediction model can be used to predict the collected data to obtain the first packet loss rate for the second time period. Using the prediction model obtained in the above manner, more accurate prediction of network packet loss can be achieved, thereby improving the accuracy of adjusting data compensation strategies.
[0087] In an optional implementation of this application, eBPF technology can be used to implement network traffic monitoring and data collection in the kernel, and then send the data to user space for easy extraction. Information from the obtained data packets can be processed to obtain a first feature set. The first feature set and a more accurate prediction model are then used to predict the first packet loss rate for the second time period. Combining the first packet loss rate, a preset packet loss rate, and the current data compensation strategy, the target data compensation strategy is adjusted to adapt to the changing network environment. Through the above-described method of this application, data can be quickly transmitted to user space, ensuring high efficiency and accuracy of data collection. Furthermore, the accuracy of the first packet loss rate prediction is improved by using a prediction model with a pre-determined parameter set. During the data compensation strategy adjustment process, the strategy can be dynamically adjusted according to the first packet loss rate, and smooth switching between different strategies can be achieved to adapt to the dynamically changing network environment. This improves the stability and efficiency of network data transmission and enhances the user experience.
[0088] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0089] This embodiment also provides a data compensation device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs 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.
[0090] Figure 6 This is a structural block diagram of an optional data compensation device according to an embodiment of this application, such as... Figure 6 As shown, the device includes:
[0091] The first acquisition module 62 is used to acquire a first feature set of data packets transmitted within a first time period, wherein the first feature set is used to indicate the attribute information of the data packets transmitted within the first time period.
[0092] Prediction module 64 is used to input the first feature set into the prediction model to obtain a first packet loss rate, wherein the first packet loss rate is used to indicate the packet loss rate of data packets in the second time period;
[0093] The strategy determination module 66 is used to determine the target data compensation strategy corresponding to the second time period based on the first packet loss rate and the preset packet loss rate.
[0094] This application obtains a first feature set of data packets transmitted within a first time period, wherein the first feature set indicates the attribute information of the data packets transmitted within the first time period; the first feature set is input into a prediction model to obtain a first packet loss rate, wherein the first packet loss rate indicates the packet loss rate of data packets within a second time period; based on the first packet loss rate and a preset packet loss rate, a target data compensation strategy corresponding to the second time period is determined. The packet loss rate of the second time period can be predicted based on the characteristics of the data packets monitored in real time, and a data compensation strategy can be determined based on the packet loss rate to adapt to different network environments and ensure high efficiency and reliability of data transmission. This solves the technical problem of low efficiency in current network transmission methods in related technologies.
[0095] Optionally, the strategy determination module 66 is further configured to, when the first packet loss rate is greater than the preset packet loss rate and the data compensation strategy corresponding to the current moment is the first data compensation strategy, adjust the first data compensation strategy to the second data compensation strategy and determine the second data compensation strategy as the target data compensation strategy; when the first packet loss rate is less than the preset packet loss rate and the data compensation strategy corresponding to the current moment is the second data compensation strategy, adjust the second data compensation strategy to the first data compensation strategy and determine the first data compensation strategy as the target data compensation strategy.
[0096] Optionally, the above-mentioned determination of the data compensation strategy corresponding to the second time period based on the first packet loss rate and the preset packet loss rate includes: updating the redundancy of the second data compensation strategy based on the first packet loss rate.
[0097] Optionally, the first acquisition module 62 is further configured to: acquire a first information set of data packets transmitted within a first time period, and process the first information set to obtain a first feature set; determine the mean, variance, and standard deviation of the data packets transmitted within the first time period based on the first information set, and determine the mean, variance, and standard deviation as the first feature set; determine the packet loss rate of the first time period, and determine the packet loss rate of the first time period as the first feature set.
[0098] Optionally, obtaining the first information set of data packets transmitted within the first time period includes: determining the first information set of data packets transmitted within the first time period at the network interface; storing the first information set in a log file; and retrieving the first information set from the log file.
[0099] Optionally, the prediction module 64 is further configured to: input the first feature set into the input layer of the prediction model; obtain the second feature set through the hidden layer of the prediction model; perform a nonlinear transformation on the second feature set to obtain the first packet loss rate.
[0100] Optionally, the training process of the above prediction model includes: determining the target parameter set of the prediction model; determining the prediction model to be trained based on the target parameter set, and training the prediction model to be trained to obtain the prediction model.
[0101] Optionally, determining the target parameter set of the prediction model includes: obtaining an initial parameter set of the prediction model; training an initial prediction model corresponding to the initial parameter set and determining the fitness of the initial prediction model; performing p iterations on the initial parameter set: in the first iteration, determining the initial parameter set as the first parameter set, and using the first parameter set to update and obtain the second parameter set; training the prediction model corresponding to the second parameter set and determining the fitness of the prediction model corresponding to the second parameter set; determining the parameter set corresponding to the larger value between the fitness of the initial prediction model and the fitness of the prediction model corresponding to the second parameter set as the optimal parameter set. In the q-th iteration, the (q+1)-th parameter set is determined based on the optimal parameter set and the q-th parameter set, and the fitness of the prediction model corresponding to the (q+1)-th parameter set is determined; the parameter set corresponding to the larger value among the fitness of the initial prediction model and the fitness of the prediction models corresponding to the 2nd parameter set to the (q+1)-th parameter set is updated as the optimal parameter set; if the fitness of the prediction model corresponding to the t-th parameter set is greater than the preset fitness threshold or q equals p, the optimal parameter set is determined as the target parameter set, where p is an integer greater than 0, q is an integer greater than 0 and less than or equal to p, and t is an integer greater than 0 and less than or equal to p.
[0102] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.
[0103] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above method embodiments when run.
[0104] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0105] Embodiments of this application also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0106] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0107] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.
[0108] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.
[0109] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.
Claims
1. A data compensation method, characterized in that, The method includes: Obtain a first feature set of data packets transmitted within a first time period, wherein the first feature set is used to indicate the attribute information of the data packets transmitted within the first time period; The first feature set is input into the prediction model to obtain the first packet loss rate, wherein the first packet loss rate is used to indicate the packet loss rate of data packets in the second time period; Based on the first packet loss rate and the preset packet loss rate, determine the target data compensation strategy corresponding to the second time period; The step of determining the target data compensation strategy for the second time period based on the first packet loss rate and the preset packet loss rate includes: If the first packet loss rate is greater than the preset packet loss rate, and the data compensation strategy corresponding to the current moment is the first data compensation strategy, the first data compensation strategy is adjusted to the second data compensation strategy, and the second data compensation strategy is determined as the target data compensation strategy. If the first packet loss rate is less than the preset packet loss rate, and the data compensation strategy corresponding to the current moment is the second data compensation strategy, the second data compensation strategy is adjusted to the first data compensation strategy, and the first data compensation strategy is determined as the target data compensation strategy.
2. The method according to claim 1, characterized in that, The step of determining the target data compensation strategy corresponding to the second time period based on the first packet loss rate and the preset packet loss rate includes: The retransmission timeout of the first data compensation strategy is updated based on the preset time and the first packet loss rate; The retransmission count of the first data compensation strategy is updated based on the preset number of times and the first packet loss rate.
3. The method according to claim 1, characterized in that, The step of determining the target data compensation strategy corresponding to the second time period based on the first packet loss rate and the preset packet loss rate includes: The redundancy of the second data compensation strategy is updated based on the first packet loss rate.
4. The method according to claim 1, characterized in that, The first set of features for data packets transmitted within the first time period includes at least one of the following: Obtain a first information set of data packets transmitted within the first time period, and process the first information set to obtain a first feature set; Based on the first information set, the mean, variance, and standard deviation of the data packets transmitted within the first time period are determined, and the mean, variance, and standard deviation are determined as the first feature set; Determine the packet loss rate of the first time period, and define the packet loss rate of the first time period as the first feature set.
5. The method according to claim 4, characterized in that, The step of obtaining the first information set of data packets transmitted within the first time period includes: The network interface determines the first set of information for the data packets transmitted during the first time period; Store the first set of information into a log file; Retrieve the first information set from the log file.
6. The method according to claim 1, characterized in that, The step of inputting the first feature set into the prediction model to obtain the first packet loss rate includes: The first feature set is input into the input layer of the prediction model; The second feature set is obtained through the hidden layer of the prediction model; The second feature set is subjected to a nonlinear transformation to obtain the first packet loss rate.
7. The method according to claim 6, characterized in that, The training process of the prediction model includes: Determine the target parameter set of the prediction model; The prediction model to be trained is determined based on the target parameter set, and the prediction model to be trained is trained to obtain the prediction model.
8. The method according to claim 7, characterized in that, Determining the target parameter set of the prediction model includes: Obtain the initial parameter set of the prediction model; The initial prediction model corresponding to the initial parameter set is obtained through training, and the fitness of the initial prediction model is determined. Perform p iterations on the initial parameter set: In the first iteration, the initial parameter set is determined as the first parameter set, and the second parameter set is obtained by updating the first parameter set. The prediction model corresponding to the second parameter set is obtained through training, and the fitness of the prediction model corresponding to the second parameter set is determined. The parameter set corresponding to the larger value between the fitness of the initial prediction model and the fitness of the prediction model corresponding to the second parameter set is determined as the optimal parameter set. In the case of the qth iteration, the (q+1)th parameter set is determined based on the optimal parameter set and the qth parameter set, and the fitness of the prediction model corresponding to the (q+1)th parameter set is determined. The parameter set corresponding to the larger value among the fitness of the initial prediction model and the fitness of the prediction models corresponding to the second to q+1th parameter sets is updated to the optimal parameter set. If the fitness of the prediction model corresponding to the t-th parameter set is greater than the preset fitness threshold or q is equal to p, the optimal parameter set is determined as the target parameter set, where p is an integer greater than 0, q is an integer greater than 0 and less than or equal to p, and t is an integer greater than 0 and less than or equal to p.
9. A data compensation device, characterized in that, The device includes: The first acquisition module is used to acquire a first feature set of data packets transmitted within a first time period, wherein the first feature set is used to indicate the attribute information of the data packets transmitted within the first time period. The prediction module is used to input the first feature set into the prediction model to obtain the first packet loss rate, wherein the first packet loss rate is used to indicate the packet loss rate of data packets in the second time period; The strategy determination module is used to determine the target data compensation strategy corresponding to the second time period based on the first packet loss rate and the preset packet loss rate. The strategy determination module is further configured to: adjust the first data compensation strategy to a second data compensation strategy and determine the second data compensation strategy as the target data compensation strategy when the first packet loss rate is greater than the preset packet loss rate and the data compensation strategy corresponding to the current time is the first data compensation strategy. If the first packet loss rate is less than the preset packet loss rate, and the data compensation strategy corresponding to the current moment is the second data compensation strategy, the second data compensation strategy is adjusted to the first data compensation strategy, and the first data compensation strategy is determined as the target data compensation strategy.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the method according to any one of claims 1 to 8.
11. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Data transmission method and device and computer storage medium
CN114448569A
Wireless communication network performance optimization method and device and storage medium
CN117241295A