Browser workflow from downloading resources to rendering the page part 1

Explore the browser workflow from downloading resources to rendering the page

November 14, 2024

Understanding the DNS resolution process

When we enter a URL in the browser, the browser will resolve the domain name to an IP address, this process is called DNS resolution. But how does the browser resolve the domain name to an IP address? Here is the process:

Step 1: Check browser DNS cache

If the browser has cached the result, it will return the cached immediately, but the cache will expire/cleaned after a certain period of time or when the browser is closed. Normally, the browser has its own DNS cache mechanism.

Step 2: Check OS DNS cache

If the browser doesn't have the result in its DNS cache, it will check the OS DNS cache. This cache is shared by all applications on the OS, life cycle is longer than the browser's DNS cache.

Step 3: Query ISP DNS server

If there's no result in step 1 and 2, the browser will query the ISP DNS server, in this stage, the ISP DNS server will recursively query the DNS server of the domain name, it will go through the following DNS servers:

Step 3.1: Root DNS server

Reference: Root Servers

Step 3.2: TLD DNS server

Step 3.3: Authoritative DNS server

Summary

When we enter a URL in the browser, there're several steps to resolve the domain name to an IP address:

  1. Check browser DNS cache, if there's no result, go to step 2.
  2. Check OS DNS cache, if there's no result, go to step 3.
  3. Query ISP DNS server, it will go through (recursively) root DNS server, TLD DNS server and Authoritative DNS server to get the IP address of the domain name, then update cache.
  4. Return the IP address to the browser.

Vocabulary

Back to Blog 🏃🏽‍♀️