Wondering what is “time-to-live” and its impact on your website? Well, your visitors want a fast-loading page with the most accurate information. To find the right balance, you can adjust your Time to Live (TTL) to improve your site’s performance and keep the information as up-to-date as possible. 

This article covers everything you need to know about the Time To Live (TTL) metric, how it works and how a CDN can help to configure it. 


What Is Time to Live and Why It Is Important

Time to live (TTL) is a mechanism that limits the lifespan of a data packet in a network before being discarded by a router. It’s an important metric because it prevents data packets from moving across the network indefinitely. TTL is used in networking but also in the context of the browser and CDN caching. In those cases, it helps improve page load speed and reduce origin server bandwidth consumption.


How Time to Live Works From a Network Perspective

In networking, TTL refers to the time limit set on the data packet to be in-network before becoming obsolete. Each packet stores a number determining the duration it should continue to move through the routers in the entire network. 

The picture below shows all the hops made by the data with the TTL values for each router. TTL 252 means the ping packet can cross a maximum of 255 hops in a network. 

TTL values help to determine how long a packet has been in circulation and how long it will continue to move through the network - Source: 9tut.com
TTL values help to determine how long a packet has been in circulation and how long it will continue to move through the network – Source: 9tut.com

How TTL Works From a Caching Perspective

A caching Time to live (TTL) measures the time that an asset is stored in a caching system before it’s deleted. A TTL cache is simply a storage area where the data is removed or refreshed after a defined period of time to optimize memory performance. 

We can differentiate three areas covered by the caching TTL metric: 

1. TTL and Browser Caching (Using the cache-control HTTP header)

It’s the amount of time the browser will cache a resource. The data will be served from the browser to the local cache until TTL’s expiration. 

2. TTL and Content Delivery Networks (CDN and Edge servers)

It determines how long the asset will live in the PoPs (edge servers) before getting removed or refreshed. TTL is here to serve fresh content to visitors. It indicates how long to store the resources to reduce bandwidth consumption from and to the origin server. TTL refers to their Cache-Control or Expires settings.

Importance of TTL in a CDN caching context - Source: RocketCDN
Importance of TTL in a CDN caching context – Source: RocketCDN

3. TTL and DNS 

DNS TTL (time to live) is a configuration that tells the DNS resolver how long to cache a query before requesting a new one. 

What’s a Good TTL in a Caching Context?

Most sites use a default TTL value of 3600 s (around one hour). Usually, the minimum available TTL value is 30 seconds and 24 hours is the maximum TTL value. A TTL between 1 and 24 hours provides a pretty good balance, and by choosing this interval, you can keep a fast website and render accurate data to the visitors.


How a CDN Helps Time to Live Configuration

A CDN will help control TTL by setting a longer browser cache for static assets, such as 1 year for images, two months for JS or CSS files, etc. If you have a lot of content and elements, you certainly don’t want to go through each TTL setting manually. Instead, you may prefer a global dashboard with a user-friendly process. That’s precisely where a CDN comes in!

For example, if you are using Bunny CDN, use the dropdown box to select the desired TTL for browser-cached assets:

Setting the Browser Cache TTL in one click

Important: some CDNs use machine learning techniques to determine the best TTL policy according to the content. It may be useful to expand your policy with dynamic objects and boost the cache optimization as much as possible. 

How a CDN helps TTL configuration  – Source: RocketCDN

This content distribution optimization efficiently serves content closer to a user while reducing the bandwidth required from the origin.

Why Is It Important to Have a Long CDN TTL?

The longer the asset stays in the PoPs cached server, the fewer requests will go to the

Now that we have gone over the different definitions for the Time to live metric let’s focus on RocketCDN. It’s a powerful yet easy-to-install CDN that handles all the configuration parts for you and will set the perfect TTL. 

Let’s go over the main features. 


Using RocketCDN to Configure and Setting Time To Live (TTL)

RocketCDN uses caching and more than 35 Points of Presence to distribute accurate content around the globe efficiently. 

Sounds promising? 

Let’s go over the best features of RocketCDN that will help boost your performance and serve accurate content faster to your international visitors. 

✅  RocketCDN: serving accurate and fast content worldwide

with an efficient TTL 

RocketCDN will determine the perfect Cache Time To Live (TTL) for your website. It will automatically set the time the visitor browser will cache a specific resource.

Serving fast and accurate content - Source: RocketCDN
Serving fast and accurate content – Source: RocketCDN

 DDoS attacks protection and ensuring network security

RocketCDN includes Secure Sockets Layer (SSL) traffic and protects your origin server in case of DDoS attacks. PoPs add several protection layers and therefore protect the origin server. 

Protecting the origin server from attacks – Source: RocketCDN

Easy installation and compatibility with any CMS

RocketCDN is very simple and easy to use. It does all the heavy lifting when it comes to technical configuration. The CDN also works with any website technology, including WordPress or Joomla. On the WordPress repository, you can even find the RocketCDN WordPress plugin that automatically points all your assets to RocketCDN.

Dedicated WordPress plugin - Source: WordPress repository
Dedicated WordPress plugin – Source: WordPress repository

Installing a CDN and managing the TTL metric is straightforward with RocketCDN! Using RocketCDN allows you to distribute accurate content more efficiently and increase the international performance of your website. 

Remember, you have up to 48 hours to cancel it if you don’t see any improvements. Try RocketCDN and start serving faster content today!