Patent Description:
Reliable transport protocols are widely used in a network (for example, the Internet), such as a transmission control protocol (Transmission Control Protocol, TCP) and a stream control transmission protocol (Stream Control Transmission Protocol, SCTP). At present, traffic of at least <NUM>% of services on the Internet, for example, a video service and a download service, is transmitted based on the TCP protocol. In the network, when there is a relatively severe transmission performance problem, for example, when there is a relatively severe packet loss or latency, service quality may decline. Therefore, network performance detection is important for evaluating the service quality.

In the prior art, generally, each network device reports statistics information of a received packet (for example, a receiving time of the packet or a quantity of received packets) to an evaluation device, and the evaluation device determines a network performance indicator such as a packet loss or a latency based on the statistics information uploaded by each network device, for example, determines a latency between two network devices based on times at which the two network devices receive a same packet and that are uploaded by the two network devices.

When performing the network performance detection according to the prior art, each network device needs to report the statistics information obtained by the network device to the evaluation device, and consequently, it is complex to implement the network performance detection and efficiency is relatively low. <CIT> describes a delay time measure, in which a sequence number, data length, and receiving time of a data packet transmitted from a source unit to a destination unit are stored in a storage section. In addition, an ACK number and receiving time of an ACK packet returned from the destination unit to the source unit are stored in the storage section. After that, a calculation section obtains an ACK packet an ACK number of which is equal to a value obtained by adding data length of a second data packet of two successive data packets transmitted without waiting for the ACK packet to a sequence number of the second data packet of the two successive data packets from the storage section. Then the calculation section calculates round trip time from receiving time of the second data packet of the two successive data packets and receiving time of the ACK packet obtained. The <CIT> refers to a detecting packet loss and retransmission in a network environment.

Embodiments of the present invention provide a method for implementing transmission performance detection, an apparatus, and a system, to resolve a problem in the prior art that the transmission performance detection efficiency is relatively low.

To describe the technical solutions in embodiments of the present invention more clearly, the following briefly describes the accompanying drawings required for the embodiments.

The following describes embodiments of the present invention with reference to the accompanying drawings.

<FIG> is a schematic diagram of a networking structure of a communications system <NUM> according to an embodiment of the present invention. The communications system <NUM> includes a first communications device <NUM>, at least one transmission device <NUM>, and a second communications device <NUM>. A connection based on a reliable transport protocol may be established between the first communications device <NUM> and the second communications device <NUM>, packets are transmitted through the connection, and then the packets transmitted through the connection are transmitted by using the at least one transmission device <NUM>. The reliable transport protocol may be specifically a TCP, an SCTP, or the like.

The packets include a data packet and an acknowledgment packet used to acknowledge the data packet, such as an ACK packet. The data packet is typically a packet that carries communication data. It should be noted that an acknowledgment packet sent by one of the first communications device <NUM> and the second communications device <NUM> (which is referred to as a communications device A below) to the other communications device (which is referred to as a communications device B) through the connection may also carry data. In this case, the acknowledgment packet is used as not only the acknowledgment packet sent by the communications device A to the communications device B but also a data packet sent by the communications device B to the communications device A. For any data packet sent by the communications device A to the communications device B, the communications device B usually notifies, by using the acknowledgment packet, the communications device A whether the data packet has been received, and if the data packet is lost, the communications device A usually retransmits the data packet.

A sequence number of a data packet sent by the communications device A to the communications device B through the connection complies with a specific rule. For example, when the reliable transport protocol is the TCP or the SCTP, for any two adjacent data packets, a sequence number of the later data packet is equal to a sequence number of the former data packet plus a payload length of the previous data packet.

It should be noted that the communications device A may alternatively send, to the communications device B through the connection, a packet that does not carry communication data, and a payload length of the packet that does not carry the communication data is <NUM>. When the reliable transport protocol is the TCP or the SCTP, for any two packets, a sequence number of the later packet (which may be a data packet, or may be a packet that does not carry the communication data) is equal to a sequence number of the former packet (which may be a data packet, or may be a packet that does not carry the communication data) plus a payload length of the former packet. Because the payload length of the packet that does not carry the communication data is <NUM>, when the communications device A sends, through the connection, the data packet and the packet that does not carry the communication data to the communications device B, for any two adjacent data packets, a rule that a sequence number of the later data packet is equal to a sequence number of the former data packet plus a payload length of the former data packet is complied with.

For any packet that does not carry the communication data and that is sent by the communications device A to the communications device B, the communications device B does not usually notify, by using an acknowledgment packet, the communications device A whether the packet has been received, and if the packet is lost, the communications device A does not usually retransmit the packet.

Both the first communications device <NUM> and the second communications device <NUM> may be terminals or servers. For example, the first communications device is a video terminal, such as a set top box (Set Top Box, STB), and the second communications device is a video server, such as an internet protocol television (Internet Protocol Television, IPTV) headend. For another example, both the first communications device and the second communications device are call terminals.

The transmission devices <NUM> may specifically include devices such as a home gateway, a core router (Core Router, CR), a broadband network gateway (Broadband Network Gateway, BNG), an optical line terminal (Optical Line Terminal, OLT), and a broadband remote access server (Broadband Remote Access Server, BRAS).

A data packet (such as a packet in which video data is encapsulated) sent by one of the first communications device <NUM> and the second communications device <NUM> (which is referred to as a sending device below) is transmitted by using the transmission device <NUM> to the other communications device (which is referred to as a receiving device below), and an acknowledgment packet that is sent by the receiving device and that is used to acknowledge a received data packet is transmitted by using the transmission device <NUM> to the first communications device <NUM>.

During specific implementation, the communications system <NUM> may be specifically an IPTV system as shown in <FIG>. In the IPTV system, the sending device (for example, the first communications device <NUM>) may be specifically an IPTV headend, and the receiving device may be specifically a set top box.

The following describes Embodiments <NUM> to <NUM> of the present invention with reference to <FIG>/<FIG>, <FIG>/ <FIG>, and <FIG> respectively. The methods in the Embodiments <NUM> to <NUM> of the present invention may be applied to the communications system <NUM> shown in <FIG>.

In Embodiments <NUM> to <NUM> of the present invention, the connection is established between the first communications device and the second communications device based on the reliable transport protocol (such as the TCP), and the packet is transmitted through the connection.

During specific implementation, one of the first communications device and the second communications device may send a data packet to the other communications device, or the first communications device and the second communications device each send a data packet to the other communications device.

Subsequently, one of the first communications device and the second communications device that sends the data packet is referred to as a sending device, and the other communications device is referred to as a receiving device.

For example, the first communications device is an STB, the second communications device is an IPTV headend, the IPTV headend sends a video stream to the STB, the IPTV headend is referred to as the sending device, and the STB is referred to as the receiving device.

For another example, both the first communications device and the second communications device are call devices and can send the data packet to each other. When transmission performance detection is being performed based on the data packet sent by the first communications device to the second communications device, the first communications device is referred to as the sending device, and the second communications device is referred to as the receiving device. Alternatively, when the transmission performance detection is being performed based on the data packet sent by the second communications device to the first communications device, the second communications device is referred to as the sending device, and the first communications device is referred to as the receiving device.

In Embodiment <NUM> and Embodiment <NUM> of the present invention, a detection apparatus configured to implement the transmission performance detection may be deployed in the communications system, and the detection apparatus may be implemented by using software, hardware, firmware, or any combination thereof.

The detection apparatus may be built into a transmission device in the communications system, and correspondingly, the detection apparatus receives a packet by using the transmission device into which the detection apparatus is built. If the detection apparatus is implemented by using hardware, a processor of the device into which the detection apparatus is built may send a received packet to the detection apparatus in a mirroring manner.

The detection apparatus may alternatively be deployed in a bypass mode on any device of the communications system and may obtain, in the mirroring manner, a packet transmitted by the device on which the detection apparatus is deployed in the bypass mode.

The detection apparatus may obtain, in the foregoing manner, the packet transmitted between the first communications device and the second communications device through the connection, and perform the transmission performance detection based on the obtained packet.

It should be noted that, in Embodiment <NUM> and Embodiment <NUM> of the present invention, a packet loss occurring between the sending device and the detection apparatus may be used to indicate a packet loss occurring between the sending device and the device into which the detection apparatus is built or the device on which the detection apparatus is deployed in the bypass mode, and a latency between the sending device and the detection apparatus may be used to indicate a latency between the sending device and the device into which the detection apparatus is built or the device on which the detection apparatus is deployed in the bypass mode. Similarly, in Embodiment <NUM> and Embodiment <NUM> of the present invention, a packet loss occurring between the detection apparatus and the receiving device may be used to indicate a packet loss occurring between the device into which the detection apparatus is built or the device on which the detection apparatus is deployed in the bypass mode and the receiving device. In the embodiments of the present invention, a latency between the detection apparatus and the receiving device may be used to indicate a latency between the device into which the detection apparatus is built or the device on which the detection apparatus is deployed in the bypass mode and the receiving device.

In addition, the detection device described in Embodiment <NUM>, Embodiments <NUM> and <NUM>, and Embodiments <NUM> and <NUM> below may be any device in the communications system, such as the sending device, the transmission device, or the receiving device.

For ease of subsequent description, terms in the embodiments of the present invention are first explained before the embodiments of the present invention are described in detail.

An upstream packet loss is a packet loss occurring between the sending device and the detection apparatus, and may be specifically used to indicate the packet loss occurring between the sending device and the device into which the detection apparatus is built, or the packet loss occurring between the sending device and the device on which the detection apparatus is deployed in the bypass mode.

A downstream packet loss is a packet loss occurring between the detection apparatus and the receiving device, and may be specifically used to indicate the packet loss occurring between the device into which the detection apparatus is built and the receiving device, or the packet loss occurring between the device on which the detection apparatus is deployed in the bypass mode and the receiving device.

<FIG> and <FIG> are schematic flowcharts of a method according to Embodiment <NUM> of the present invention Packet loss detection can be implemented by using the method. In Embodiment <NUM> of the present invention, a detection apparatus may be built into or deployed in a bypass mode on any transmission device in the communications system <NUM>. As shown in <FIG> and <FIG>, the method provided in Embodiment <NUM> of the present invention includes the following steps.

It should be noted that <FIG> shows merely an example in which the detection apparatus is deployed in the bypass mode on the transmission device for illustration, and a step of sending, by the transmission device on which the detection apparatus is deployed in the bypass mode, a received packet to the detection apparatus in a mirroring way and a step of sending the received packet to the receiving device are not performed in a specific order.

Step <NUM>: After successively receiving data packets whose sequence numbers are N1 and N2 and that are sent by a sending device through a connection, the detection apparatus determines that N2 is greater than N1 and that N1 and N2 are inconsecutive.

In this embodiment of the present invention, if N1 and N2 are sequence numbers of two adjacent data packets, N1 and N2 are considered consecutive, or if N1 and N2 are sequence numbers of two non-adjacent data packets, N1 and N2 are considered inconsecutive.

If the reliable transport protocol is a TCP or an SCTP, when N1 and N2 are consecutive, N2 is equal to N1 + LenN1, where LenN1 is a payload length of the data packet whose sequence number is N1. Correspondingly, if N2 is greater than N1 + LenN1, N1 and N2 are considered inconsecutive, that is, the data packet whose sequence number is N1 and the data packet whose sequence number is N2 are not adjacent.

It should be noted that the sending device may further send, through the connection, a packet that does not carry communication data, such as a control packet. In Embodiment <NUM> and Embodiment <NUM> of the present invention, the detection apparatus may further identify a data packet. When the reliable transport protocol is the TCP or the SCTP, a payload length of the packet that does not carry the communication data is <NUM>, and specifically, the detection apparatus may identify the data packet based on a payload length of a received packet.

For ease of description, when an example is used for description, it is assumed that a payload length of each data packet is <NUM>.

For example, if the detection apparatus has first received a data packet whose sequence number is <NUM> and whose payload length is <NUM>, a sequence number of a next data packet that is expected to be received at present is <NUM> (that is, <NUM> + <NUM>). If a data packet whose sequence number is <NUM> is received at present, the data packet whose sequence number is <NUM> and a data packet whose sequence number is <NUM> are not received before the data packet whose sequence number is <NUM> is received. Such a case in which sequence numbers of two data packets successively received are inconsecutive may be referred to as a sequence number black hole phenomenon, for example, the sequence numbers of the two data packets successively received are <NUM> and <NUM>. A sequence number range that is bounded by sequence numbers of a pair of data packets that are successively received but whose sequence numbers are inconsecutive is referred to as a sequence number black hole. For example, a sequence number range bounded by <NUM> and <NUM> is (<NUM>, <NUM>), where the sequence number range is an open interval and does not include boundary values. Correspondingly, a data packet whose sequence number is located between the sequence numbers of the two data packets successively received, for example, data packets whose sequence numbers are <NUM> and <NUM>, can be referred to as a black hole packet. The black hole packet may be an out-of-order packet or a retransmitted packet.

By performing step <NUM>, the detection apparatus detects a sequence number black hole between the sequence number N1 and the sequence number N2 (that is, a sequence number black hole bounded by N1 and N2).

Step <NUM>: After receiving the data packet whose sequence number is N2, the detection apparatus receives a data packet whose sequence number is M1, and determines whether M1 is greater than N1 and less than N2, that is, determines whether M1 belongs to the sequence number black hole bounded by N1 and N2.

If it is determined that M1 is greater than N1 and less than N2, that is, if it is determined that the sequence number M1 belongs to the sequence number black hole bounded by N1 and N2, the data packet whose sequence number is M1 may be an out-of-order packet, or may be a retransmitted packet corresponding to an upstream packet loss.

For example, in step <NUM>, the sequence numbers of two data packets successively received are <NUM> and <NUM> (that is, N1 is <NUM>, and N2 is <NUM>), and in step <NUM>, the data packet whose sequence number is <NUM> (that is, M1 is <NUM>) is received. In this case, the sequence number <NUM> belongs to the sequence number black hole bounded by <NUM> and <NUM>.

It is assumed that a sequence number of a latest data packet received before the data packet whose sequence number is M1 is received is N3, that is, the data packet whose sequence number is N3 and the data packet whose sequence number is M1 are successively received, and N3 is greater than or equal to N2. If M1 is less than N3, it may be preliminarily determined that the data packet whose sequence number is M1 is an out-of-order packet or a retransmitted packet.

Further, if it is determined that M1 is greater than N1 and less than N2, that is, if it is determined that the sequence number M1 belongs to the sequence number black hole bounded by N1 and N2, the data packet whose sequence number is M1 may be an out-of-order packet or the retransmitted packet corresponding to the upstream packet loss. If M1 does not belong to any sequence number black hole before the data packet whose sequence number is M1, that is, if M1 is not between N1 and N2 and does not fall into another sequence number black hole, it may be determined that the data packet whose sequence number is M1 is a retransmitted packet corresponding to a downstream packet loss. In other words, the data packet that was sent by the sending device before and whose sequence number is M1 is lost between the detection apparatus and the receiving device, and a currently received data packet whose sequence number is M1 is the retransmitted packet. When it is determined that the data packet whose sequence number is M1 is the retransmitted packet corresponding to the downstream packet loss, a quantity of lost downstream packets may be added by one, or a quantity of all lost packets may be added by one.

It should be noted that N3 may be equal to N2, and <FIG> may not show a transmission process of the data packet whose sequence number is N3.

If it is determined that M1 is greater than N1 and less than N2, by performing the following step <NUM>, whether the data packet whose sequence number is M1 is an out-of-order packet or a retransmitted packet corresponding to the upstream packet loss is determined.

Step <NUM>: The detection apparatus determines whether T2 - T1 is greater than or equal to an RTT, and if T2 - T1 is greater than or equal to the RTT, determines that the data packet whose sequence number is M1 is a retransmitted packet corresponding to the upstream packet loss; that is, the data packet that was sent by the sending device before and whose sequence number is M1 is lost between the sending device and the detection apparatus, and a currently received data packet whose sequence number is M1 is the retransmitted packet. T1 is a time at which the detection apparatus receives the data packet whose sequence number is N2, T2 is a time at which the detection apparatus receives the data packet whose sequence number is M1, and the RTT is a two-way latency between the sending device and the receiving device. For a specific manner in which the RTT is determined, refer to the specific embodiment in the following Embodiment <NUM>.

When it is determined that the data packet whose sequence number is M1 is a retransmitted packet corresponding to the upstream packet loss, a quantity of lost upstream packets may be added by one, or the quantity of all lost packets may be added by one. In addition, if T2 - T1 is less than the RTT, it is determined that the data packet whose sequence number is M1 is an out-of-order packet. Because the out-of-order packet can be identified, packet loss misdetection can be eliminated, so that packet loss detection can be implemented more accurately, and in addition, an out-of-order situation can be detected, so that transmission performance detection can be implemented more comprehensively and accurately.

In addition, a same sequence number black hole may include more than one data packet. Therefore, after the data packet whose sequence number is M1 is received, another data packet (whose sequence number is assumed to be M2, and usually, M2 is greater than M1) in the same sequence number black hole may be further received. In a first implementation, when it is determined that the data packet whose sequence number is M1 is a retransmitted packet corresponding to the upstream packet loss, it may be directly determined that the data packet whose sequence number is M2 is also a retransmitted packet corresponding to the upstream packet loss; however, after it is determined that the data packet whose sequence number is M1 is an out-of-order packet, a time at which the detection apparatus receives the data packet whose sequence number is M2 is expressed as T2, and then whether the data packet whose sequence number is M2 is an out-of-order packet or a retransmitted packet corresponding to the upstream packet loss is determined by performing step <NUM>. In a second implementation, for each data packet (whose sequence number is assumed to be W) that falls into the foregoing sequence number black hole, a time at which the detection apparatus receives the data packet whose sequence number is W is expressed as T2, and then whether the data packet whose sequence number is W is an out-of-order packet or a retransmitted packet corresponding to the upstream packet loss is determined by performing step <NUM>.

Further, the method may further include step <NUM>.

Step <NUM>: After a detection period ends, the detection apparatus performs statistics collection on packet loss indicators in the detection period.

In step <NUM>, statistics collection can be performed on one or more of the following: an upstream packet loss rate UPLR, a downstream packet loss rate DPLR, or a total packet loss rate TPLR.

The upstream packet loss rate UPLR in the detection period may be determined based on a quantity of lost upstream packets ULNum in the detection period, where the quantity of lost upstream packets ULNum is a quantity of data packets that are lost between the sending device and the detection apparatus. Specifically, the upstream packet loss rate UPLR may be calculated by using the following formula: UPLR = ULNum/TNum, where TNum is a quantity of all data packets that are received in the detection period and that are sent by the sending device through the connection.

The total packet loss rate TPLR in the detection period may be determined based on a quantity of all lost packets TLNum in the detection period, where the quantity of all lost packets is a quantity of data packets that are lost between the sending device and the receiving device. Specifically, the total packet loss rate TPLR may be calculated by using the following formula: TRLR = TLnum/TNum.

Specifically, after a detection period ends, the downstream packet loss rate DPLR in the detection period may be determined based on a quantity of lost downstream packets DLNum in the detection period, where the quantity of lost downstream packets is a quantity of data packets that are lost between the detection apparatus and the receiving device. Specifically, the downstream packet loss rate DPLR may be calculated by using the following formula: DPLR = DLNum/ TNum. If only the quantity of lost upstream packets and the quantity of all lost packets are counted in step <NUM> and step <NUM>, the quantity of lost downstream packets DLNum can be calculated based on ULNum and TLNum. According to Embodiment <NUM> of the present invention, by identifying a sequence number of a received data packet and a time at which the data packet is received, the detection apparatus can perform packet loss detection itself, so that implementation is easy and efficiency is relatively high.

<FIG> and <FIG> are schematic flowcharts of a method according to Embodiment <NUM> of the present invention. Latency detection can be implemented by using the method. In Embodiment <NUM> of the present invention, a detection apparatus may be built into or deployed in a bypass mode on any transmission device in a communications system <NUM>. As shown in <FIG> and <FIG>, the method provided in Embodiment <NUM> of the present invention includes the following steps.

Step <NUM>: The detection apparatus obtains a time T3 at which a data packet whose sequence number is K1 and that is sent by a sending device through a connection that is based on a reliable transport protocol and that is established between the sending device and a receiving device is received.

The detection apparatus may obtain, at a preset time interval, a time at which a current data packet is received, for example, obtain, at a time interval of <NUM> seconds, a time at which a current data packet is received. The detection apparatus may alternatively obtain, at a specified time or when receiving a detection instruction, the time at which the current data packet is received.

For example, a data packet whose sequence number is <NUM> is currently received, and a time T3 at which the data packet is received is obtained.

Step <NUM>: When the detection apparatus determines that a target acknowledgment packet sent by the receiving device through the connection is received, a time T4 at which the detection apparatus receives the target acknowledgment packet is obtained, and a two-way latency DRTT between the detection apparatus and the receiving device is computed based on T3 and T4, where the target acknowledgment packet is a first acknowledgment packet that is received by the detection apparatus and that indicates that the receiving device has received the data packet whose sequence number is K1 or a data packet following the data packet whose sequence number is K1.

When the reliable transport protocol is a transmission control protocol TCP or a stream control transmission protocol SCTP, the target acknowledgment packet may be specifically the first acknowledgment packet that is received by the detection apparatus and whose value of a latest right edge (right edge) field of an acknowledgment number field or a selective acknowledgment (Selective Acknowledgment, SACK) field is greater than or equal to K1 + LenK1, where LenK1 is a payload length of the data packet whose sequence number is K1.

An acknowledgment number is carried in the acknowledgment number field of the acknowledgment packet.

If both the data packet whose sequence number is K1 and a data packet followed by the data packet whose sequence number is K1 are successfully received by the receiving device, the target acknowledgment packet is usually the first acknowledgment packet that is received by the detection apparatus and whose value of the acknowledgment number field included in the first acknowledgment packet is greater than or equal to K1 + LenK1.

If the data packet whose sequence number is K1 is successfully received by the receiving device but one or more data packets whose sequence numbers are less than K1 are lost, the target acknowledgment packet is usually the first acknowledgment packet that is received by the detection apparatus and whose value of the latest right edge field of the SACK field included in first acknowledgment packet is equal to K1 + LenK1, or may be the first acknowledgment packet that is received by the detection apparatus and whose value of the latest right edge field of the SACK field included in first acknowledgment packet is greater than K1 + LenK1.

If the data packet whose sequence number is K1 is lost, the target acknowledgment packet is usually the first acknowledgment packet that is received by the detection apparatus and whose valued of the latest right edge of the SACK field included in the first acknowledgment packet is greater than K1 + LenK1.

It is assumed that an adjacent data packet before the data packet whose sequence number is K1 is a data packet whose sequence number is K2 and whose payload length is LenK2. An acknowledgment number carried in the acknowledgment packet used to acknowledge the data packet K2 followed by the data packet whose sequence number is K1 may be specifically K1 (that is, K1 is equal to K2 + LenK2). The acknowledgment packet that is sent by the receiving device to the sending device and in which the acknowledgment number K1 is carried is used to indicate that the data packet whose sequence number is K2 has been received. If the receiving device does not receive the data packet whose sequence number is K1 in a preset period, the receiving device sends again the acknowledgment packet in which the acknowledgment number K1 is carried (which is referred to as a duplicate acknowledgment packet below) until the data packet whose sequence number is K1 is received.

It should be noted that, if a data packet whose sequence number is greater than K1 is also received before the duplicate acknowledgment packet is sent, a SACK field of the duplicate acknowledgment packet may carry information used to indicate that the data packet whose sequence number is greater than K1 has been received. For example, if the receiving device successively receives data packets whose sequence numbers are <NUM>, <NUM>, <NUM>, <NUM>, <NUM>, and <NUM> and does not receive a data packet whose sequence number is <NUM> before receiving the data packet whose sequence number is <NUM>, an acknowledgment number carried in the sent duplicate acknowledgment packet is <NUM> and is used to acknowledge that the data packet whose sequence number is <NUM> has been received, and a SACK field of the duplicate acknowledgment packet includes [<NUM><NUM>] and [<NUM><NUM>], where the [<NUM><NUM>] whose left bound is <NUM> and whose right bound is <NUM> is used to acknowledge that the data packets whose sequence numbers are <NUM> and <NUM> have been received, and [<NUM><NUM>] whose left bound is <NUM> and whose right bound is <NUM> is used to acknowledge that data packets whose sequence numbers are <NUM>, <NUM>, and <NUM> have been received, where <NUM> is a value of a latest right edge field.

Correspondingly, when a data packet whose sequence number is less than or equal to K1 is lost, the detection apparatus detects the value of the latest right edge field of the SACK field in the duplicate acknowledgment packet after receiving each duplicate acknowledgment packet. Once an acknowledgment packet that carries a latest right edge field of which a value is greater than or equal to K1 + LenK1 is detected, the two-way latency DRTT between the detection apparatus and the receiving device may be computed based on a time at which the data packet whose sequence number is K1 is received and a time at which the detected duplicate acknowledgment packet is received.

Step <NUM>: Compute the two-way latency DRTT between the detection apparatus and the receiving device based on T3 and T4.

The two-way latency between the detection apparatus and the receiving device is usually referred to as a downstream two-way latency.

The detection apparatus may compute the DRTT in step <NUM> directly based on T3 and T4 in a detection process, and specifically, may use a difference between T3 and T4 as the DRTT; or may obtain a plurality of groups of T3 and T4 many times in a statistical period based on the steps prior to step <NUM>, for example, obtain a group of T3 and T4 in each detection period, and compute the DRTT in step <NUM> based on the plurality of groups of T3 and T4, and specifically, may use an average value of differences between T3 and T4 of all the groups as the DRTT.

In addition, in Embodiment <NUM> of the present invention, a two-way latency URTT (which is usually referred to as an upstream two-way latency) between the sending device and the detection device may be computed in the following manner.

Specifically, before step <NUM>, in a process of establishing, between the sending device and the receiving device, the connection that is based on the reliable transport protocol, one device sends, as a client to another device, a request message used to request for establishment of the connection, and the other device returns, as a server to the client, a response message in response to the request message. The request message may be specifically an SYN message, and correspondingly, the response message may be an SYN ACK message.

In the process of establishing the connection between the sending device and the receiving device, the detection apparatus may receive the request message and the response message that are used to establish the connection, and may compute a latency between the server and the detection apparatus based on a time T5 at which the request message is received and a time T6 at which the response message is received, and specifically, may determine a difference between the T5 and the T6 as the latency between the server and the detection apparatus. If the sending device is used as the server, it is determined that the latency between the server and the detection apparatus is the URTT.

Further, the two-way latency between the sending device and the receiving device may be computed by using RTT = URTT + DRTT.

According to Embodiment <NUM> of the present invention, the detection apparatus computes the latency based on a time at which a data packet is sent and the time at which the target acknowledgment packet is received. Therefore, the detection apparatus can perform latency detection itself, so that implementation is easy and efficiency is relatively high.

During specific implementation, Embodiment <NUM> and Embodiment <NUM> may be implemented in combination. For example, the RTT in step <NUM> in Embodiment <NUM> may be specifically computed based on the implementation of Embodiment <NUM>.

It should be noted that, when the detection apparatus is built into the transmission device, in Embodiment <NUM> and Embodiment <NUM> of the present invention, for the information (for example, the data packet, the acknowledgment packet, the request message, or the response message, which is referred to as information A below) that is received by the detection apparatus and that is transmitted between the sending device and the receiving device, the time at which the detection apparatus receives the information A may be specifically the time at which the transmission device into which the detection apparatus is built receives or sends the information A.

If the detection apparatus is built into a port that is of the device and that is configured to receive the information A, in Embodiment <NUM> and Embodiment <NUM> of the present invention, the time at which the detection apparatus receives the information A is usually the time at which the device into which the detection apparatus is built receives the information A. Correspondingly, the detection apparatus may use the time at which the information A arrives at the detection apparatus as the time at which the detection apparatus receives the information A, or may use the time at which the transmission device into which the detection apparatus is built receives the information A as the time at which the detection apparatus receives the information A.

If the detection apparatus is built into the port that is of the device and that is configured to receive the information A, in Embodiment <NUM> and Embodiment <NUM> of the present invention, the time at which the detection apparatus receives the information A is usually the time at which the device into which the detection apparatus is built sends the information A. Correspondingly, the detection apparatus may use the time at which the information A arrives at the detection apparatus as the time at which the detection apparatus receives the information A, or may use the time at which the transmission device into which the detection apparatus is built sends the information A as the time at which the detection apparatus receives the information A.

<FIG> is a schematic flowchart of a method according to Embodiment <NUM> of the present invention. Packet loss detection and latency detection can be implemented by using the method. The detection method is applied to a communications system, the communications system includes a sending device, a receiving device, and at least one transmission device, the sending device and the receiving device transmit a packet through a connection that is based on a reliable transport protocol and that is established between the sending device and the receiving device, and the packet is transmitted by using the at least one transmission device. As shown in <FIG>, the method provided in Embodiment <NUM> of the present invention includes the following steps.

Step <NUM>: A first detection device generates a detection packet and sends the detection packet through the connection, where the detection packet has an empty payload, and the detection packet includes a quantity Num1 of counted packets that the first detection device has sent through the connection in a current detection period.

The first detection device may be specifically the sending device, or may be any transmission device located between the sending device and the receiving device, such as a CR. If the first detection device is a transmission device, Num1 is specifically the quantity of counted packets that the first detection device has transmitted through the connection in the current detection period.

During specific implementation, the first detection device may periodically generate the detection packet, and the current detection period may be a difference between a time at which a previous detection packet is generated and a time at which a current detection packet is generated. If it is determined, based on the detection period, that the detection packet is to be generated after a packet whose sequence number is J1 is sent, a sequence number of the generated detection packet may be J1 + LenJ1, and the detection packet may be sent after the packet whose sequence number is J1 is sent.

The counted packets may be all or some packets that are sent by the first detection device to the receiving device through the connection. During specific implementation, the packets sent by the first detection device to the receiving device include a data packet, or may include a packet that does not carry communication data, such as a control packet. The first detection device may count a quantity of all packets that have been sent to the receiving device through the connection in the current detection period, that is, the counted packets include packets of all types, and the first detection device does not distinguish between the types of packets when counting the quantity of sent packets. Alternatively, the first detection device may count a quantity of packets of a preset type (for example, the data packets) that have been sent to the receiving device through the connection in the current detection period, that is, the counted packets are the packets of the preset type.

Step <NUM>: A second detection device receives the detection packet and determines a quantity Num2 of counted packets that have been received through the connection in the current detection period, where Num1 and Num2 are used to determine whether one or more of the counted packets transmitted between the first detection device and the second detection device in the current detection period are lost.

The second detection device may be specifically the receiving device or any transmission device located between the first detection device and the receiving device, such as an OLT. When the second detection device is a transmission device located between the first detection device and the receiving device, Num2 is specifically the quantity of counted packets that the second detection device has transmitted through the connection in the current detection period.

Based on an implementation, in step <NUM>, the first detection device counts the quantity of all packets that have been sent to the receiving device through the connection in the current detection period, and correspondingly, in step <NUM>, the second detection device counts a quantity of all packets that have been received through the connection in the current detection period. In other words, the second detection device does not distinguish between the types of packets when counting the quantity of received packets.

Based on another implementation, in step <NUM>, the first detection device counts the quantity of packets of the preset type that have been sent to the receiving device through the connection in the current detection period, and correspondingly, in step <NUM>, the second detection device counts a quantity of packets of the preset type that have been received through the connection in the current detection period.

After the second detection device determines Num2, step <NUM> of determining, based on Num1 and Num2, whether one or more of the counted packets transmitted between the first detection device and the second detection device in the current detection period are lost may be performed. Further, a quantity LNum of packets lost between the first detection device and the second detection device in the current detection period may be calculated based on Num1 and Num2, where Num1 is greater than Num2, and specifically, a difference between Num1 and Num2 may be used as LNum. In addition, a packet loss rate between the first detection device and the second detection device may be calculated based on Num1 and Num2. For example, a ratio of LNum to Num1 is used as the packet loss rate between the first detection device and the second detection device.

When the second detection device is the transmission device located between the first detection device and the receiving device, after Num2 is determined, step <NUM> of adding Num2 to the detection packet, and sending the detection packet may be performed. In other words, the sent detection packet includes Num2.

Both step <NUM> and step <NUM> may be performed, or only one of step <NUM> and step <NUM> may be performed. When both step <NUM> and step <NUM> are performed, there is no specific order between step <NUM> and step <NUM>. If step <NUM> is not performed, when the second detection device is the transmission device located between the first detection device and the receiving device, the received detection packet may be directly sent.

It should be noted that, in Embodiment <NUM> of the present invention, the first detection device is a device that generates the detection packet, and the second detection device is a device that receives the detection packet and adds detection data (for example, Num2) to the detection packet. During specific implementation, there may be one or more second detection devices, and when there are a plurality of second detection devices, each second detection device performs step <NUM> when receiving the detection packet.

According to Embodiment <NUM> of the present invention, when the packet loss detection is performed, each device does not need to report a quantity of counted packets that have been transmitted, so that implementation is easy and efficiency is relatively high.

In step <NUM>, the first detection device may further add a time T1 at which the first detection device generates the detection packet to the detection packet. Correspondingly, in step <NUM>, after receiving the detection packet, the second detection device may further obtain a time T2 at which the detection packet is received, where T1 and T2 are used to compute a one-way latency between the first detection device and the second detection device. After obtaining T2, the second detection device may compute the one-way latency between the first detection device and the second detection device based on T1 and T2, and specifically, may use a difference between T1 and T2 as the one-way latency. When the second transmission device is the transmission device located between the first detection device and the receiving device, T2 may be added to the detection packet before the detection packet is sent.

According to Embodiment <NUM> of the present invention, when the latency detection is being performed, each device does not need to report a time stamp, so that implementation is easy and efficiency is relatively high.

In step <NUM>, the first detection device may further add an identifier Id1 of the first detection device to the detection packet. Correspondingly, in step <NUM>, when the second detection device is the transmission device located between the first detection device and the receiving device, an identifier Id2 of the second detection device may also be added to the detection packet before the detection packet is sent. The identifier of the first detection device and the identifier of the second detection device may be used to determine a transmission path through which the detection packet passes. Further, the first detection device and the second detection device may add sequence numbers that are in an identifier list in the detection packet and that are corresponding to the identifiers of the first detection device and the second detection device to the detection packet. For example, the first detection device adds a sequence number <NUM> of the first detection device to the detection packet, the first second detection device (that is, the first second detection device that receives the detection packet) adds a sequence number <NUM> of the first second detection device to the detection packet, the second second detection device (that is, the second second detection device that receives the detection packet) adds a sequence number <NUM> of the second second detection device to the detection packet, and the rest may be deduced by analogy.

According to the foregoing implementations, the path through which the detection packet passes may also be determined, so that transmission performance can be evaluated more comprehensively and accurately.

In Embodiment <NUM> of the present invention, when the reliable transport protocol is a TCP protocol, specifically, information such as the quantity, the time, and the identifier may be carried by extending a TCP option (Option) field in the detection packet. When the detection packet arrives at a second detection device, if a length of the TCP option in the detection packet exceeds limitation of the TCP option, a detection packet whose payload is empty and whose sequence number is the same as that of the detection packet that arrives at the second detection device may further be generated, and the information, such as the quantity, the time, and the identifier, obtained by the device is added to the newly generated detection packet.

During specific implementation, each of the first detection device and the second detection device may add, to the detection packet, one of or any combination of the quantity of counted packets that each device has received or has sent in the current detection period, the time at which each device generates or receives the detection packet, and the identifier of each device.

For example, a CR generates a detection packet and adds, to the detection packet, a quantity of packets that have been transmitted in a current detection period, and a BRAS and an OLT separately add, to the detection packet, the quantity of packets that have been transmitted in the current detection period after receiving the detection packet. Another device or the receiving device may determine, based on the quantity of packets that is separately added by the CR, the BRAS, and the OLT, whether a packet loss occurs between any two of the CR, the BRAS, and the OLT, and a specific quantity of lost packets. Alternatively, any one (for example, the OLT) of the BRAS and the OLT may compute whether a packet loss occurs between an upstream device (for example, CR or BRAS) and the device, and calculate a specific quantity of lost packets.

For another example, a CR generates a detection packet and adds a time at which the detection packet is generated to the detection packet, and a BRAS and an OLT separately add a time at which the detection packet is received to the detection packet after receiving the detection packet. Another device or the receiving device may compute a latency between any two of the CR, the BRAS, and the OLT based on the time separately added by the CR, BRAS, and OLT. Alternatively, anyone (for example, the OLT) of the BRAS and OLT may compute a latency between an upstream device (for example, CR or BRAS) and the device.

For still another example, a CR generates a detection packet and adds an identifier of the CR to the detection packet, and each of a BRAS and an OLT adds an identifier of each device to the detection packet after receiving the detection packet. Another device or the receiving device may determine, according to an identifier list carried in the detection packet, a transmission path through which the detection packet passes. Alternatively, any one (for example, the OLT) of the BRAS and the OLT may determine the transmission path through which the detection packet passes before arriving at the device.

During specific implementation, the sending device may be used as the second detection device, each device located between the sending device and the receiving device may be used as the second detection device, or the receiving device may be used as the second detection device.

It is assumed that a TCP connection between the sending device and the receiving device sequentially passes through three detection points which are a CR, a Bras, and an OLT, and the three detection points detect a data flow sent by the sending device through the TCP connection. The CR inserts a detection packet between transmitted packets at a preset time interval, for example, a packet whose sequence number is <NUM> and whose payload length is <NUM> is inserted after a detection packet whose sequence number is <NUM>. The TCP option field in the detection packet includes a device sequence number <NUM> of the CR (which represents the first detection point), a device identifier CR <NUM>, a local time <NUM> at which the detection packet is generated, and a quantity <NUM> of packets of the data flow that has been transmitted from a time at which a previous detection packet was generated to a current time. The detection packet sequentially passes through the detection point Bras and the detection point OLT. Each detection point may modify the detection packet. Assuming that the Bras adds, to the TCP option field in the detection packet, a device sequence number <NUM> of the Bras (which represents a second detection point), a device identifier Bras <NUM>, a local time <NUM> at which the detection packet is received, and a quantity <NUM> of packets of the data flow that has been transmitted from the time at which the previous detection packet was received to a time at which a current detection packet is received. Assuming that the OLT adds, to the TCP option field in the detection packet, a device sequence number <NUM> of the OLT (which represents a third detection point), a device identifier OLT <NUM>, a local time <NUM> at which the detection packet is received, and a quantity <NUM> of packets of the data flow that has been transmitted from the time at which the previous detection packet was received to a time at which a current detection packet is received. In this case, it can be obtained from the OLT that in the current detection period, the CR <NUM> sends a total of three packets to the Bras <NUM>, one packet is lost, correspondingly, a packet loss rate is <NUM>/<NUM>, and a one-way latency from the CR <NUM> to the Bras <NUM> is <NUM> - <NUM>. The Bras <NUM> sends a total of two packets to the OLT <NUM>, no packet is lost, correspondingly, a packet loss rate is <NUM>, and a one-way latency from the Bras <NUM> to the OLT <NUM> is <NUM> - <NUM>.

If time synchronization is not performed between the detection points, the one-way latency computed according to Embodiment <NUM> of the present invention is a relative one-way latency. The relative one-way latency is used to observe a changed value of a one-way latency, that is, compare a value of a one-way latency with a value of a previous one-way latency or a following one-way latency many times, so as to observe whether the latency becomes higher or lower. Therefore, the relative one-way latency provides a reference for transmission quality evaluation.

Further, based on the solutions in Embodiments <NUM> to <NUM> of the present invention, fault sectionalization may be implemented, to be specific, a specific location where a fault occurs is determined. An example in which the solutions in Embodiment <NUM> and Embodiment <NUM> of the present invention are used is as follows. For example, when a user has poor service quality, a control center may deliver a control command to a home gateway of the user to instruct the home gateway to initiate transmission performance detection, for example, to detect upstream and downstream packet loss rates and/or latencies of the home gateway, and then the home gateway may report the detected upstream and downstream packet loss rates and/or latencies to the control center for analyzing. If it is detected by comparison that the downstream packet loss rate and/or the downstream latency are/is higher, it may be determined that a network fault occurs within a home area of the user; alternatively, if it is detected that the upstream packet loss rate and/or the upstream latency are/is higher, it may be determined that the network fault occurs within a network of an internet service provider (Internet Service Provider, ISP). For another example, when a user has poor service quality, a control center may deliver a control command to a transmission device A (for example, a home gateway) near the receiving device and a transmission device B near the sending device to instruct the transmission device A and the transmission device B to initiate transmission performance detection, and then, it is detected that a downstream packet loss rate of the device A is <NUM>%, an upstream packet loss rate of the device A is <NUM>%, a downstream packet loss rate of the device B is <NUM>%, and an upstream packet loss rate of the device B is <NUM>%. Therefore, it can be determined based on the result that the downstream packet loss rate of the device A is <NUM>%, that is, packet losses mainly occur at downstream of the device A (for example, within a home network), no packet loss occurs between the device A and the device B, and the upstream packet loss rate of the device B is <NUM>%.

According to Embodiment <NUM> of the present invention, Embodiment <NUM> of the present invention provides a detection apparatus <NUM>. As shown in <FIG>, the detection apparatus <NUM> includes a receiving unit <NUM> and a processing unit <NUM>.

The receiving unit <NUM> is configured to receive a packet transmitted between a sending device and a receiving device through a connection that is based on a reliable transport protocol and that is established between the sending device and the receiving device.

The processing unit <NUM> is configured to: after the receiving unit <NUM> successively receives data packets whose sequence numbers are N1 and N2 and that are sent by the sending device through the connection, determine that N2 is greater than N1 + LenN1, where LenN1 is a payload length of the data packet whose sequence number is N1; after the receiving unit <NUM> receives a data packet whose sequence number is M1, determine that a time at which the data packet whose sequence number is M1 is received is later than a time at which the data packet whose sequence number is N2 is received, and determine that M1 is greater than N1 and is less than N2; and when determining that T2 - T1 is greater than or equal to an RTT, determine that the data packet whose sequence number is M1 is a retransmitted packet corresponding to an upstream packet loss, where T1 is a time at which the receiving unit <NUM> receives the data packet whose sequence number is N2, T2 is a time at which the receiving unit <NUM> receives the data packet whose sequence number is M1, the RTT is a two-way latency between the sending device and the receiving device, and the upstream packet loss is a packet loss occurring between the sending device and the detection apparatus.

The function units described in Embodiment <NUM> of the present invention may be configured to implement operations performed by the detection apparatus in the method described in Embodiment <NUM>. For a specific implementation, refer to the description in Embodiment <NUM>.

The receiving unit <NUM> is configured to receive a packet transmitted between a sending device and a receiving device through a connection that is based on a reliable transport protocol and that is established between the sending device and the receiving device, where the reliable transport protocol is a transmission control protocol TCP or a stream control transmission protocol SCTP.

The processing unit <NUM> is configured to obtain a time T3 at which the receiving unit <NUM> receives a data packet whose sequence number is K1 and that is sent by the sending device through the connection; and when the receiving unit <NUM> receives the first acknowledgment packet whose value of a latest right edge field of a selective acknowledgment SACK field included in the first acknowledgment packet is greater than K1 + LenK1 and that is used to determine a data packet followed by the data packet whose sequence number is K1, compute a two-way latency between the detection apparatus and the receiving device based on T3 and T4, where T4 is a time at which the receiving unit <NUM> receives the acknowledgment packet, and LenK1 is a payload length of the data packet whose sequence number is K1.

According to Embodiment <NUM> and Embodiment <NUM> of the present invention, Embodiment 6A of the present invention provides a transmission device 700A. As shown in <FIG>, the transmission device 700A includes a communications unit 710A and a detection apparatus 720A.

The communications unit 710A is configured to: transmit information transmitted between a sending device and a receiving device, and send the information to the detection apparatus 720A, where the information includes a packet transmitted through a connection that is based on a reliable transport protocol and that is established between the sending device and the receiving device and/or a message used to establish the connection.

The detection apparatus 720A may be specifically the detection apparatus <NUM> described in Embodiment <NUM> of the present invention. Correspondingly, the communications unit 710A specifically sends the information to the receiving unit <NUM> of the detection apparatus 720A. Alternatively, the detection apparatus 720A may be specifically the detection apparatus <NUM> described in Embodiment <NUM> of the present invention. Correspondingly, the communications unit 710A specifically sends the information to the receiving unit <NUM> of the detection apparatus 720A. For a specific implementation, refer to the descriptions in Embodiment <NUM> and Embodiment <NUM>.

According to Embodiment <NUM> and Embodiment <NUM> of the present invention, Embodiment 6B of the present invention provides a transmission device 700B. The transmission device 700B is applied to a communications system, the communications system includes a sending device, a receiving device, and the transmission device 700B, the sending device and the receiving device transmit a packet through a connection that is based on a reliable transport protocol and that is established between the sending device and the receiving device, and the packet is transmitted by using the transmission device 700B.

As shown in <FIG>, the transmission device 700B includes a communications unit 710B and a processing unit 720B.

The communications unit 710B is configured to transmit the packet transmitted between the sending device and the receiving device through the connection.

The processing unit 720B is configured to: after the communications unit 710B successively receives data packets whose sequence numbers are N1 and N2 and that are sent by the sending device through the connection, determine that N2 is greater than N1 and that N1 and N2 are inconsecutive; and after the communications unit 710B successively receives the data packet whose sequence number is N2 and a data packet whose sequence number is M1, when determining that M1 is greater than N1 and is less than N2 and that T2 - T1 is greater than or equal to an RTT, determine that the data packet whose sequence number is M1 is a retransmitted packet corresponding to an upstream packet loss, where T1 is a time at which the communications unit 710B receives or sends the data packet whose sequence number is N2, T2 is a time at which the communications unit 710B receives or sends the data packet whose sequence number is M1, the RTT is a two-way latency between the sending device and the receiving device, and the upstream packet loss is a packet loss occurring between the sending device and the transmission device 700B.

During specific implementation, usually, T1 is the time at which the communications unit 710B receives the data packet whose sequence number is N2, and T2 is the time at which the communications unit 710B receives the data packet whose sequence number is M1; or T1 is the time at which the communications unit 710B sends the data packet whose sequence number is N2, and T2 is the time at which the communications unit 710B sends the data packet whose sequence number is M1.

The function units of the transmission device 700B provided in Embodiment 6B of the present invention may be configured to implement operations performed by the detection apparatus in the method described in Embodiment <NUM>. For a specific implementation, refer to the description in Embodiment <NUM>.

According to Embodiment <NUM> and Embodiment <NUM> of the present invention, Embodiment 6C of the present invention provides a transmission device 700C. The transmission device is applied to a communications system, the communications system includes a sending device, a receiving device, and the transmission device, the sending device and the receiving device transmit a packet through a connection that is based on a reliable transport protocol and that is established between the sending device and the receiving device, and the packet is transmitted by using the transmission device.

As shown in <FIG>, the transmission device 700C includes a communications unit 710C and a processing unit 720C.

The communications unit 710C is configured to transmit a packet transmitted between a sending device and a receiving device through a connection that is based on a reliable transport protocol and that is established between the sending device and the receiving device.

The processing unit 720C is configured to: obtain a time T3 at which the communications unit 710C receives or sends a data packet whose sequence number is K1 and that is sent by the sending device through the connection; when determining that the communications unit 710C receives a target acknowledgment packet sent by the receiving device through the connection, obtain a time T4 at which the communications unit 710C receives or sends the target acknowledgment packet; and compute a two-way latency DRTT between a detection apparatus and the receiving device based on T3 and T4, where the target acknowledgment packet is a first acknowledgment packet that is received by the communications unit 710C and that indicates that the receiving device has received the data packet whose sequence number is K1 or a data packet following the data packet whose sequence number is K1.

When T3 is the time at which the communications unit 710C receives the data packet whose sequence number is K1, T4 is usually the time at which the communications unit 710C sends the target acknowledgment packet. When T3 is the time at which the communications unit 710C sends the data packet whose sequence number is K1, T4 is usually the time at which the communications unit 710C receives the target acknowledgment packet.

The function units of the transmission device 700C provided in Embodiment 6C of the present invention may be configured to implement operations performed by the detection apparatus in the method described in Embodiment <NUM>. For a specific implementation, refer to the description in Embodiment <NUM>.

According to Embodiment <NUM> of the present invention, Embodiment <NUM> of the present invention provides a detection device <NUM>. The detection device <NUM> is applied to a communications system, and the communications system includes a sending device, a receiving device, and at least one transmission device, as shown in the communications system <NUM> in <FIG>. The sending device and the receiving device transmit a packet through a connection that is based on a reliable transport protocol and that is established between the sending device and the receiving device, the packet is transmitted by using the at least one transmission device, and the detection device is the sending device or one of the at least one transmission device.

As shown in <FIG>, the detection device <NUM> includes a communications unit <NUM> and a processing unit <NUM>.

The communications unit <NUM> is configured to transmit a packet through the connection.

The processing unit <NUM> is configured to: generate a detection packet, and send the detection packet by using the communications unit <NUM>, where the detection packet has an empty payload and includes a quantity Num1 of counted packets that have been sent by using the communications unit in a current detection period, and Num1 is used to determine whether one or more of the counted packets transmitted between the detection device and a downstream device of the detection device in the current detection period are lost.

The function units described in Embodiment <NUM> of the present invention may be configured to implement operations performed by the first detection device in the method described in Embodiment <NUM>. For a specific implementation, refer to the description in Embodiment <NUM>.

According to Embodiment <NUM> of the present invention, Embodiment <NUM> of the present invention provides a detection device <NUM>. The detection device <NUM> is applied to a communications system, and the communications system includes a sending device, a receiving device, and at least one transmission device, as shown in the communications system <NUM> in <FIG>. The sending device and the receiving device transmit a packet through a connection that is based on a reliable transport protocol and that is established between the sending device and the receiving device, and the packet is transmitted by using the at least one transmission device. The detection device is the receiving device or a transmission device that is in the at least one transmission device and that is located between a device configured to generate a detection packet and the receiving device.

The processing unit <NUM> is configured to: after receiving the detection packet, determine a quantity Num2 of counted packets that the communications unit has received through the connection in a current detection period, where Num2 is used to determine whether one or more of the counted packets transmitted between the detection device and an upstream device or a downstream device of the detection device in the current detection period are lost.

The function units described in Embodiment <NUM> of the present invention may be configured to implement operations performed by the second detection device in the method described in Embodiment <NUM>. For a specific implementation, refer to the description in Embodiment <NUM>.

According to Embodiment <NUM> and Embodiment <NUM> of the present invention, Embodiment <NUM> of the present invention provides a detection apparatus <NUM>. As shown in <FIG>, the detection apparatus <NUM> includes a communications interface <NUM>, a processor <NUM>, and a memory <NUM>. The communications interface <NUM>, the processor <NUM>, and the memory <NUM> communicate with each other by using a bus.

The communications interface <NUM> is configured to receive information transmitted between a sending device and a receiving device, where the information includes a packet transmitted through a connection that is based on a reliable transport protocol and that is established between the sending device and the receiving device and/or a message used to establish the connection. The communications interface <NUM> may be specifically a network adapter.

The memory <NUM> is configured to store a computer operation instruction, and may be specifically a high-speed RAM memory or a non-volatile memory (non-volatile memory).

The processor <NUM> is configured to execute the computer operation instruction stored in the memory <NUM>. The processor <NUM> may be specifically a central processing unit (central processing unit, CPU), or an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or be configured as one or more integrated circuits that implement the embodiments of the present invention.

The processor <NUM> executes the computer operation instruction to enable the detection apparatus <NUM> to perform operations performed by the detection apparatus in the method described in Embodiment <NUM> or Embodiment <NUM>. For a specific implementation, refer to the description in Embodiment <NUM> or Embodiment <NUM>.

According to Embodiment <NUM> and Embodiment <NUM> of the present invention, Embodiment <NUM> of the present invention provides a transmission device <NUM>. As shown in <FIG>, the transmission device <NUM> includes a transceiver <NUM>, a processor <NUM>, and a memory <NUM>. The transceiver <NUM>, the processor <NUM>, and the memory <NUM> communicate with each other by using a bus.

The transceiver <NUM> is configured to: receive information transmitted between a sending device and a receiving device, and transmit the information to the processor <NUM>, where the information includes a packet transmitted through a connection that is based on a reliable transport protocol and that is established between the sending device and the receiving device and/or a message used to establish the connection. The transceiver <NUM> may be specifically a network adapter.

The memory <NUM> is configured to store a computer operation instruction, and may be specifically a high-speed RAM memory or a non-volatile memory.

The processor <NUM> is configured to execute the computer operation instruction stored in the memory <NUM>. The processor <NUM> may be specifically a CPU or an ASIC, or be configured as one or more integrated circuits that implement the embodiments of the present invention.

The processor <NUM> executes the computer operation instruction to enable the transmission device <NUM> to perform operations performed by the detection apparatus in the method described in Embodiment <NUM> or Embodiment <NUM>. For a specific implementation, refer to the description in Embodiment <NUM> or Embodiment <NUM>.

According to Embodiment <NUM> and Embodiment <NUM> of the present invention, Embodiment <NUM> of the present invention provides a transmission device <NUM>. As shown in <FIG>, the transmission device <NUM> includes a transceiver <NUM>, a processor <NUM>, and a detection apparatus <NUM>.

The transceiver <NUM> is configured to: receive information transmitted between a sending device and a receiving device, and send the information to the processor <NUM>, where the information includes a packet transmitted through a connection that is based on a reliable transport protocol and that is established between the sending device and the receiving device and/or a message used to establish the connection. The transceiver <NUM> may be specifically a network adapter.

The processor <NUM> is configured to transmit the information to the detection apparatus. The processor <NUM> may be specifically a CPU or an ASIC, or be configured as one or more integrated circuits that implement the embodiments of the present invention.

The detection apparatus <NUM> may be specifically the detection apparatus <NUM> described in Embodiment <NUM> of the present invention. Correspondingly, the processor <NUM> specifically sends the information to the communications interface <NUM> of the detection apparatus <NUM>.

As shown in <FIG>, the detection device <NUM> includes a transceiver <NUM>, a processor <NUM>, and a memory <NUM>. The transceiver <NUM>, the processor <NUM>, and the memory <NUM> communicate with each other by using a bus.

The transceiver <NUM> may be specifically a network adapter.

The processor <NUM> is configured to execute the computer operation instruction stored in the memory <NUM>. The processor <NUM> may be specifically a CPU, or an ASIC or be configured as one or more integrated circuits that implement the embodiments of the present invention.

The processor <NUM> executes the computer operation instruction to enable the detection apparatus <NUM> to perform operations performed by the first detection device in the method described in Embodiment <NUM>, and specifically, the processor <NUM> receives and sends the packet by using the transceiver.

The processor <NUM> executes the computer operation instruction to enable the detection apparatus <NUM> to perform operations performed by the second detection device in the method described in Embodiment <NUM>, and specifically, the processor receives and sends the packet by using the transceiver.

Claim 1:
A method for implementing transmission performance detection, wherein the method comprises:
Obtaining (<NUM>), by a detection apparatus, a time T3 at which the detection apparatus receives a data packet whose sequence number is K1 and that is sent by a sending device through a connection that is based on a reliable transport protocol and that is established between the sending device and a receiving device;
when determining that a first target acknowledgment packet sent by the receiving device through the connection is received, obtaining (<NUM>), by the detection apparatus, a time T4 at which the detection apparatus receives the first target acknowledgment packet, wherein the first target acknowledgment packet is a first acknowledgment packet that is received by the detection apparatus and that indicates that the receiving device has received the data packet whose sequence number is K1 or a data packet following the data packet whose sequence number is K1;
obtaining another T3 of a second data packet and another T4 of a second target acknowledgment packet, wherein the second data packet has a sequence number K2 and is traveling from the sending device, through the connection, and to the receiving device, wherein the second target acknowledgment packet is traveling from the receiving device, through the connection, and to the sending device, wherein the second target acknowledgment packet is a first acknowledgment packet received by the detection device and indicating that the receiving device has received the second data packet or another packet with a sequence number after K2;
computing (<NUM>) a two-way latency DRTT between the detection apparatus and the receiving device based on a plurality of groups T3 and T4, and
receiving, from the receiving device, at a first time, and when the receiving device is a client device and the sending device is a server, a request message requesting establishment of the connection;
receiving, from the sending device, at a second time, and in response to the request message, a response message; and
determining a two-way latency (URTT) between the sending device and the detection device as a difference between the first time and the second time.