Definition
In the network, latency (latency), synonymous with delay, is the time it takes to get a packet from a specific point. In some cases, the delay time is the delay time, which is the time between sending a packet and returning to the sender for one cycle. The reasons for network transmission delay time include: transmission, the time it takes for a packet to travel at the speed of light between two places. Transmission: The medium itself (whether it is fiberoptic, wireless or other medium) causes some delay. The delay caused by large packets is often longer than the time caused by small packets. Routers and other processing, each gateway, node (node) spend time to detect may change the header of the packet (for example, change the hop count in the time-to-live domain). Other computers and storage delays. At each end of the network transmission, small packets may be stored and the hard disk needs to be accessed. The delay occurs in intermediate devices such as switches and bridges.
For users, the delay time, also known as network delay, refers to the period of time from when the user sends a request to when the remote system responds to the request and sends it back to the user. For the Internet based on the TCP/IP protocol, each request must be processed as follows: routing processing, ADU (User Data Unit) transmission on the network, and the server processing the request, these processes will cause delay.
Routing delay
Look at the routing delay first, which includes domain name request delay, TCP connection establishment delay, TCP connection release delay and IP routing delay on each gateway. If the user application uses the domain name of the other party's host instead of the IP address, the delay caused by the domain name resolution process of the other party's IP address should be resolved before the application program communicates is called the domain name request delay. The application program transfers the domain name to the local resolver software. The software first searches the local cache for the corresponding domain name-address binding; if not found, the local resolver constructs a query message and sends it to the initial domain name server (local server) , The domain name server answers a response message according to the analysis situation. The domain name server resolution adopts a two-step method: when the initial server cannot find the domain name, it sends a query message to the root server for a top-down search (the domain name servers are organized into a tree-like hierarchical structure). The response delay of the local cache to the domain name request is determined by the speed of the CPU, memory, and external storage, and the delay is relatively small. The response of the domain name server is related to the network load, the speed and load of the server. When the domain name needs to be searched from the root server, the transmission delay becomes a delay on the LAN, which is relatively large. The TCP connection establishment delay refers to the time from the transmission service user requesting the establishment of the connection to the receipt of the connection confirmation. It includes the processing delay of the remote transport layer. The connection release delay refers to the time delay from when the transport layer user at one end initiates a connection release request to the actual release of the other end. The connection establishment and release delay is related to the network load and server load. In the TCP/IP protocol, each IP data packet is independently routed. IP path finding delay refers to the path finding delay on each gateway of the IP data packet from the source end to the destination end, including the gateway path finding table processing delay and the address resolution delay. Gateway address resolution is accomplished by ARP (Address Resolution Protocol, Address Resolution Protocol) provided by TCP/IP. Since the gateway path finding is completed in the local machine, and the address resolution is also performed in the local network, the IP path finding delay is relatively small.
Transmission delay
The user data unit (ADU) located in the application layer forms a protocol data unit (PDU) after the application layer protocol calls the service provided by the lower layer protocol, and the PDU is used as independent data The unit is transmitted on the network. The transmission delay of PDU on the network consists of the following parts: packing delay, transmission delay, propagation delay, queuing delay and processing delay. Packing delay is a delay unique to real-time streaming applications. Real-time streaming applications refer to applications that transmit time-based information (such as video, audio, and animation, etc.) in real time. Real-time information flow is time-sensitive, and is generated regularly in chronological order. It is necessary to wait for the information flow to reach a certain amount to satisfy the protocol data unit (PDU) payload before it is packed into PDU. This waiting time is called packing delay. Packing delay Sp/K, where Sp is the length of the PDU payload, and K is the coding speed of the application. Therefore, for low-speed encoders, the delay is relatively large. Transmission delay refers to the time delay for all PDU data to be transmitted on the line, or the time interval from when the first bit of the PDU is transmitted from the endpoint to the line until the last bit leaves the endpoint. The transmission delay is related to the PDU size and the transmission rate on the local line. For low-speed links, the transmission delay is considerable.
Propagation delay is the time it takes for the PDU to propagate in the medium and depends on the speed at which the signal passes through the medium. In other words, this delay is determined by the physical characteristics of the link and has nothing to do with the traffic volume of the link. The propagation delay increases linearly with the distance. The propagation delay in LAN and MAN is only 50-200 us, which is not an important delay component. And the propagation delay in WAN becomes more important, because the long-distance transmission makes the propagation delay can reach tens of milliseconds. Queuing delay is the main delay in the packet switching network. It refers to the set of buffer delays caused by each exchange of PDUs on the transmission path. If the packet switching is temporarily overloaded, there may be many packets queued on the destination output port of each PDU. Each packet in the queue before the PDU will have an additional delay equal to the transmission delay. In the exchange of the first-in-first-out (FIFO) queue mechanism, the queuing delay of newly arrived packets is equal to the sum of the transmission delays of all packets that have been queued on the output port. So the queuing delay is not only related to the number of packets in front of the queue, but also related to the transmission speed of the output port. The queuing delay, which is the main delay, is affected by the current network load, and it is also the main factor in the delay variation in the packet switching network. Because each router on the Internet backbone network has a large number of data packets queuing, the queuing delay has also become the main delay on the Internet. If passing through 10 routers, each router has an average of 10 IP data packets queuing, and the queuing delay on this path can reach hundreds of milliseconds. Processing delay is the sum of the time spent on each exchange on the path and the processing of data packets by the source and destination. It does not include queuing delay. In the process of packet switching, the processing delay is negligible compared with the queuing delay, but it is still considerable at the end point, especially for applications such as video decompression.
Measurement method
The network performance measurement method is divided into active measurement and passive measurement according to the measurement method. Active measurement is to inject probe packets into the network under test. The probe packets record the transmission in the network, and the terminal obtains network performance data by parsing the probe packets. Passive measurement methods use monitoring equipment or tools to analyze network characteristics by capturing data packets transmitted in the network under test. Both methods have their advantages and disadvantages. The active measurement method is flexible and controllable, and can set parameters according to the measurer's own intentions, such as the type and size of the package. However, the measurement data stream injected into the network will increase the network load, thereby affecting the network performance, and the measured data cannot truly reflect the actual network performance. The advantage of passive measurement is that it does not increase the traffic on the network during measurement, and the measured data can truly reflect network performance. The disadvantage is that the controllability is poor, and the confidentiality and security of the collected data will be affected. Therefore, sometimes these two methods are often combined for network measurement. According to the definition of network delay metric, the delay of any layer can be attributed to one-way delay or round-trip delay, but the protocol is different. Therefore, the following test methods can be applied to delay measurement above the network layer.
One-way delay measurement method
First select the protocol used for measurement, such as TCP, UDP, ICMP (Internet Control Message Protocol, Internet Control Message Protocol), OWDP (OneWayDelayProtocol, one-way delay protocol), IPMP (InternetProtocolMeasurementProtocol, IP layer measurement protocol), etc., determine the more detailed issues of the selected protocol, such as TCP, UDP port number, timeout waiting time, and measurement packet size. After determining these parameters, proceed as follows:
(1) Negotiate synchronization between the source and the destination: that is, the clocks of the source and the destination must be accurately synchronized.
(2) At the source end, determine the IP address of the destination end, and fill in the test packet according to the structure of the selected measurement protocol. The vacant part should be filled with random bits to avoid that the measured delay is lower than the delay after compression technology is used in the path. Set the time stamp in the test packet, and then send the filled-in test packet to the destination host.
(3) At the destination, prepare to receive the packet (using a passive measurement method, that is, using a monitoring tool to capture the packet). If the packet arrives within a reasonable time, immediately subtract the receiving time from the sending time in the packet to calculate the estimated one-way delay. This value is valid only when the source and destination clocks are synchronized. If the packet cannot arrive within a reasonable time, the one-way delay value shall be set to undefined. There are two main ways to solve the clock synchronization problem: software synchronization and hardware synchronization. Synchronization based on GPS (Global Position System, Global Positioning Satellite System) belongs to hardware synchronization; synchronization based on Network Time Protocol (Network Time Protocol) and synchronization based on algorithm estimation belong to software synchronization. Time synchronization on the Internet is mostly realized by an NTP server. The NTP server uses a GPS receiver to provide a reference clock, and the host obtains the time of the NTP server through the network time protocol NTP. Algorithms to eliminate clock synchronization include linear regression algorithm, median line adaptation algorithm, piecewise minimum algorithm, ConvexHull Approach algorithm, linear programming algorithm, and so on.
The round-trip delay measurement method
The preparation work is the same as the one-way delay measurement method. The measurement is carried out according to the following steps:
(1) At the source end, the IP address of the destination end is determined, and the test packet is filled according to the structure of the selected measurement protocol. In order to prevent the measured delay from being lower than the expected result due to the compression technology on the path, the vacant part should be filled with random bits; and the ID number of the test packet must be set so that the source host can determine that the test is sent by itself after receiving the response packet The response of the package.
(2) At the source end, set the sending timestamp in the test packet, and then send the filled-in test packet to the destination host. The timestamp can be placed in the packet or outside the packet, as long as an appropriate identifier is included so that the received timestamp can be compared with the sent timestamp.
(3) At the destination end, prepare to receive test packets. If the test packet reaches the destination host, a response packet must be quickly generated and sent to the source.
(4) At the source end, prepare to receive the corresponding response packet. According to the ID number, it is judged whether it is the response of the test package. If the response packet arrives within the timeout waiting time, immediately subtract the receiving time from the sending time in the response packet to calculate the round-trip delay value. If the response packet cannot arrive within the timeout waiting time, the round-trip delay value is set to undefined.