Methods for determining TCP congestion windows, terminals, electronic devices, and media
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-28
- Publication Date
- 2026-08-14
AI Technical Summary
[0004]本发明实施例提供TCP拥塞窗口的确定方法、终端、电子设备及介质,以解决相关技术中进行拥塞窗口测量的点和发送方以及接收方的报文时序不一致,会导致上述拥塞窗口测量结果和发送方真实的拥塞窗口大小存在较大误差的问题
[0011]In this embodiment of the invention, after the terminal receives the first message, it can locate the last message received in the forward direction, i.e., the second message. Then, it sorts the third messages between the second and first messages in time. Based on the TCP sequence number of the first message, the payload data length of the first message, and the TCP acknowledgment number of the second message, it determines the value of the congestion window associated with the sorting result, i.e., it determines the congestion window between the second and first messages. It is evident that in this application, the congestion window is determined after sorting, ensuring the accuracy of the congestion window determination. This solves the problem in related technologies where the timing of congestion window measurement is inconsistent with the message timing of the sender and receiver, leading to a large error between the measured congestion window size and the actual congestion window size of the sender.
Smart Images

Figure CN116962256B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computers, and provides a method for determining the TCP congestion window, a terminal, an electronic device, and a medium. Background Technology
[0002] When measuring a TCP (Transmission Control Protocol) session, the congestion window is typically defined as the number of bytes in flight—that is, the number of bytes sent but not yet acknowledged. This method of determining the congestion window is directly related to the location of message acquisition and measurement along the communication network traversed by both the sender and receiver. Figure 1 As shown, with the mobile phone as the receiver, the server as the sender, and a DPI (Deep Packet Inspection) device in the network as the measurement point, the time sequence of the sender's messages is inconsistent with the time sequence of the receiver's messages. Because the time sequence of the messages from the point performing the congestion window measurement is inconsistent with that of the sender and receiver, there will be a significant error between the above congestion window measurement results and the actual congestion window size of the sender. Furthermore, this error increases with the distance of the measurement point from the communication node of the sender.
[0003] There is currently no effective solution to the aforementioned problems in the relevant technologies. Summary of the Invention
[0004] This invention provides a method, terminal, electronic device, and medium for determining the TCP congestion window, in order to solve the problem in related technologies where the timing of congestion window measurement is inconsistent with the message timing of the sender and receiver, which leads to a large error between the measured congestion window size and the actual congestion window size of the sender.
[0005] To solve the above-mentioned technical problems, the present invention is implemented as follows:
[0006] In a first aspect, embodiments of the present invention provide a method for determining a TCP congestion window, applied to a terminal. The method includes: when the terminal sends a first message based on the TCP protocol carrying payload data, determining from the messages in the opposite direction of the session to which the first message is located a second message received by the terminal before the first message was sent, and associating the index number of the second message with the message information of the first message; sorting the first message with a plurality of third messages to obtain a sorting result, wherein the third messages are messages that the terminal needs to send after receiving the second message; and determining the value of the congestion window associated with the sorting result by using the TCP sequence number of the first message, the payload data length of the first message, and the TCP acknowledgment number of the second message.
[0007] Secondly, embodiments of the present invention provide a terminal, comprising: a first processing module, configured to, when sending a first packet based on the TCP protocol carrying payload data, determine from the packets in the opposite direction of the session in which the first packet is located the last second packet received before the first packet was sent, and associate the index number of the second packet with the packet information of the first packet; a sorting module, configured to sort the first packet with a plurality of third packets to obtain a sorting result, wherein the third packets are packets that the terminal needs to send after receiving the second packet; and a first determining module, configured to determine the value of a congestion window associated with the sorting result by using the TCP sequence number of the first packet, the payload data length of the first packet, and the TCP acknowledgment number of the second packet.
[0008] Thirdly, embodiments of the present invention provide an electronic device, including a transceiver and a processor. The transceiver is used to send and receive messages. The processor is used to, when the terminal sends a first message based on the TCP protocol carrying payload data, determine from the messages in the opposite direction of the session in which the first message is located the last second message received by the terminal before the first message was sent, and associate the index number of the second message with the message information of the first message; sort the first message with a plurality of third messages to obtain a sorting result, wherein the third message is a message that the terminal needs to send after receiving the second message; and determine the value of a congestion window associated with the sorting result by using the TCP sequence number of the first message, the payload data length of the first message, and the TCP acknowledgment number of the second message.
[0009] Fourthly, embodiments of the present invention provide an electronic device, including: a processor, a memory, and a program stored in the memory and executable on the processor, wherein the program, when executed by the processor, performs the steps described in the first aspect above.
[0010] Fifthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps described in the first aspect above.
[0011] In this embodiment of the invention, after the terminal receives the first message, it can locate the last message received in the forward direction, i.e., the second message. Then, it sorts the third messages between the second and first messages in time. Based on the TCP sequence number of the first message, the payload data length of the first message, and the TCP acknowledgment number of the second message, it determines the value of the congestion window associated with the sorting result, i.e., it determines the congestion window between the second and first messages. It is evident that in this application, the congestion window is determined after sorting, ensuring the accuracy of the congestion window determination. This solves the problem in related technologies where the timing of congestion window measurement is inconsistent with the message timing of the sender and receiver, leading to a large error between the measured congestion window size and the actual congestion window size of the sender. Attached Figure Description
[0012] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0013] Figure 1 This is a flowchart of the message sending and receiving process in related technologies;
[0014] Figure 2 This is a flowchart of a method for determining a TCP congestion window provided in an embodiment of the present invention;
[0015] Figure 3 This is a flowchart of another method for determining the TCP congestion window provided in an embodiment of the present invention;
[0016] Figure 4 This is a schematic diagram of the neural network model provided in an embodiment of the present invention;
[0017] Figure 5 This is a schematic diagram of the terminal structure provided in an embodiment of the present invention;
[0018] Figure 6 This is a schematic diagram of an electronic device provided in an embodiment of the present invention;
[0019] Figure 7 This is a schematic diagram of another electronic device provided in an embodiment of the present invention. Detailed Implementation
[0020] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0021] TCP is a connection-oriented, reliable, byte-stream-based transport layer communication protocol. It provides reliable communication through a retransmission mechanism. Specifically, TCP assigns a sequence number (SEQ) to each data packet. When the receiving end successfully receives data packet A, it sends an acknowledgment packet (ACK) to the sending end, which carries the sequence number of data packet A. If the sending end does not receive the acknowledgment packet for data packet A within a certain time, it considers data packet A lost and retransmits it. To avoid network congestion, TCP employs a sliding window rate limiting and batch transmission mechanism. Specifically, the sending end sends a number of data packets (i.e., a packet group) in byte batches according to the sliding window (SW). After sending a batch of packets, the sending end stops sending data packets until one round-trip time (RTT) has elapsed, i.e., after the sending end receives the acknowledgment packet from the receiving end for the previous batch of packets, and then starts sending a new batch of packets.
[0022] As can be seen from the above transmission mechanism, besides round-trip time, the size of the sliding window and the mechanism and algorithm for its growth or adjustment are also important indicators determining the TCP transmission rate. The sending window is typically used to measure the maximum amount of data the sender can send within a round-trip time. The sending window is usually determined by network congestion (congestion window), the sender's maximum transmission capacity, the receiver's maximum reception capacity (receive window), and the sender's mechanism and algorithm for adjusting the sending window in response to network congestion. When the window is limited, the minimum value of the aforementioned relevant windows is taken.
[0023] In related technologies such as Figure 1 As shown, the server acts as the sender, and the message order is as follows:
[0024] d1-d2-d3-d4-a1-d5-a2-d6-a3-d7-a4-d8-a5-a6-a7-a8;
[0025] As the receiver, the mobile phone sends messages in the following order:
[0026] d1-a1-d2-a2-d3-a3-d4-a4-d5-a5-d6-a6-d7-a7-d8-a8
[0027] The message sequence in the DPI device is as follows:
[0028] d1-d2-d3-d4-a1-a2-a3-a4-d5-d6-d7-d8-a5-a6-a7-a8
[0029] As can be seen, the message order of the sender, receiver, and measurement point is different. Because the message timing of the point performing the congestion window measurement is inconsistent with that of the sender and receiver, there will be a significant error between the above congestion window measurement results and the actual congestion window size of the sender.
[0030] To address the aforementioned problems in related technologies, this application provides a method for determining the TCP congestion window, see [link to relevant documentation]. Figure 2 , Figure 2 This is a flowchart of a method for determining the TCP congestion window provided by an embodiment of the present invention, applied to a terminal, such as... Figure 2 As shown, the method includes the following steps:
[0031] Step 201: When the terminal sends a first message based on the TCP protocol carrying payload data, determine the second message from the messages in the opposite direction of the session where the first message is located, which is the last message received by the terminal in the opposite direction before the first message was sent, and associate the index number of the second message with the message information of the first message.
[0032] It should be noted that the last second message received by the terminal in the opposite direction refers to the message received in the opposite direction that is closest in time to the first message before the first message was sent. There can be multiple second messages in this last opposite direction, meaning that multiple second messages were sent in the same opposite direction at the same time. Furthermore, with... Figure 1 For example, if the terminal is a mobile phone, then the mobile phone is the sender of the server and the server is the receiver of the terminal. The first message is sent from the mobile phone to the server, and the second message is sent from the server to the mobile phone. The opposite direction is the direction in which the server sends messages to the mobile phone.
[0033] Step 202: Sort the first message and multiple third messages to obtain a sorting result, wherein the third message is the message that the terminal needs to send after receiving the second message;
[0034] Step 203: Determine the value of the congestion window associated with the sorting result by the TCP sequence number of the first message, the payload data length of the first message, and the TCP acknowledgment number of the second message.
[0035] Through steps 101 to 103 described above, after the terminal receives the first message, it can locate the last message received in the forward direction, i.e., the second message. Then, it sorts the third message between the second and first messages in time. Based on the TCP sequence number of the first message, the payload data length of the first message, and the TCP acknowledgment number of the second message, it determines the congestion window value associated with the sorting result, i.e., it determines the congestion window between the second and first messages. It is evident that in this application, the congestion window is determined after sorting, ensuring the accuracy of the congestion window determination. This solves the problem in related technologies where the timing of congestion window measurement is inconsistent with the message timing of the sender and receiver, leading to a large error between the measured congestion window size and the actual congestion window size of the sender.
[0036] In an optional embodiment of this application, the method of determining the second message from the last opposite direction received by the terminal before the first message was sent, which involves step 201 above, from the messages in the opposite direction of the session where the first message is located, may further include:
[0037] Step 11: Obtain the first field from the first message and the second field from the message in the opposite direction, wherein the first field is used to represent the sender's timestamp of the message and the second field is used to represent the echo timestamp of the message.
[0038] Step 12: Compare the time represented by the first field with the time represented by the second field;
[0039] Step 13: If the time represented by the first field is less than the time represented by the second field, continue to search the second field in the messages in the opposite direction until the time represented by the first field is greater than or equal to the time represented by the second field, and determine the message corresponding to the second field whose represented time is greater than the first field as the second message.
[0040] In this embodiment, the acquisition and parsing of the first and second packets can be implemented by a DPI device or unpacking software in specific examples. That is, when a TCP network packet is acquired, the network packet is parsed. Specifically, the method can be as follows: extract the packet's five-tuple information (source IP, destination IP, source port number, destination port number, transport layer protocol), TCP layer protocol stack cells, and IP layer protocol stack cells; match the five-tuple information with the five-tuples in the current DPI device's unaged five-tuple flow table; identify and record the packet direction; and perform session labeling, indexing, and packet information saving on the packet (at least the session identifier, packet index number, packet direction, packet capture time, packet payload length, packet TCP sequence number, packet TCP acknowledgment number, and the indicators recorded by tsval and tsecr in the TCP protocol options must be saved), and then update the status of the session in the five-tuple flow table.
[0041] Based on this, for steps 11 to 13 above, in a specific example, the first field can be the tsval (TimeStamp value, sender's timestamp) field, and the second field can be the tsecr (TimeStamp echo reply, echo timestamp). Based on this, in a specific example, the value of the tsecr of the received first message is extracted, and the search starts from the most recently received message in the same session and proceeds backward, comparing it with the tsval of the corresponding message. If the tsecr of the first message is less than the tsval, the search continues forward; if the tsecr of the first message is greater than or equal to the tsval, the search stops, and the index number of the corresponding message (second message) is recorded in the storage information of the first message, thus completing the message association operation.
[0042] Furthermore, the method of comparing the time represented by the first field with the time represented by the second field involved in step 12 above may further include:
[0043] Step 31: Determine whether there is wrapping in the first and second fields;
[0044] Step 32: If the first field has wraparound, add the maximum value of the first field to the time represented by the first field and compare it with the time represented by the second field.
[0045] Step 33: If the second field has wraparound, add the maximum value of the second field to the time represented by the second field and compare it with the time represented by the first field.
[0046] It's important to note that wraparound refers to resetting tsval and tsecr to their maximum recordable values after they reach their respective maximum values. Therefore, when wraparound exists and message association is required, the wrapped metrics are added to their maximum values before being compared with the non-wrapped metrics. Only by adding the maximum value can the true value of the current field be represented in the presence of wraparound, thus accurately identifying the second message associated with the first message.
[0047] In an optional embodiment of this application, the method of sorting the first message and multiple third messages to obtain a sorting result in step 202 may further include:
[0048] Step 41: Sort the first message and multiple third messages according to preset rules to obtain the sorting result;
[0049] The preset rules are as follows: First, compare the first field of the first packet and the third packet, and sort the packet with the smaller time represented by the first field first. If the time represented by the first field of the first packet and the third packet are equal, then compare the TCP sequence number of the first packet and the third packet, and sort the packet with the smaller TCP sequence number first. If the TCP sequence number of the first packet and the third packet are equal, then compare the ACK sequence number of the first packet and the third packet, and sort the packet with the smaller ACK sequence number first. If the ACK sequence number of the first packet and the third packet are equal, then compare the IPID sequence number of the first packet and the third packet, and sort the packet with the smaller IPID sequence number first. If the IPID sequence number of the ACK sequence number of the first packet and the third packet are equal, then sort the packets according to their capture time.
[0050] As can be seen, the packet sorting in this embodiment restores the actual order of packets on the data sender's side. Taking tsval as the first field as an example, the specific method is as follows: First, the packet is placed in the associated reciprocal packet list, and then compared and sorted sequentially with the reciprocal packets following it. The packet order in the same direction is first confirmed by the TCP tsval, with the packet having a smaller tsval value sorted first; if the tsval values are the same, the TCP SEQ sequence number is compared, with the packet having a smaller SEQ sequence number sorted first; if the TCP SEQ sequence numbers are the same, the TCP ACK sequence numbers are compared, with the packet having a smaller ACK sequence number sorted first; if the TCP ACK sequence numbers are the same and the IP layer uses the IPv4 protocol, the IP ID sequence number can be used for comparison, with the packet having a smaller IPID sequence number sorted first; if sorting by IP ID is not possible, sorting can be based on the packet capture time. This method, considering various situations, can sort packets relatively accurately.
[0051] In an optional embodiment of this application, the method of determining the congestion window value associated with the sorting result by associating the TCP sequence number of the first packet, the payload data length of the first packet, and the TCP acknowledgment number of the second packet in step 103 above may further include:
[0052] Step 51: Sum the TCP sequence number of the first packet with the payload data length of the first packet to obtain the summation result;
[0053] Step 52: Determine the value of the congestion window by the difference between the summation result and the TCP acknowledgment number of the second message.
[0054] It should be noted that the value of the congestion window in this application embodiment refers to the number of bytes of data in the congestion window.
[0055] In this embodiment of the application, after determining the value of the congestion window associated with the sorting result, as follows: Figure 3 As shown, the method in this application embodiment may further include:
[0056] Step 301: Detect the time-series data in the congestion window of the congestion control behavior to be detected based on the pre-trained neural network model;
[0057] Step 302: Determine the input time series data when the loss value output by the neural network model is greater than a preset threshold as the starting point, and determine the time series data of a preset length starting from the starting point as a congestion control action, and increment the congestion control action count of the session by 1.
[0058] Step 303: When all the time-series data in the congestion window of the congestion control behavior to be detected has been input into the neural network model, the ratio of the minimum value to the maximum value of the congestion window in the time-series data of the congestion window of the congestion control behavior to be detected is determined as the contraction amplitude of the congestion window.
[0059] As described in steps 301 and 302 above, congestion window time-series data requiring congestion control behavior detection are processed. Specifically, the time-series data containing congestion control behavior is detected. When a data point with a loss value greater than the congestion control detection threshold is encountered, that point is used as the starting point to mark subsequent time-series data as a congestion control behavior. The corresponding time-series data for this congestion control behavior is then exported, and the congestion avoidance count and congestion window contraction magnitude for that session are calculated. Specifically, the congestion control behavior count for that session is incremented by 1, and the congestion window contraction magnitude is the result of dividing the minimum congestion window value in the congestion control detection data by the maximum congestion window value.
[0060] The neural network model is built based on the target model. In this specific example, an AutoEncoder deep learning network is used to detect congestion control. The specific network model is as follows: Figure 4 As shown, the parameters configured for the convolutional layer in the neural network model are: in_channels, the number of channels in the input signal; out_channels, the number of channels generated by the convolution; kernel_size, the size of the convolution kernel; and stride, the convolution stride.
[0061] Model training involves training the preprocessed training data using the configured neural network model. The training data should be congestion window data without congestion control behavior. Optimization is performed using a minimization loss method, employing MSEloss to calculate the loss value. The settings are epoch_num=200, batch_size=128, and learning_rate=0.001. The final loss value after training is recorded, and this loss value is multiplied by 1.5 to serve as the threshold for detecting congestion control behavior.
[0062] In this embodiment of the application, before detecting the time-series data in the congestion window of the congestion control behavior to be detected based on the trained neural network model, the method of this embodiment of the application may further include:
[0063] Step 61: Preprocess the data in the initial dataset to obtain the training set;
[0064] Step 62: Train the initial neural network model based on the training set to obtain a trained neural network model;
[0065] The preprocessing method is as follows: the data in the initial dataset is sampled at a preset granularity, where the data in the initial dataset is the data within the congestion window;
[0066] If no data is collected within the current preset granularity period, the data collected before the current preset granularity period and the data collected after the current preset granularity period are weighted and averaged, and the result of the weighted average is used to determine the data within the current preset granularity period.
[0067] If two or more data points are collected within the current preset granularity period, the data collected within the current preset granularity period is processed by averaging, and the processing result is determined as the data within the current preset granularity period.
[0068] As can be seen, in this embodiment, data sampling is based on data from a pre-generated congestion window. In a specific example, the congestion window data is sampled with a time granularity of 1 millisecond (a preset granularity period). If there are no data records within a 1-millisecond period, a linear interpolation method is used to supplement the data by a weighted average of the data records from the previous and next data-containing moments. If there are two or more data records within a 1-millisecond period, the average value for that period is calculated. After data preprocessing, the congestion window data should be processed into periodic time-series data with a sampling period of 1 millisecond.
[0069] Therefore, in this embodiment of the application, the time sequence of network packets on the sender's side is restored by using the first field (tsval) and the second field (tsecr) of the packet in the TCP protocol stack, thereby measuring the congestion window, and based on the anomaly detection algorithm of deep learning, the congestion control behavior performed by the sender during transmission is identified, making the location of network problems more accurate.
[0070] Corresponding to the above Figure 2 In addition to the method described above, this application also provides a terminal, such as... Figure 5 As shown, the device includes:
[0071] The first processing module 52 is used to determine, from the packets in the opposite direction of the session in which the first packet is located, the last second packet received by the terminal before the first packet was sent, and associate the index number of the second packet with the packet information of the first packet when the terminal sends a first packet based on the TCP protocol carrying payload data;
[0072] The sorting module 54 is used to sort the first message and multiple third messages to obtain a sorting result, wherein the third message is the message that the terminal needs to send after receiving the second message;
[0073] The first determining module 56 is used to determine the value of the congestion window associated with the TCP sequence number of the first message, the payload data length of the first message, and the TCP acknowledgment number of the second message and the sorting result.
[0074] Optionally, the first processing module 52 in this embodiment may further include: an acquisition unit, configured to acquire a first field in the first message and acquire a second field in the message in the opposite direction, wherein the first field is used to represent the sender timestamp of the message and the second field is used to represent the echo timestamp of the message; a comparison unit, configured to compare the time represented by the first field with the time represented by the second field; and a first determination unit, configured to continuously search the second field in the message in the opposite direction until the time represented by the first field is greater than or equal to the time represented by the second field, and determine the message corresponding to the second field whose represented time is greater than the first field as the second message.
[0075] Optionally, the comparison unit in the embodiments of this application may further include: a determining subunit, used to determine whether there is wrapping in the first field and the second field; a first comparison subunit, used to compare the time represented by the first field plus the maximum value of the first field with the time represented by the second field when there is wrapping in the first field; and a second comparison subunit, used to compare the time represented by the second field plus the maximum value of the second field with the time represented by the first field when there is wrapping in the second field.
[0076] Optionally, the sorting module 54 in this embodiment may further include: a sorting unit, used to sort the first message and multiple third messages based on a preset rule to obtain a sorting result; wherein, the preset rule is to first compare the first field of the first message and the third message, and sort the message with the smaller time represented by the first field first; if the time represented by the first field of the first message and the third message are equal, then compare the TCP sequence number of the first message and the third message, and sort the message with the smaller TCP sequence number first; if the TCP sequence number of the first message and the third message are equal, then compare the ACK sequence number of the first message and the third message, and sort the message with the smaller ACK sequence number first; if the ACK sequence number of the first message and the third message are equal, then compare the IP ID sequence number of the first message and the third message, and sort the message with the smaller IP ID sequence number first; if the IP ID sequence number of the first message and the third message are equal, then sort according to the capture time of the message.
[0077] Optionally, the first determining module 56 in this embodiment may further include: a processing unit, configured to sum the TCP sequence number of the first message and the payload data length of the first message to obtain a summing result; and a second determining unit, configured to determine the difference between the summing result and the TCP acknowledgment number of the second message as the value of the congestion window.
[0078] Optionally, such as Figure 6As shown, the terminal in this embodiment may further include:
[0079] The detection module 62 is used to detect time-series data in the congestion window of the congestion control behavior to be detected based on a trained neural network model after determining the value of the congestion window associated with the sorting result.
[0080] The second processing module 64 is used to determine the input time series data when the loss value output by the neural network model is greater than a preset threshold as the starting point, and to determine the time series data of a preset length starting from the starting point as a congestion control action, and to increment the congestion control action count of the session by 1.
[0081] The second determining module 66 is used to determine the ratio of the minimum value to the maximum value of the congestion window in the congestion window of the congestion control behavior to be detected as the contraction amplitude of the congestion window, when all the time series data in the congestion window of the congestion control behavior to be detected has been input into the neural network model.
[0082] As can be seen, after the terminal receives the first message, it can find the last message received in the forward direction, i.e., the second message. Then, it sorts the third message between the second and first messages in time. Based on the TCP sequence number of the first message, the payload data length of the first message, and the TCP acknowledgment number of the second message, it determines the congestion window value associated with the sorting result, i.e., it determines the congestion window between the second and first messages. Therefore, in this application, the congestion window is determined after sorting, ensuring the accuracy of the congestion window determination. This solves the problem in related technologies where the timing of congestion window measurement is inconsistent with the message timing of the sender and receiver, leading to a large error between the measured congestion window size and the actual congestion window size of the sender.
[0083] Optionally, the terminal in this embodiment may further include: a third processing module, used to preprocess the data in the initial dataset to obtain a training set before detecting the time-series data in the congestion window to be detected based on the trained neural network model; a training module, used to train the initial neural network model based on the training set to obtain a trained neural network model; wherein the preprocessing method is as follows: sampling the data in the initial dataset at a preset granularity, wherein the data in the initial dataset is the data within the congestion window; if no data is collected within the current preset granularity period, performing a weighted average of the data collected before the current preset granularity period and the data collected after the current preset granularity period, and determining the data within the current preset granularity period based on the weighted average; if more than or equal to two data points are collected within the current preset granularity period, processing the data collected within the current preset granularity period based on the average, and determining the processing result as the data within the current preset granularity period.
[0084] It should be noted that the terminal provided in this embodiment of the invention is capable of performing the above-described... Figure 2 If the TCP congestion window determination method described in the implementation is applied to the terminal, then all implementation methods in the above TCP congestion window determination method implementation are applicable to the terminal and can achieve the same or similar beneficial effects.
[0085] For details, see Figure 7 As shown, this embodiment of the invention also provides an electronic device, including a bus 701, a transceiver 702, an antenna 703, a bus interface 704, a processor 705, and a memory 706.
[0086] Transceiver 702 is used for sending and receiving messages;
[0087] The transceiver 702 or processor 705 is configured to, when the terminal sends a first message based on the TCP protocol carrying payload data, determine from the messages in the opposite direction of the session to which the first message belongs the last second message received by the terminal before the first message was sent, and associate the index number of the second message with the message information of the first message; sort the first message with multiple third messages to obtain a sorting result, wherein the third message is the message that the terminal needs to send after receiving the second message; and determine the value of the congestion window associated with the sorting result by using the TCP sequence number of the first message, the payload data length of the first message, and the TCP acknowledgment number of the second message.
[0088] exist Figure 7In this document, a bus architecture (represented by bus 701) is used. Bus 701 can include any number of interconnected buses and bridges, linking various circuits including one or more processors represented by processor 705 and memory represented by memory 706. Bus 701 can also link 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. Bus interface 704 provides an interface between bus 701 and transceiver 702. Transceiver 702 can be a single element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices over a transmission medium. Data processed by processor 705 is transmitted over a wireless medium via antenna 703, which further receives data and transmits data to processor 705.
[0089] Processor 705 manages bus 701 and general processing, and also provides various functions, including timing, peripheral interface, voltage regulation, power management, and other control functions. Memory 706 can be used to store data used by processor 705 during operation.
[0090] Optionally, the processor 705 can be a CPU, ASIC, FPGA, or CPLD.
[0091] It should be noted that the electronic device provided in the embodiments of the present invention is capable of performing the above-described functions. Figure 2 If the apparatus for determining the TCP congestion window in the embodiments is applicable to the electronic device, then all implementations of the TCP congestion window determination method in the above embodiments are applicable to the electronic device and can achieve the same or similar beneficial effects.
[0092] This invention also provides an electronic device, including: a processor, a memory, and a program stored in the memory and executable on the processor, wherein the program, when executed by the processor, implements the above-described functionality. Figure 2 The various processes of the TCP congestion window determination method embodiment shown can achieve the same technical effect, and will not be described again here to avoid repetition.
[0093] This invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, performs the above-described functions. Figure 2The various processes of the TCP congestion window determination method embodiment shown herein achieve the same technical effect, and will not be described again here to avoid repetition. The computer-readable storage medium mentioned herein includes, for example, read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0094] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0095] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of 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 technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0096] The embodiments of the present invention have been described above with reference to the accompanying drawings. However, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of the present invention without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of the present invention.
Claims
1. A method for determining the TCP congestion window, applied to a terminal, characterized in that, The method includes: When the terminal sends a first message based on the TCP protocol carrying payload data, the second message received by the terminal in the last direction before the first message was sent is determined from the messages in the opposite direction of the session where the first message is located, and the index number of the second message is associated with the message information of the first message. The first message and multiple third messages are sorted to obtain a sorting result, wherein the third message is the message that the terminal needs to send after receiving the second message; The TCP sequence number of the first message, the payload data length of the first message, and the TCP acknowledgment number of the second message are used to determine the value of the congestion window associated with the sorting result.
2. The method according to claim 1, characterized in that, From the messages in the opposite direction of the session containing the first message, determine the last second message received by the terminal in the opposite direction before the first message was sent, including: Obtain the first field from the first message and the second field from the message in the opposite direction, wherein the first field is used to represent the sender timestamp of the message and the second field is used to represent the echo timestamp of the message; Compare the time represented by the first field with the time represented by the second field; If the time represented by the first field is less than the time represented by the second field, the second field in the message of the opposite direction is continuously searched until the time represented by the first field is greater than or equal to the time represented by the second field, and the message corresponding to the second field whose represented time is greater than the first field is determined as the second message.
3. The method according to claim 2, characterized in that, Comparing the time represented by the first field with the time represented by the second field includes: Determine whether there is wrapping in the first field and the second field; If the first field has a wraparound, the time represented by the first field is added to the maximum value of the first field and then compared with the time represented by the second field; If the second field has a wraparound, the time represented by the second field is added to the maximum value of the second field and then compared with the time represented by the first field.
4. The method according to claim 2, characterized in that, The step of sorting the first message and multiple third messages to obtain the sorting result includes: The first message and multiple third messages are sorted according to preset rules to obtain the sorting result; The preset rules are as follows: First, compare the first field of the first packet and the third packet, and sort the packet with the smaller time represented by the first field first. If the time represented by the first field of the first packet and the third packet are equal, then compare the TCP sequence number of the first packet and the third packet, and sort the packet with the smaller TCP sequence number first. If the TCP sequence number of the first packet and the third packet are equal, then compare the ACK sequence number of the first packet and the third packet, and sort the packet with the smaller ACK sequence number first. If the ACK sequence number of the first packet and the third packet are equal, then compare the IP ID sequence number of the first packet and the third packet, and sort the packet with the smaller IP ID sequence number first. If the IP ID sequence number of the first packet and the third packet are equal, then sort the packets according to their capture time.
5. The method according to claim 1, characterized in that, The step of determining the congestion window value associated with the sorting result by using the TCP sequence number of the first packet, the payload data length of the first packet, and the TCP acknowledgment number of the second packet includes: The sum of the TCP sequence number of the first message and the payload data length of the first message is obtained. The difference between the summation result and the TCP acknowledgment number of the second message is determined as the value of the congestion window.
6. The method according to claim 1, characterized in that, After determining the value of the congestion window associated with the sorting result, the method further includes: The time-series data in the congestion window to be detected is based on a pre-trained neural network model; The input time series data when the loss value output by the neural network model is greater than a preset threshold is determined as the starting point, and the time series data of a preset length starting from the starting point is determined as a congestion control action, and the congestion control action count of the session is incremented by 1. When all the time-series data in the congestion window of the congestion control behavior to be detected has been input into the neural network model, the ratio of the minimum value to the maximum value of the congestion window in the time-series data of the congestion window of the congestion control behavior to be detected is determined as the contraction amplitude of the congestion window.
7. The method according to claim 6, characterized in that, Before detecting time-series data within the congestion window of the congestion control behavior to be detected based on the pre-trained neural network model, the method further includes: The data in the initial dataset is preprocessed to obtain the training set; The trained neural network model is obtained by training the initial neural network model based on the training set. The preprocessing method is as follows: sampling the data in the initial dataset with a preset granularity, wherein the data in the initial dataset is the data within the congestion window; If no data is collected within the current preset granularity period, the data collected before the current preset granularity period and the data collected after the current preset granularity period are weighted and averaged, and the result of the weighted average is used to determine the data within the current preset granularity period. If two or more data points are collected within the current preset granularity period, the data collected within the current preset granularity period is processed by averaging, and the processing result is determined as the data within the current preset granularity period.
8. A terminal, characterized in that, include: The first processing module is used to, when sending a first message based on the TCP protocol carrying payload data, determine from the messages in the opposite direction of the session where the first message is located the last second message received before the first message was sent, and associate the index number of the second message with the message information of the first message. The sorting module is used to sort the first message and multiple third messages to obtain a sorting result, wherein the third message is the message that the terminal needs to send after receiving the second message; The first determining module is used to determine the value of the congestion window associated with the sorting result by taking the TCP sequence number of the first message, the payload data length of the first message, and the TCP acknowledgment number of the second message.
9. An electronic device, characterized in that, Applications in terminals, including transceivers and processors. The transceiver is used to send and receive messages; The processor is configured to, when the terminal sends a first message based on the TCP protocol carrying payload data, determine from the messages in the opposite direction of the session to which the first message belongs the last second message received by the terminal before the first message was sent, and associate the index number of the second message with the message information of the first message; sort the first message with a plurality of third messages to obtain a sorting result, wherein the third messages are messages that the terminal needs to send after receiving the second message; and determine the value of the congestion window associated with the sorting result by using the TCP sequence number of the first message, the payload data length of the first message, and the TCP acknowledgment number of the second message.
10. An electronic device, characterized in that, include: A processor, a memory, and a program stored in the memory and executable on the processor, wherein the program, when executed by the processor, implements the method steps as described in any one of claims 1 to 7.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method steps as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Method and device for controlling congestion
CN102388584A
Congestion control method and equipment for data transmission, server and programmable equipment
CN106789718A