Difference between Round trip time (RTT) and Time to live (TTL)
1. Round Trip Time (RTT) :
The length of time taken by a data packet to be sent to a destination including the time it takes for an acknowledgment of that packet to be received back at the origin place.
2. Time to live (TTL) :
The lifespan or life time of data that is being sent. Once after that specified time is over or elapsed the data will be discarded.
or it can also stated as number of hops that packet is set to exist in the network after which that packet is discarded. The purpose of the TTL field is to avoid a situation in which an undeliverable datagram keeps circulating in network.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
Difference between Round trip time and Time to live :
Round trip time
Time to live
|1||Also known as ping time.||Also known as hop limit.|
|2||Gives the total time taken to send data packet and to get an acknowledgment back from the destination.||Gives the hop limit to travel in the network path. after that limit the packet will be discarded.|
|3||It is an important for determining the connection on a local network or the larger Internet network, and used to diagnose the speed and reliability of network connections.||Helps us to prevent the data packet from circulating indefinitely in the routers path.|
|4||The round trip time is not stored anywhere, it will be calculated when the acknowledgement comes from destination.||It is an 8-bit field stored in IP header.|
|5||It can be any value, because it depends on many factors.||Maximum value that can be set to TTL is 255 since its the maximum value that we can produce with 8-bits.|
|6||It depends on many factors like distance, no. of hops, server response time etc.||It depends on system, It is set initially by the system which is sending the packet.|
|7||RTT is measured in milliseconds.||TTL is measured in seconds.|
How to find RTT and TTL ?
Example 1. pinging amazon.com
We can find RTT and TTL using ping command. Open you terminal or command prompt and type the below command to see the RTT and TTL to amazon.com
You will see the screen similar to this.
Each line starting with word reply is reply from the server to client for the packet sent, In the above example we got 4 replies which means that we sent 4 packets.
The values marked with red box is RTT ( Round trip time) which is shown in milliseconds since it’s measured in milliseconds
and the values marked with blue box is TTL ( Time to live) measured in seconds.
So average RTT for above ping is (230+231+236+230) / 4 = 231.75 ms
The TTL above ping is 235 seconds or 235 hops
Example 2. pinging google.com
Pinging google.com with the help of below command
After running the above command you will see screen similar to this
So average RTT for above ping is (48+62+56+44) / 4 = 52.5 ms
The TTL above ping is 114 seconds or 114 hops.