h2 class="learning-content-h2 learning-content-h2--margin-top-16px" itemprop="headline">What is round-trip time?
Round-trip time (RTT) is the duration in milliseconds (ms) it takes for a network request to go from a starting point to a destination and back again to the starting point. RTT is an important metric in determining the health of a connection on a local network or the larger Internet, and is commonly utilized by network administrators to diagnose the speed and reliability of network connections.
Reducing RTT is a primary goal of a CDN. Improvements in latency can be measured in the reduction of round-trip time and by eliminating instances where roundtrips are required, such as by modifying the standard TLS/SSL handshake.
The ping utility, available on virtually all computers, is a method of estimating round-trip time. Here's an example of several pings to Google with the round-trip time calculated at the bottom. Notice that one of the ping times - 17.604ms - is higher than the rest.
How does round-trip time work?
Round-trip time represents the amount of time it takes data to go roundtrip to another location. Borrowing from the lesson on CDN latency benefits, let's say that a user in New York wants to contact a server in Singapore.
When the user in New York makes the request, the network traffic is transferred across many different routers in different physical locations before terminating at the server in Singapore. The server in Singapore then sends a response back across the Internet to the location in New York. Once the request terminates in New York, a rough estimate can be made of the amount of time it takes to go round trip between the two locations.
It's important to keep in mind that round-trip time is an estimate and not a guarantee; the pathway between the two locations can change over time and other factors such as network congestion can come into play, affecting the overall transit time. Regardless, RTT is an important metric in understanding if a connection can be made, and if so, roughly how long it will take to make the trip.
What are common factors that affect RTT?
Infrastructure components, network traffic, and physical distance along the path between a source and a destination are all potential factors that can affect RTT.
List of factors affecting RTT:
- The nature of the transmission medium - the way in which connections are made affects how fast the connection moves; connections made over optical fiber will behave differently than connections made over copper. Likewise, a connection made over a wireless frequency will behave differently than that of a satellite communication.
- Local area network (LAN) traffic - the amount of traffic on the local area network can bottleneck a connection before it ever reaches the larger Internet. For example, if many users are using streaming video service simultaneously, round-trip time may be inhibited even though the external network has excess capacity and is functioning normally.
- Server response time – the amount of time it takes a server to process and respond to a request is a potential bottleneck in network latency. When a server is overwhelmed with requests, such as during a DDoS attack, its ability to respond efficiently can be inhibited, resulting in increased RTT.
- Node count and congestion – depending on the path that a connection takes across the Internet, it may be routed or “hop” through a different number of intermediate nodes. Generally speaking, the greater the number of nodes a connection touches the slower it will be. A node may also experience network congestion from other network traffic, which will slow down the connection and increase RTT.
- Physical distance – although a connection optimized by a CDN can often reduce the number of hops required to reach a destination, there is no way of getting around the limitation imposed by the speed of light; the distance between a start and end point is a limiting factor in network connectivity that can only be reduced by moving content closer to the requesting users. To overcome this obstacle, a CDN will cache content closer to the requesting users, thereby reducing RTT.
How can a CDN improve RTT?
By maintaining servers inside internet exchange points and by having preferred relationships with Internet service providers and other network carriers, a CDN is able to optimize network pathways between locations, resulting in reduced RTT and improved latency for visitors accessing content cached inside the CDN.
Explore the CDN performance lesson to learn how caching, data center placement, file size reductions, and other optimizations reduce latency and improve RTT. Learn how using the Cloudflare CDN improves RTT.