TLDR: Why does DNS use both UDP and TCP
Date: 2025-09-02 Source: https://arpitbhayani.me/blogs/dns-udp-tcp
Overview
DNS is one of the most critical pieces of internet infrastructure, quietly translating human-readable domain names into IP addresses billions of times per day.
Key Points
- DNS is one of the most critical pieces of internet infrastructure, quietly translating human-readable domain names into IP addresses billions of times per day.
- Understanding DNS Query Patterns: Before exploring the transport protocols, let’s establish the context.
- Where UDP Comes In: DNS primarily uses UDP on port 53, and this choice is fundamental to its performance characteristics, typically gained by avoiding the three-way handshake required by TCP.
- TCP, When UDP Isn’t Enough: While UDP handles the majority of DNS traffic, certain scenarios require TCP’s additional capabilities.
- How Fallback Works: Understanding how clients handle UDP-to-TCP fallback is interesting … Let’s dig deeper Client Behavior Most DNS resolvers implement a standard fallback pattern: Here’s how this might look in pseudocode: Performance Implications The fallback mechanism is costly but essential.