Time is a factor permanently present in our lives. It can be stressful, but it’s an efficient way to organize and control different aspects. The idea of chaos sometimes sounds exciting, but being realistic, it’s not viable when it’s about keeping a network running smoothly. That’s why TTL exists!
TTL, or time-to-live, is a mechanism to define the period of time for data to keep living, meaning being valid, stored, or to keep traveling on computers or networks. Once the TTL value defined by the administrators to those data expires, they get discarded.
Data packets have a place for the TTL value to be registered. Once that value is established, it can be readable by routers and other machines.
What is the purpose of TTL?
The purpose of TTL is to limit the time for data packets to be traveling around machines, applications, or networks.
Data packets are constantly traveling across the Internet. Without a mechanism to control them, in a few years, the traffic could be chaotic. The first data packet ever sent could still be traveling around!
A limited time clearly established on data packets helps routers not to have them around permanently. Besides, time-to-live helps to obtain essential information from data packets. For example, you can know the time a data packet has been traveling within a network and its complete route.
Sources send data packets for being delivered to specific destinations. While traveling, they touch different points on the network called hops. Routers receive data packets and read their TTL. If this lecture shows the packets still have time/hops to travel, they will be pushed to the next point. But if their time-to-live is expired, packets will be discarded.
Routers will report the situation to the data source via an ICMP message. ICMP (Internet Control Message Protocol) messages are a resource to diagnose and inform errors. An ICMP message will be sent to the IP address of the source that emitted the discarded packet.
An ICMP message dispatched by a router to report the TTL expiration of a packet will take a specific time to reach its destination, the packet’s source. Considering that time, the hopes that the packet touched when its TTL was still valid can be tracked. You can track its complete route!
Where can you find TTLs?
- In networking, you can find TTL in every data packet sent online to deliver to a recipient.
- DNS queries are also data packets. Therefore they have time-to-live.
- Content delivery networks (CDN) use the TTL to set up the time for their servers to cache the content they distribute. When the time-to-live expires, that content is discarded. Servers have to query primary servers to update and get a new copy to cache it until the TTL expires again.
- DNS recursive servers cache DNS records (A, CAA, etc.), the time defined in every record. Each has its own TTL. When it expires, the recursive server has to get a new copy of the record from the authoritative DNS server to cache it again.
Benefits of TTL.
- It contributes to keep systems under control and reducing stress on them by enhancing the performance of caching.
- CDNs are really big networks. Time-to-live helps them hold copies of the content they distribute, time enough not to be stressed with continuous requests from primary servers.
- The consequent reduction of bandwidth and faster serving are not minor benefits!
TTL is a mechanism that proves that time totally matters!