HTTP protocol, DNS Lookup, DNS Caching, Routing, Networking, TCP connection, Browser Cookie handling, CDN etc
What happens when you type www.google.com in your browser's address bar?
Upasana | May 19, 2019 | 2 min read | 112 views
There are series of events that happen when we type in www.google.com into browser’s address bar from a given location, we will cover few main steps here -
-
User enters www.google.com into the address bar
-
Browser checks if the typed address is www url or the search term, if it is search term then it will use pre configured web search server (may be google or bing, etc) to search the typed term from web.
-
If the requested Object is in browser’s cache and cache is valid, content is rendered from cache, otherwise
-
DNS Lookup takes place - Browser resolves the IP address for the mentioned server (www.google.com)
-
It checks in the browser cache
-
Checks the OS Cache
-
Checks the router cache
-
Checks the ISP cach** DNS recursive search until it reaches authoritative DNS Server. If multiple ip addresses are found for a given server address, then DNS Round Robin algorithm picks up any one for the further communication. If it does not recognize the domain then it gives error message. We can use command on windows to check what all IP addresses are mapped to this www.google.com domain, incase they are multiple DNS server will use round robin algorithm to pick up any one from the list.
-
-
Browser initiates TCP connection with the IP address and issues HTTP GET request to the server, it passes along an HttpRequest that includes metadata about browser, user preferences (language, locale etc.) and cookies for that domain.
-
Google.com server receives the request, uses the passed information (cookies) to find who the user is, locale, language and region and sends http redirects (HTTP GET 302) to browser to use local regional google server, i.e. www.google.co.in in our case (temporarily redirect)
-
Browser receives the response (302 in this case) and sends a fresh request to the newly mentioned location in the previous response, passing the user information again (cookies for that domain, metadata, etc)
-
Google.co.in receives the request the decodes the user and send the appropriate HTML response including headers (status code 200 OK, content type, etc)
-
The Browser receives the response and begins to parse it for display. if it is compressed, browser will decompress it, The HTML body will include links to css, images, js. All these links will trigger additional calls back to server to retrieve those files. CDN (Content Delivery Networks) may serve these static resource requests to speedup the process.
-
Browser layout engine will start to assemble the final page for display. css, js information may alter the layout of the page.
-
The final page is assembled and rendered to the user.
-
After this the browser may send further AJAX request to communicate with the web server even after the page is rendered.
Also, there are many other things happening in parallel to this (processing typed-in address, adding page to browser history, displaying progress to user, notifying plugins and extensions, rendering the page while it’s downloading, pipeline, connection tracking for keep-alive, etc.).
Top articles in this category:
- Which data type would you choose for storing Monetary Values, Currency in Java
- Use ExecutorCompletionService to compute results from 5 different datasources in parallel
- Multi-threading Java Interview Questions for Investment Bank
- What is difference between HTTP Redirect and Forward
- Cracking core java interviews - question bank
- RBS Java Programming Interview Questions
- Citibank Java developer interview questions