Catchpoint Platform
Complete, actionable insights and visibility into your entire digital user experience.
Capabilities
The Internet journey begins with DNS: Whenever you type the name of a website in a browser, open a social media application, or type an email, your computer or smartphone performs a DNS lookup to determine the IP address of the destination to which you want to connect.
The performance of the DNS lookup is the first determiner of how good or bad the end-user’s experience will be with the application or website. Caching is routinely used in DNS implementations to save time by storing recently resolved domain names, saving the time required to convert them to IP addresses. The Time To Live (TTL) value determines how long essential DNS information remains in the cache, so it plays an essential role in determining DNS performance and, thus, the performance of network systems overall.
In this article, we discuss the DNS TTL value in detail and discuss best practices for choosing and modifying TTL values to ensure high network performance.
To set the stage for understanding the DNS TTL value and why it’s so important, let’s begin with a backgrounder on how the DNS resolution process works.
There are two types of DNS lookups: recursive and iterative. A recursive query is one where the DNS server performs a complete lookup of the DNS record on behalf of an end client. Iterative lookup is where the DNS server either returns a resource record or refers to another DNS server to perform the lookup.
Recursive DNS resolution is typically an eight-step process:
Upon completion of the resolution process, the client connects with the web server using the provided IP.
The amount of time spent on getting the IP address directly impacts the browsing experience on the client, which is why DNS resolvers cache the answers returned to the client to make the resolution process more efficient and provide a better user experience. This cached answer can then be sent back to the next client requesting the address of the same website.
DNS records are configured with a Time to Live (TTL) value that specifies how long the DNS resolution record remains in the cache and when it needs to be refreshed. Choosing the right value is a balance between maintaining high performance and ensuring that the answers stored in the cache are updated and refreshed regularly.
{{banner-25="/design/banners"}}
The Domain Name System is a hierarchical structure that spans every domain name in the global Internet. Because of its enormous size, it is necessary to divide DNS into zones, which are specific portions of the overall namespace that are typically managed by a specific organization. For example, an organization called MyDomain might be responsible for the DNS zone mydomain.com.
The core information about how a particular DNS zone functions is stored in its DNS zone file. The zone file includes parameters that control the zone’s operation, including the mappings of DNS names to their respective IP addresses. Importantly, for our purposes in this article, the zone file also specifies different types of TTL values that are used to control DNS caching; as mentioned above, these values play a key role in DNS and thus site performance.
Shown below is the configuration file format for a domain name configured in BIND DNS. You can see that the default TTL value for the zone is right at the top of the file; in this case, it is three days. This TTL is used as a default for all DNS resource records in the zone unless explicitly overridden (as we’ll see in a moment).
After the ORIGIN record, which specifies the zone domain name, there is a Start of Authority (SOA) record that contains administrative information for the zone. The SOA record has a specific syntax and contains the following information:
DNS resource records have the following syntax:
The TTL value in the record is optional; if not specified, the default value used is the one defined as the zone TTL at the top of the zone file. The TTL value is specified in seconds unless it is suffixed with m (minutes), h (hours), d (days), or w (weeks).
The TTL value directly impacts the time it takes for updates of DNS records to be propagated. A longer TTL value means that the information provided by the authoritative DNS servers remains cached by DNS resolvers for more time. A smaller value means more frequent updates.
The benefit of a long TTL time is less load due to fewer queries being served by the authoritative servers. In addition, if there is any outage of the authoritative DNS, this will not impact the DNS resolution because these records remain cached on the resolvers. This results in a better website browsing experience for the end user.
The downside of a long TTL value is that it imposes a delay in propagating any changes in the DNS records. This can also lead to errors and other incorrect behavior until the TTL value of the cached record expires.
Unsurprisingly, short TTL values have the opposite pros and cons of long ones. Short TTL values mean that changes to DNS records are reflected much quicker. The drawback is that there is more load and dependency on the authoritative DNS servers.
Shorter TTLs will also make the DNS resolvers keep records for a shorter time, resulting in repeated queries to the authoritative DNS servers and thus causing delays in DNS resolution and longer application load times overall.
{{banner-26="/design/banners"}}
Longer TTL values are best used for records that do not change frequently and/or are part of a stable and static infrastructure. Shorter TTL values are better for records that are expected to change frequently.
The following are specific recommendations for the TTL values of different resource records:
There are scenarios where you need to change records that have long TTL values (e.g., a change to an email service or authoritative DNS service), and there is a need to reflect the change more quickly than would normally occur with the configured TTL. In such scenarios, it is always recommended to do proper planning and perform changes in four steps:
{{banner-23="/design/banners"}}
In the modern world, where service availability is a critical part of the end-user experience, applications are being deployed using high-availability designs. To enable load-balancing and automatic failover of services, DNS records can be used to redirect end-user traffic toward multiple servers and perform record changes when any of the application endpoints go up or down. The TTL value attached to the resource record determines how quickly the change of record will affect the end user.
A PowerDNS authoritative server supports dynamically generated DNS records based on requesting client IP or location, server availability, or other factors. These records are generated using LUA code snippets.
Shown below is an example resource record configuration of the PowerDNS server. The record is configured to perform a continuous health check (ifurlup) of the web service (web.domain.com) on multiple endpoints (172.16.16.20 and 172.16.17.30). The configuration returns all the IP addresses that pass the health check. The record has a TTL value of 120 seconds, and whenever there is any change of status in any endpoint, the authoritative server will provide updated records that will be reflected on the DNS resolvers after the expiration of the TTL value.
The second record performs the GeoIP location lookup of the incoming DNS request. If the client IP belongs to the US countryCode, the IP addresses of US-based servers are returned; if the request is from another part of the world, the IP addresses of servers outside the US are returned. The information can be updated every 5 minutes (TTL of 300 seconds).
Dynamic DNS is a mechanism where one can assign a DNS domain name to a dynamically changing IP address. DDNS is typically used to run an Internet-facing service on a residential broadband connection where the IP address is dynamically assigned by the ISP.
Using DDNS requires signing up with one of the DDNS service providers, which typically offer both paid and free services. Whenever an IP address changes at the client end, the IP needs to be registered with the DDNS provider, and the new resource record value needs to be reflected. The paid service typically allows small TTL values (5 minutes), while the free services have longer TTL values (15-60 minutes).
To use DDNS, you require either a client-end application or DDNS configuration in your Internet router. The application or router registers the client’s Internet address with the DDNS service provider. When the client’s Internet address changes (typically after a DHCP lease expires), the DNS resource record will become invalid, and the hosted application will remain inaccessible until the TTL values expire and the new record is reflected within the DNS resolvers. Important hosted applications might necessitate subscribing to a paid DDNS service to ensure faster updates.
This article covers the baseline recommendations of TTL values for different DNS record types. The configuration of DNS TTL values must be carefully planned based on the requirements of the infrastructure, load management of the authoritative DNS servers, the frequency of changes of information, and the required end-user experience.
{{banner-24="/design/banners"}}
The rich text element allows you to create and format headings, paragraphs, blockquotes, images, and video all in one place instead of having to add and format them individually. Just double-click and easily create content.
The rich text element allows you to create and format headings, paragraphs, blockquotes, images, and video all in one place instead of having to add and format them individually. Just double-click and easily create content.A rich text element can be used with static or dynamic content. For static content, just drop it into any page and begin editing. For dynamic content, add a rich text field to any collection and then connect a rich text element to that field in the settings panel. Voila!
A rich text element can be used with static or dynamic content. For static content, just drop it into any page and begin editing. For dynamic content, add a rich text field to any collection and then connect a rich text element to that field in the settings panel. Voila!Headings, paragraphs, blockquotes, figures, images, and figure captions can all be styled after a class is added to the rich text element using the "When inside of" nested selector system.
Headings, paragraphs, blockquotes, figures, images, and figure captions can all be styled after a class is added to the rich text element using the "When inside of" nested selector system.