Graph
TTL

⏳TTL

NEW

Also known as: Time To Live

A time limit after which data, messages, or cache entries expire and should be discarded.

DESCRIPTION

TTL bounds how long data remains valid, commonly used in DNS, IP networking, and caches. In DNS, TTL controls record caching duration; in IP, it limits packet lifetime hops. In applications and databases, TTL manages cache freshness and automatic key expiration. Proper TTL selection balances freshness, latency, and load. Short TTLs increase accuracy but reduce cache efficiency.

ALTERNATIVE DEFINITIONS

Wikipedia

Time to live (TTL) is a mechanism that limits the lifespan or lifetime of data in a computer or network.

Generalizes TTL across networks and computing contexts.

Source

RFC 1035

TTL: a 32 bit unsigned integer that specifies the time interval that the resource record may be cached before the source of the information should again be consulted.

Defines TTL precisely for DNS resource records.

Source

RFC 791

Time to Live: This field indicates the maximum time the datagram is allowed to remain in the internet system.

Defines TTL for IPv4 packet lifetime control.

Source

Redis Documentation

Returns the remaining time to live of a key that has a timeout.

Operational description of TTL in key-value stores.

Source

Caching DNS HTTP Cache-Control Expiration Garbage Collection Cache Invalidation Redis IPv4 Message Time-to-Live

COMPETING TERMS

Lease Cache-Control

KNOWLEDGE AREAS

Data Storage & Operations Infrastructure Software Engineering Data Engineering

TARGET AUDIENCE

Software Developer DevOps Engineer Cloud Architect Data Engineer Application Administrator

EXTERNAL SOURCES

  • Wikipedia - Time to live
  • IETF - DNS TTL specification
  • IETF - IPv4 TTL field definition
  • Redis - Key expiration and TTL usage

TOP QUESTIONS

What is TTL in computing and networking?

TTL limits the lifetime of data, packets, or cache entries, ensuring timely refresh or discard.

Category: Definition

How is TTL used in DNS?

It specifies how long resolvers may cache a record before re-querying the authoritative source.

Category: UseCase

How does TTL work in IP networking?

It limits packet lifetime; routers decrement TTL each hop, preventing routing loops.

Category: Mechanism

What are common TTL values for caches?

Values vary widely; select based on freshness needs, traffic, and update frequency.

Category: BestPractices

What risks come with too short TTL?

Increased origin load, higher latency, and potential rate limiting from frequent refreshes.

Category: Risks

What risks come with too long TTL?

Stale data, inconsistency during changes, and delayed propagation of updates.

Category: Risks

How to choose TTL values?

Balance freshness and efficiency; consider update cadence, SLAs, and user experience.

Category: HowTo

What is TTL in Redis?

A per-key expiration time; Redis removes keys when their TTL elapses.

Category: Example

Is TTL used in messaging systems?

Yes, message TTL ensures expired messages are discarded, preventing backlog buildup.

Category: UseCase