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?
Carvia Tech | May 19, 2019 | 2 min read | 135 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:
- Top 50 Multi-threading Java Interview Questions for Investment Bank
- Cracking core java interviews - question bank
- Citibank Java developer interview questions
- RBS Java Interview Questions
- BlackRock Top Java Interview Questions: Investment Banking Domain
- Morgan Stanley Java Interview Questions
- UBS Top 10 Java Interview Questions
Find more on this topic:
Recommended books for interview preparation:
- Spring Security 5 - There is no PasswordEncoder mapped for the id
- Inter-thread communication in Java
- What are different thread states in Java
- Static method synchronization aka Class Lock in Java
- What is difference between HTTP Redirect and Forward
- Top 20 Java Concurrency Interview Questions and Answers
- What is Single Abstract Method (SAM) and Functional Interface in Java
- Difference between method overloading and overriding
- Method overloading rules in Java
- TCS - Microservices Interview Questions for Java Developers
Enter your email address to subscribe to this blog and receive notifications of new posts by email.