CN110391953B - Method for improving TCP KPI calculation accuracy - Google Patents
Method for improving TCP KPI calculation accuracy Download PDFInfo
- Publication number
- CN110391953B CN110391953B CN201810351996.9A CN201810351996A CN110391953B CN 110391953 B CN110391953 B CN 110391953B CN 201810351996 A CN201810351996 A CN 201810351996A CN 110391953 B CN110391953 B CN 110391953B
- Authority
- CN
- China
- Prior art keywords
- tcp
- ack
- packet
- value
- delay
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/08—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/08—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
- H04L43/0852—Delays
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/08—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
- H04L43/0876—Network utilisation, e.g. volume of load or congestion level
- H04L43/0894—Packet rate
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/60—Network structure or processes for video distribution between server and client or between remote clients; Control signalling between clients, server and network components; Transmission of management data between server and client, e.g. sending from server to client commands for recording incoming content stream; Communication details between server and client
- H04N21/63—Control signaling related to video distribution between client, server and network components; Network processes for video distribution between server and clients or between remote clients, e.g. transmitting basic layer and enhancement layers over different transmission paths, setting up a peer-to-peer communication via Internet between remote STB's; Communication protocols; Addressing
- H04N21/647—Control signaling between network components and server or clients; Network processes for video distribution between server and clients, e.g. controlling the quality of the video stream, by dropping packets, protecting content from unauthorised alteration within the network, monitoring of network load, bridging between two different networks, e.g. between IP and wireless
- H04N21/64723—Monitoring of network processes or resources, e.g. monitoring of network load
- H04N21/64738—Monitoring network characteristics, e.g. bandwidth, congestion level
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Environmental & Geological Engineering (AREA)
- Computer Security & Cryptography (AREA)
- Multimedia (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention discloses a TCP download rate calculation optimization method and a method for improving TCP KPI calculation accuracy, which comprises the following steps: a1, carrying out protocol analysis on the captured TCP data stream, carrying out tracking analysis on the TCP uplink ACK message, particularly analyzing the ACK value in the TCP uplink ACK message, and recording the timestamp t of the first TCP ACK packet 0 The ACK value of the first packet is ACK 0 (ii) a A2, extracting the time stamp t of the ACK message every time a new TCP uplink ACK message is received n And its ACK value ACK n And calculate t 0 To t n The total number of TCP download data bytes in this period, i.e. ACK n –ACK 0 (ii) a And further calculating the TCP download rate in the period of time: TCP download rate (Bps) = (ACK) n ‑ACK 0 )/(t n ‑t 0 ) (ii) a A3, when ACK n <ACK n‑1 The calculation formula is as follows: TCP download rate (Bps) = (ACK) n ‑ACK 0 +N)/(t n ‑t 0 ). The invention can improve the accuracy of TCP download rate calculation under the condition of network packet capturing loss and improve the performance and efficiency of network DPI equipment for monitoring TCP flow.
Description
Technical Field
The invention belongs to the technical field of network communication, and relates to a TCP flow performance monitoring method, in particular to a TCP download rate calculation optimization method; meanwhile, the invention also relates to a method for improving the calculation accuracy of the TCP KPI.
Background
In recent years, with the rapid development of the internet, the demand for monitoring the quality of service of an IP network and various upper-layer applications (such as Web access, electronic commerce, video, games, instant messaging, etc.) is increasing. Currently, passive monitoring probe devices are generally deployed at key network node positions (including a backbone layer, a convergence layer, an access layer, and a user side) of an IP network to implement service quality monitoring on IP network traffic and various upper-layer applications.
Due to the rapid increase of the IP network traffic, 10G, 40G, and even 100G optical fiber links are widely used in the IP backbone network to transmit data, and the gigabit home gateway and the gigabit interface 4K set-top box are also more and more popular at the user side. The large-flow network environment provides great challenges for monitoring the performance of bottom-layer packet capturing of equipment and software, and the gigabit/hundred-megabyte network cards of terminal equipment such as a current commercial ten-gigabit server network card, a home gateway and a set-top box cannot guarantee the performance of 100% data packet capturing under the condition of large flow. Since most internet applications mainly use TCP protocol to transmit data, there is a need in the industry to find a method that can accurately calculate various TCP KPI indicators (including TCP download rate, TCP delay, and TCP retransmission rate) under the condition of network packet loss.
IP network packet capturing performance analysis under high flow condition
Usually, a network packet capturing and analyzing module of the IP monitoring device or software captures an IP data packet from a network port by using a libpcap interface, and the libpcap sends the data packet to the packet capturing and analyzing module by using a "best effort" forwarding mechanism. Taking the example of deploying the QoS soft probe in the OTT set-top box, in order to ensure that main services (such as video playing of the set-top box) are not affected, the kernel of the set-top box operating system preferentially sends a data packet arriving at the network card to the TCP/IP protocol stack, and the data packet is recombined and then transmitted to the set-top box player. When the libpcap packet capture is started, the kernel informs the QoS soft probe packet capture analysis module to copy and transfer the received data as soon as possible through interruption.
Under the condition of playing high-traffic such as 4K ultra-high-definition video and the like, the libpcap cannot copy the data packets of the network port in full quantity, so that a great quantity of data packets captured by the QoS soft probe are lost. Taking an android OTT set-top box with common configuration as an example, when a 4K video is downloaded, a video media stream transmission protocol stack adopts MPEG-TS/HTTP/TCP/IP/Ethernet, a test is performed on a packet capturing performance of a terminal network card, and a relationship between a packet loss severity of a packet capturing module and a traffic of a network port is shown in fig. 1.
Through further analysis of the packet loss characteristic of the packet capturing module, a rule is found: the downlink video data packets sent to the set-top box by the video server have a serious packet loss condition due to the large length (generally about 1300-1500 bytes) and large number of the data packets; on the contrary, the uplink TCP ACK Bao Wen sent by the set-top box to the video server is not easily lost by the packet capturing module because the length of the data packet is small (generally about 64-100 bytes).
According to the analysis, on the device with lower network card performance such as the set-top box, the TCP KPI index is calculated by the traditional network port packet capturing analysis method, and because the packet capturing module has serious packet loss under the condition of high flow, the calculated indexes such as the TCP download rate, the TCP delay, the TCP retransmission rate and the like have great errors. Considering that the packet loss probability of the uplink TCP ACK small message is much smaller than that of the downlink TCP big data packet message, the traditional TCP KPI index calculation method can be optimized and improved to improve the TCP KPI index calculation accuracy so as to achieve a reasonable error range.
Traditional TCP KPI index calculation method and defects
1. TCP download rate
FIG. 2 is a depiction of the IP header format of a TCP/IP packet.
Since the Total length field of the IP header can be used to identify the Total size of the current IP packet, the TCP download rate in a period of time (i.e. the Total size of the downloaded IP packets in the period of time divided by the length of the period of time) can be calculated by counting the value of this field.
The drawbacks of this algorithm are: under the situation that the packet loss of the network port packet capturing module is serious, the total byte number of the downlink data packet cannot be accurately counted, so that a larger error (the error rate is basically in direct proportion to the severity of the packet loss rate) occurs in the calculation of the TCP download rate.
2. TCP time delay
Fig. 3 is a schematic diagram of a three-way handshake procedure in a TCP connection establishment procedure.
Generally, according to the TCP three-way handshake process, a TCP handshake packet SYN (timestamp t 0) to a handshake response packet SYN, ACK (timestamp t 1) records a round-trip process of a TCP packet, and a time duration consumed by the round-trip process is defined as a TCP delay (TCP delay = t1-t 0).
The drawbacks of this algorithm are: under the network high flow situation, both the TCP handshake packet SYN and the TCP handshake response packet SYN, ACK are likely to be lost by the packet capturing module, so that the TCP delay index cannot be calculated.
3. TCP retransmission rate
According to the TCP protocol rule, a server sends data packets to a client, if the data packets are lost in the network transmission process, the client sends a retransmission request to the server, the server retransmits the lost data packets, and the repeatedly sent data packets are called TCP retransmission packets. The calculation method of the TCP retransmission rate is as follows:
TCP retransmission rate = TCP retransmission packet number/total downlink packet number
The drawbacks of this algorithm are: under the network high-flow condition, because the packet-capturing module seriously loses the downlink TCP packet, the number of the data packets which are repeatedly transmitted and the downlink packet which is normally transmitted may not be captured, thereby causing serious distortion of the calculated TCP retransmission rate.
In view of the above, there is an urgent need to design a new IP network performance monitoring optimization method to overcome the above-mentioned defects existing in the existing IP network performance monitoring methods.
Disclosure of Invention
The technical problem to be solved by the invention is as follows: the TCP download rate calculation optimization method can improve the accuracy of TCP download rate acquisition and improve the performance and efficiency of network DPI equipment on TCP flow monitoring.
In addition, the invention also provides a method for improving the accuracy of TCPKPI calculation, which can improve the calculation accuracy of TCP download rate, TCP time delay and TCP retransmission rate indexes and improve the performance and efficiency of network DPI equipment on TCP flow monitoring.
In order to solve the technical problems, the invention adopts the following technical scheme:
a TCP download rate calculation optimization method, the method comprising:
step A1, carrying out protocol analysis on the captured TCP data stream, carrying out tracking analysis on the TCP uplink ACK message, especially analyzing the Acknowledgement sign Acknowledgement Number (ACK) field value in the TCP data stream, recording the time stamp t of the first TCP ACK packet, and shortening the ACK value of the ACK field value of the Acknowledgement sign Acknowledgement Number (ACK) 0 The ACK value of the first packet is ACK 0 ;
Step A2, extracting the time of the ACK message when receiving a new TCP uplink ACK messageStab t n And its ACK value ACK n And calculate t 0 To t n The total number of TCP download data bytes in this period, i.e. ACK n –ACK 0 (ii) a And further calculating the TCP downloading rate in the period of time, wherein the calculation formula is as follows: TCP download rate (Bps) = (ACK) n -ACK 0 )/(t n -t 0 );
Step A3, considering the condition that the ACK has the upper limit value N, judging whether the ACK value exceeds the maximum value or not in each calculation, and then generating circulation when the ACK value exceeds the maximum value n <ACK n-1 The calculation formula is as follows: TCP download rate (Bps) = (ACK) n -ACK 0 +N)/(t n -t 0 )。
As a preferred embodiment of the present invention, according to the TCP header information, the Acknowledgement Number indicates the Acknowledgement of the data stream sequence Number of the received downlink packet, the ACK value = the previous ACK value + the received downlink packet size, and according to this characteristic, the actual TCP download byte Number is reversely deduced according to the ACK difference of the uplink packet, so as to calculate the TCP download rate.
As a preferable aspect of the present invention, the initialization conditions are:
ACK 0 =0;
t 0 =0。
a method of improving the accuracy of TCPKPI calculations, the method comprising:
the TCP downloading rate calculation optimization step specifically comprises the following steps:
a1, carrying out protocol analysis on the captured TCP data stream, carrying out tracking analysis on the TCP uplink ACK message, especially analyzing the Acknowledgement sign Acknowledgement Number field value, the Acknowledgement sign Acknowledgement Number field value being called ACK value for short, and recording the timestamp t of the first TCP ACK packet 0 The ACK value of the first packet is ACK 0 ;
Step A2, extracting the time stamp t of the ACK message when receiving a new TCP uplink ACK message n And its ACK value ACK n And calculate t 0 To t n Total number of TCP download data bytes in this period, i.e.ACK n –ACK 0 (ii) a And further calculating the TCP downloading rate in the period of time, wherein the calculation formula is as follows: TCP download rate (Bps) = (ACK) n -ACK 0 )/(t n -t 0 );
Step A3, considering the condition that the ACK has the upper limit value N, judging whether the ACK value exceeds the maximum value or not in each calculation, and then generating circulation when the ACK value exceeds the maximum value n <ACK n-1 The calculation formula is as follows: TCP download rate (Bps) = (ACK) n -ACK 0 +N)/(t n -t 0 )。
As a preferred embodiment of the present invention, according to the TCP header information, the Acknowledgement Number indicates the Acknowledgement of the data stream sequence Number of the received downlink packet, the ACK value = the previous ACK value + the received downlink packet size, and according to this characteristic, the actual TCP download byte Number is reversely deduced according to the ACK difference of the uplink packet, so as to calculate the TCP download rate.
As a preferred embodiment of the present invention, the initialization conditions are:
ACK 0 =0;
t 0 =0。
a method of improving the accuracy of TCPKPI calculations, the method comprising:
step A, TCP download rate calculation optimizing step, according to the TCP header information, the Acknowledgement Number indicates the Acknowledgement of the data stream sequence Number of the received downlink packet, the ACK value = the previous ACK value + the received downlink packet size, and according to this characteristic, the actual TCP download byte Number is reversely deduced according to the ACK difference of the uplink packet, thereby calculating the TCP download rate; the method specifically comprises the following steps:
a1, carrying out protocol analysis on the captured TCP data stream, carrying out tracking analysis on the TCP uplink ACK message, especially analyzing the Acknowledgement sign Acknowledgement Number field value, the Acknowledgement sign Acknowledgement Number field value being called ACK value for short, and recording the timestamp t of the first TCP ACK packet 0 The ACK value of the first packet is ACK 0 ;
Step A2, whenever a new TCP uplink ACK message is received, the method providesThe time stamp t of the ACK message is taken out n And its ACK value ACK n And calculate t 0 To t n The total number of TCP download data bytes in this period, i.e. ACK n –ACK 0 (ii) a And further calculating the TCP downloading rate in the period of time, wherein the calculation formula is as follows: TCP download rate (Bps) = (ACK) n -ACK 0 )/(t n -t 0 );
Step A3, considering the condition that the ACK has the upper limit value N, judging whether the ACK value exceeds the maximum value or not in each calculation, and then, when the ACK value exceeds the maximum value, generating circulation n <ACK n-1 The calculation formula is as follows: TCP download rate (Bps) = (ACK) n -ACK 0 +N)/(t n -t 0 )。
Step B, TCP delay calculation step, by tracking TCP data flow, matching TCP downlink data packet sequence number value and acknowledgement data packet ACK value, finding corresponding TCP downlink data and uplink ACK acknowledgement data packet pairs, respectively extracting timestamps of uplink and downlink packets, and calculating a difference between the two timestamps, thereby obtaining TCP network delay; the method specifically comprises the following steps:
step B1, initializing TCP _ Delay _ sum =0, and initializing TCP _Delay _cnt =0;
the average TCP time Delay is expressed by TCP _ Delay _ sum/TCP _ Delay _ cnt; TCP _ Delay _ sum refers to a TCP Delay accumulated value, and TCP _ Delay _ cnt refers to the effective TCP Delay statistical times;
b2, analyzing TCP packet header information, and recording the sequence number SEQ of each downlink data packet n TCP length len n Corresponding time stamp t n Calculating ACK of corresponding TCP response message n =SEQ n +len n Thus, a set with three consistent sequence numbers of the downlink reports is obtained: a sequence number set SEQ _ AGG, a timestamp set t _ AGG and an ACK set ACK _ AGG;
step B3, recording the time stamp T of the uplink ACK packet m And ACK value ACK m If ACK is m If the packet belongs to the set ACK _ AGG, the timestamp t of the corresponding downlink packet is taken out m And calculating the TCP time delay value of the uplink and downlink TCP data packet matching pair as follows: TCP _ Delay m =T m -t m ;
And step B4, carrying out accumulative calculation on the latest TCP time delay:
TCP_Delay_sum=TCP_Delay_sum+TCP_Delay m ;
TCP_Delay_cnt=TCP_Delay_cnt+ 1;
and step B5, calculating the average TCP time delay as follows:
TCP Delay = TCP _ Delay _ sum/TCP _ Delay _ cnt.
Step C, TCP retransmission rate calculation step, through the ACK field of the packet header of the uplink TCP ACK response packet, the total packet number of the downlink TCP and the number of TCP retransmission packets are calibrated, so as to improve the calculation accuracy of the TCP retransmission rate index; the method specifically comprises the following steps:
step C1, initializing the TCP retransmission packet number R =0, the average TCP downlink packet length B =0, and initializing ACK 0 ;
Step C2, when capturing a new downlink TCP message, analyzing the packet head information of the message to obtain the packet length B n And packet sequence number SEQ n Accumulating the total number n of downlink packets; and calculates the average packet length B = ∑ (B) of the downlink TCP 0 ,B 1 ..B n )/n;
C3, comparing the sequence number SEQ of the current downlink TCP message packet n The packet sequence number SEQ of the last downlink TCP message n-1 :
If SEQ ID NO n <SEQ n-1 If the packet sequence number is in a jump back state, the packet sequence number can be determined to be SEQ n The message of (1) is a TCP retransmission packet, and the number R of the TCP retransmission packets is added with 1; simultaneously recording the ACK value of each TCP retransmission packet, thereby forming a TCP retransmission packet ACK _ AGG set;
if SEQ ID NO n >=SEQ n-1 If so, no treatment is carried out;
step C4, when capturing a new uplink TCP message, checking an ACK field of the message, and if finding that the ACK value is the same as that of the previously received uplink message, recording the ACK value of the message as ACK _ up;
step C5, comparing the ACK _ up with the members in the TCP retransmission packet ACK _ AGG set:
if the ACK _ up and the SEQ member number value are the same, no processing is carried out;
if the same condition does not exist, adding 1 to the number of the TCP retransmission packets R, and recording the ACK _ up;
step C6, calculating the total packet number T of the TCP downlink message: t = (ACK _ up-ACK) 0 )/B;
And C7, calculating the retransmission rate of the TCP = R/T100%.
The invention has the beneficial effects that: the TCP download rate calculation optimization method provided by the invention can improve the accuracy of TCP download rate acquisition and improve the performance and efficiency of network DPI equipment on TCP flow monitoring. In addition, the method for improving the TCPKPI calculation accuracy can improve the TCP download rate, the TCP time delay and the TCP retransmission rate index calculation accuracy under the condition of network packet capturing loss, and improve the performance and the efficiency of network DPI equipment on TCP flow monitoring.
Drawings
Fig. 1 is a schematic diagram illustrating a relationship between packet loss severity and network port traffic of a packet capture module.
FIG. 2 is a diagram illustrating an IP packet header format of a TCP/IP packet.
Fig. 3 is a schematic diagram of a three-way handshake flow in a TCP connection establishment process.
FIG. 4 is a flowchart of a TCP download rate calculation optimization method according to the present invention.
Fig. 5 is a flowchart of a TCP delay calculation method according to the present invention.
FIG. 6 is a flowchart of a TCP retransmission rate calculation method according to the present invention.
Detailed Description
Preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
Example one
Referring to fig. 4, the present invention discloses a TCP download rate calculation optimization method, according to the TCP header information, where the Acknowledgement Number indicates the Acknowledgement of the data stream sequence Number of the received downlink packet, the ACK value = the previous ACK value + the received downlink packet size, and according to this characteristic, the actual TCP download byte Number is reversely deduced according to the ACK difference of the uplink packet, so as to calculate the TCP download rate.
The TCP download rate calculation optimization method comprises the following steps:
step A1, performing protocol analysis on the captured TCP data stream, performing trace analysis on the TCP uplink ACK message, and particularly analyzing an Acknowledgement Number field value, which is called ACK value for short, in the TCP uplink ACK message, and recording a timestamp t of the first TCP ACK packet 0 The ACK value of the first packet is ACK 0 ;
Step A2, every time a new TCP uplink ACK message is received, extracting the time stamp t of the ACK message n And its ACK value ACK n And calculate t 0 To t n The total number of TCP download data bytes in this period, i.e. ACK n –ACK 0 (ii) a And further calculating the TCP downloading rate in the period of time, wherein the calculation formula is as follows: TCP download rate (Bps) = (ACK) n -ACK 0 )/(t n -t 0 );
Step A3, considering the situation that the ACK has an upper limit value N, judging whether the ACK value exceeds the maximum value or not in each calculation, and then, when the ACK value exceeds the maximum value, generating circulation n <ACK n-1 The calculation formula is as follows: TCP download rate (Bps) = (ACK) n -ACK 0 +N)/ (t n -t 0 )。
In this embodiment, the initialization conditions are: ACK 0 =0;t 0 =0。
Example two
The invention discloses a method for improving the accuracy of TCPKPI calculation, which comprises the following steps:
and (A) calculating and optimizing the TCP download rate, wherein according to TCP header information, acknowledgement Number indicates the confirmation of the data stream sequence Number of a received downlink packet, the size of an ACK value = the size of the last ACK value + the size of the received downlink packet, and according to the characteristic, the actual TCP download byte Number is reversely deduced according to the ACK difference value of the uplink packet, so that the TCP download rate is calculated. Referring to fig. 4, step a specifically includes:
step A1, carrying out protocol analysis on the captured TCP data stream, and carrying out tracking analysis on the TCP uplink ACK message, in particular toAnalyzing the Acknowledgement Number field value, wherein the Acknowledgement Number field value is called ACK value for short, recording the time stamp t of the first TCP ACK packet 0 The ACK value of the first packet is ACK 0 ;
Step A2, extracting the time stamp t of the ACK message when receiving a new TCP uplink ACK message n And its ACK value ACK n And calculate t 0 To t n The total number of TCP download data bytes in this period, i.e. ACK n –ACK 0 (ii) a And further calculating the TCP downloading rate in the period of time, wherein the calculation formula is as follows: TCP download rate (Bps) = (ACK) n -ACK 0 )/(t n -t 0 );
Step A3, considering the condition that the ACK has the upper limit value N, judging whether the ACK value exceeds the maximum value or not in each calculation, and then, when the ACK value exceeds the maximum value, generating circulation n <ACK n-1 The calculation formula is as follows: TCP download rate (Bps) = (ACK) n -ACK 0 +N)/(t n -t 0 )。
EXAMPLE III
The invention discloses a method for improving the accuracy of TCPKPI calculation, which comprises the following steps:
and (A) calculating and optimizing the TCP download rate, wherein according to TCP header information, acknowledgement Number indicates the confirmation of the data stream sequence Number of a received downlink packet, the size of an ACK value = the size of the last ACK value + the size of the received downlink packet, and according to the characteristic, the actual TCP download byte Number is reversely deduced according to the ACK difference value of the uplink packet, so that the TCP download rate is calculated. Referring to fig. 4, step a specifically includes:
step A1, carrying out protocol analysis on the captured TCP data stream, carrying out tracking analysis on the TCP uplink ACK message, especially analyzing the Acknowledgement sign Acknowledgement Number (ACK) field value in the TCP data stream, recording the time stamp t of the first TCP ACK packet, and shortening the ACK value of the ACK field value of the Acknowledgement sign Acknowledgement Number (ACK) 0 The ACK value of the first packet is ACK 0 ;
Step A2, every time a new TCP uplink ACK is receivedWhen the message is processed, the timestamp t of the ACK message is extracted n And its ACK value ACK n And calculate t 0 To t n The total number of TCP download data bytes in this period, i.e. ACK n –ACK 0 (ii) a And further calculating the TCP downloading rate in the period of time, wherein the calculation formula is as follows: TCP download rate (Bps) = (ACK) n -ACK 0 )/(t n -t 0 );
Step A3, considering the condition that the ACK has the upper limit value N, judging whether the ACK value exceeds the maximum value or not in each calculation, and then, when the ACK value exceeds the maximum value, generating circulation n <ACK n-1 The calculation formula is as follows: TCP download rate (Bps) = (ACK) n -ACK 0 +N)/(t n -t 0 )。
And (B) a TCP time delay calculation step, namely tracking TCP data flow, finding corresponding TCP downlink data and uplink ACK response data message pairs by matching a TCP downlink data packet sequence number value and an ACK value of an acknowledgement data packet, respectively extracting time stamps of the uplink messages and the downlink messages, and calculating the difference value of the two time stamps to obtain the TCP network time delay. Referring to fig. 5, step B specifically includes:
step B1, initializing TCP _ Delay _ sum =0, and initializing TCP _Delay _cnt =0;
the average TCP time Delay is expressed by TCP _ Delay _ sum/TCP _ Delay _ cnt; TCP _ Delay _ sum refers to a TCP Delay accumulated value, and TCP _ Delay _ cnt refers to the effective TCP Delay statistical times;
b2, analyzing TCP packet header information, and recording the sequence number SEQ of each downlink data packet n TCP length len n Corresponding time stamp t n Calculating ACK of corresponding TCP response message n =SEQ n +len n Thus, a set with three consistent sequence numbers of the downlink reports is obtained: a sequence number set SEQ _ AGG, a timestamp set t _ AGG and an ACK set ACK _ AGG;
step B3, recording the time stamp T of the uplink ACK packet m And ACK value ACK m If ACK is m If the packet belongs to the set ACK _ AGG, the timestamp t of the corresponding downlink packet is taken out m And calculating the TCP time delay value of the uplink and downlink TCP data packet matching pair as follows: TCP _ Delay m =T m -t m ;
And step B4, carrying out accumulative calculation on the latest TCP time delay:
TCP_Delay_sum=TCP_Delay_sum+TCP_Delay m ;
TCP_Delay_cnt=TCP_Delay_cnt+ 1;
and step B5, calculating the average TCP time delay as follows:
TCP Delay = TCP _ Delay _ sum/TCP _ Delay _ cnt.
And step C, calculating the TCP retransmission rate, namely, calibrating the total packet number of the downlink TCP and the retransmission packet number of the TCP through an ACK field of a packet head of an uplink TCP ACK response message so as to improve the calculation accuracy of the TCP retransmission rate index. Referring to fig. 6, step C specifically includes:
step C1, initializing the TCP retransmission packet number R =0, the average TCP downlink packet length B =0, and initializing ACK 0 ;
Step C2, when capturing a new downlink TCP message, analyzing the packet head information of the message to obtain the packet length B n And packet sequence number SEQ n Accumulating the total number n of downlink packets; and calculating the average packet length B = ∑ (B) of the downlink TCP 0 ,B 1 ..B n )/n;
Step C3, comparing the sequence number SEQ of the current downlink TCP packet n The packet sequence number SEQ of the last downlink TCP message n-1 :
If SEQ ID NO n <SEQ n-1 If the packet sequence number is in a jump back state, the packet sequence number can be determined to be SEQ n The message of (1) is a TCP retransmission packet, and the number R of the TCP retransmission packets is added with 1; simultaneously recording the ACK value of each TCP retransmission packet, thereby forming a TCP retransmission packet ACK _ AGG set;
if SEQ ID NO n >=SEQ n-1 If so, no treatment is carried out;
step C4, when capturing a new uplink TCP message, checking an ACK field of the message, and if finding that the ACK value is the same as that of the previously received uplink message, recording the ACK value of the message as ACK _ up;
step C5, comparing the ACK _ up with the members in the TCP retransmission packet ACK _ AGG set:
if the ACK _ up and the SEQ member number are the same, no processing is performed;
if the same condition does not exist, adding 1 to the number of the TCP retransmission packets R, and recording the ACK _ up;
step C6, calculating the total packet number T of the TCP downlink message: t = (ACK _ up-ACK) 0 )/B;
And C7, calculating the retransmission rate of the TCP = R/T100%.
The method also includes process initial conditions (as may be set in step C1):
setting the sequence number of the ACK uplink packet to be 0: ACK _ up =0;
setting the sequence number of the ACK downlink packet to be 0: ACK0=0;
setting the timestamp to 0: t =0.
In summary, the TCP download rate calculation and optimization method provided by the present invention reversely deduces the actual TCP download byte number according to the ACK difference of the TCP uplink packet, calculates the TCP download rate, and can overcome the defect that the packet capturing module may lose a part of the downlink packet under the high traffic condition, thereby improving the accuracy of TCP download rate acquisition and improving the performance and efficiency of the network DPI device for TCP traffic monitoring. In addition, the method for improving the TCPKPI calculation accuracy can improve the TCP downloading rate, the TCP time delay and the TCP retransmission rate index calculation accuracy, and improve the performance and the efficiency of network DPI equipment for monitoring the TCP flow.
The description and applications of the invention herein are illustrative and are not intended to limit the scope of the invention to the embodiments described above. Variations and modifications of the embodiments disclosed herein are possible, and alternative and equivalent various components of the embodiments will be apparent to those skilled in the art. It will be clear to those skilled in the art that the present invention may be embodied in other forms, structures, arrangements, proportions, and with other components, materials, and parts, without departing from the spirit or essential characteristics thereof. Other variations and modifications of the embodiments disclosed herein may be made without departing from the scope and spirit of the invention.
Claims (1)
1. A method for improving TCP KPI calculation accuracy, the method comprising:
step A, TCP download rate calculation optimizing step, according to TCP header information, acknowledgmentnumber indicates the acknowledgement of the data stream sequence number of the received downlink data packet, the ACK value = the last ACK value + the received downlink data packet size, and according to this characteristic, the actual TCP download byte number is reversely deduced according to the difference of the ACK values of the uplink data packet, thereby calculating the TCP download rate; the method specifically comprises the following steps:
step A1, carrying out protocol analysis on the captured TCP data stream, carrying out tracking analysis on the TCP uplink ACK response message, analyzing the acknowledgement sign acknowledgement number (ACK) field value in the TCP uplink ACK response message, recording the time stamp t of the first TCP ACK packet, and shortening the ACK value of the ACK number 0 The ACK value of the first packet is ACK 0 ;
Step A2, extracting the time stamp t of the ACK response message when receiving a new TCP uplink ACK response message n And its ACK value ACK n And calculate t 0 To t n The total number of TCP download data bytes in this period, i.e. ACK n –ACK 0 (ii) a And further calculating the TCP downloading rate in the period of time, wherein the calculation formula is as follows: TCP download rate = (ACK) n -ACK 0 )/(t n -t 0 ) Wherein the unit of TCP downloading rate is Bps;
step A3, considering the condition that the ACK has the upper limit value N, judging whether the ACK value exceeds the maximum value or not in each calculation, and then, when the ACK value exceeds the maximum value, generating circulation n <ACK n-1 The calculation formula is as follows: TCP download rate = (ACK) n -ACK 0 +N)/(t n -t 0 ) Wherein the unit of TCP downloading rate is Bps;
b, average TCP time delay calculation, namely tracking TCP data flow, finding corresponding TCP downlink data and uplink ACK response data message pairs by matching a TCP downlink data packet sequence number value and an uplink ACK response data packet ACK value, respectively extracting time stamps of the uplink and downlink messages, and calculating the difference value of the two time stamps to obtain TCP network time delay; the method specifically comprises the following steps:
step B1, initializing TCP _ Delay _ sum =0, and initializing TCP _Delay _cnt =0;
the average TCP time Delay is expressed by TCP _ Delay _ sum/TCP _ Delay _ cnt; TCP _ Delay _ sum refers to a TCP Delay accumulated value, and TCP _ Delay _ cnt refers to the effective TCP Delay statistical times;
b2, analyzing TCP packet header information, and recording the sequence number SEQ of each downlink data packet n TCP length len n And corresponding time stamp t n Calculating ACK of corresponding TCP ACK response message n =SEQ n +len n Thus, three sets of downlink packets are obtained: a sequence number set SEQ _ AGG, a timestamp set t _ AGG and an ACK set ACK _ AGG;
step B3, recording the time stamp T of the uplink ACK packet m And ACK value ACK m If ACK is m If the packet belongs to the set ACK _ AGG, the timestamp t of the corresponding downlink data packet is taken out m And calculating the TCP time delay value of the uplink and downlink TCP data packet matching pair as follows: TCP _ Delay m =T m -t m ;
And step B4, carrying out accumulative calculation on the latest TCP time delay:
TCP_Delay_sum=TCP_Delay_sum+TCP_Delay m ;
TCP_Delay_cnt=TCP_Delay_cnt+1;
and step B5, calculating the average TCP time delay as follows:
average TCP latency = TCP _ Delay _ sum/TCP _ Delay _ cnt;
c, TCP a retransmission rate calculating step, which is to calibrate the total number of downlink TCP packets and the number of TCP retransmission packets by using an ACK field of an uplink TCP ACK response packet header, so as to improve the calculation accuracy of a TCP retransmission rate index; the method specifically comprises the following steps:
step C1, initializing the number of TCP retransmission packets R =0, the average TCP downlink data packet length B =0, and initializing ACK 0 ;
Step C2, when capturing a new downlink TCP message, analyzing the packet head information of the message to obtain the packet length B n And packet sequence number SEQ n Accumulating the total number n of downlink packets; and calculate underRow TCP average packet length B = ∑ (B) 0 ,B 1 ...B n )/n;
Step C3, comparing the sequence number SEQ of the current downlink TCP packet n The packet sequence number SEQ of the last downlink TCP message n-1 :
If SEQ ID NO n <SEQ n-1 If the packet sequence number is in a jump back state, the packet sequence number can be determined to be SEQ n The message of (1) is a TCP retransmission packet, and the number R of the TCP retransmission packets is added with 1; simultaneously recording the ACK value of each TCP retransmission packet, thereby forming a TCP retransmission packet ACK _ AGG set;
if SEQ ID NO n >=SEQ n-1 If so, no treatment is carried out;
step C4, when capturing a new uplink TCP message, checking an ACK field of the message, and if finding that the ACK value is the same as that of the previously received uplink message, recording the ACK value of the message as ACK _ up;
step C5, comparing the ACK _ up with the members in the TCP retransmission packet ACK _ AGG set:
if the ACK _ up is the same as the member value, no processing is carried out;
if the same condition does not exist, adding 1 to the number of the TCP retransmission packets R, and recording the ACK _ up;
step C6, calculating the total packet number T of the TCP downlink message: t = (ACK _ up-ACK) 0 )/B;
And C7, calculating the retransmission rate of the TCP = R/T100%.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810351996.9A CN110391953B (en) | 2018-04-19 | 2018-04-19 | Method for improving TCP KPI calculation accuracy |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810351996.9A CN110391953B (en) | 2018-04-19 | 2018-04-19 | Method for improving TCP KPI calculation accuracy |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110391953A CN110391953A (en) | 2019-10-29 |
CN110391953B true CN110391953B (en) | 2023-03-28 |
Family
ID=68283466
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810351996.9A Active CN110391953B (en) | 2018-04-19 | 2018-04-19 | Method for improving TCP KPI calculation accuracy |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110391953B (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110401575A (en) * | 2018-04-24 | 2019-11-01 | 德科仕通信(上海)有限公司 | A kind of TCP time-delay calculation method and the method for improving TCP KPI accuracy in computation |
CN110401574A (en) * | 2018-04-24 | 2019-11-01 | 德科仕通信(上海)有限公司 | A kind of TCP retransmission rate calculation method, the method for improving TCP KPI accuracy in computation |
CN113347107B (en) * | 2020-03-02 | 2022-10-14 | ***通信集团浙江有限公司 | Flow scheduling method and device based on uplink message and computing equipment |
CN114390570B (en) * | 2020-10-20 | 2023-11-21 | ***通信集团北京有限公司 | Network rate detection method, device, equipment and computer storage medium |
CN113904960B (en) * | 2021-12-06 | 2022-03-15 | 上海金仕达软件科技有限公司 | Method, device, system and storage medium for measuring data transmission delay |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103595584A (en) * | 2013-11-13 | 2014-02-19 | 德科仕通信(上海)有限公司 | Method and system for diagnosing Web application performance problem |
CN106899510A (en) * | 2015-12-18 | 2017-06-27 | 华为技术有限公司 | A kind of transmission rate control and device based on iSCSI protocol |
-
2018
- 2018-04-19 CN CN201810351996.9A patent/CN110391953B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103595584A (en) * | 2013-11-13 | 2014-02-19 | 德科仕通信(上海)有限公司 | Method and system for diagnosing Web application performance problem |
CN106899510A (en) * | 2015-12-18 | 2017-06-27 | 华为技术有限公司 | A kind of transmission rate control and device based on iSCSI protocol |
Also Published As
Publication number | Publication date |
---|---|
CN110391953A (en) | 2019-10-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110391953B (en) | Method for improving TCP KPI calculation accuracy | |
US11689461B2 (en) | Systems, apparatuses and methods for network packet management | |
EP3535932B1 (en) | Application characterization using transport protocol analysis | |
Sengupta et al. | Continuous in-network round-trip time monitoring | |
CN104113884B (en) | Real-time multimedia transfer rate control mechanism in a kind of wireless network | |
US11936930B2 (en) | Data processing method, server, and data collection device | |
WO2007033555A1 (en) | Method, device and system for obtaining link performance parameter | |
JP5440200B2 (en) | Relay device and bandwidth control method | |
CN110401574A (en) | A kind of TCP retransmission rate calculation method, the method for improving TCP KPI accuracy in computation | |
WO2017132987A1 (en) | Method and system for recognizing packet loss type in data transmission of reliable transmission protocol | |
CN110401575A (en) | A kind of TCP time-delay calculation method and the method for improving TCP KPI accuracy in computation | |
US20140086091A1 (en) | Method, apparatus, and system for analyzing network transmission characteristic | |
KR100943728B1 (en) | The per link available bandwidth measurement method using the total length field in IP packet header and the available bandwidth information of a link management method | |
JP2004140596A (en) | Method and system for estimating quality in data transfer on transmission control protocol | |
CN113923133B (en) | Quality of experience index monitoring method for encrypted webpage traffic based on QUIC | |
Schulte et al. | On detecting TCP path saturation in LTE networks | |
Yang et al. | Towards measuring the deployment information of different TCP congestion control algorithms: The multiplicative decrease parameter | |
OZAWA et al. | Tantalum dry-etching characteristics for X-ray mask fabrication | |
Shang et al. | Making better use of all those TCP ACK Packets | |
Pinar | Passive queue size estimation from a middlebox in TCP/IP networks |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |