Let’s imagine that you want to access maps.google.com to check the exact
time it would take for you to get to your dinner reservation from work-
1. You type maps.google.com into the address bar of your browser.
2. The browser checks the cache for a DNS record to find the corresponding IP address of maps.google.com.
DNS(Domain Name System) is a database that maintains the name of the
website (URL) and the particular IP address it links to. Every single
URL on the internet has a unique IP address assigned to it. The IP
address belongs to the computer which hosts the server of the website we
are requesting to access. For an example, www.google.com has an IP address of 209.85.227.104
In order to find the DNS record, the browser checks four caches.
●
First, it checks the browser cache. The browser maintains a repository
of DNS records for a fixed duration for websites you have previously
visited. So, it is the first place to run a DNS query.
● Second, the browser checks the OS cache. If it is not found in the browser cache, the browser would make a system call (i.e. gethostname on Windows) to your underlying computer OS to fetch the record since the OS also maintains a cache of DNS records.
●
Third, it checks the router cache. If it’s not found on your computer,
the browser would communicate with the router that maintains its’ own
cache of DNS records.
●
Fourth, it checks the ISP cache. If all steps fail, the browser would
move on to the ISP. Your ISP maintains its’ own DNS server which
includes a cache of DNS records which the browser would check with the
last hope of finding your requested URL.
3. If the requested URL is not in the cache, ISP’s DNS server initiates a DNS query to find the IP address of the server that hosts maps.google.com.
4. Browser initiates a TCP connection with the server.
Once the browser receives the correct IP address it will build a
connection with the server that matches IP address to transfer
information. Browsers use internet protocols to build such connections.
There are a number of different internet protocols which can be used but
TCP is the most common protocol used for any type of HTTP request.
5. The browser sends an HTTP request to the web server.
Once the TCP connection is established, it is time to start transferring
data! The browser will send a GET request asking for maps.google.com
web page. If you’re entering credentials or submitting a form this could
be a POST request.
6. The server handles the request and sends back a response.
The server contains a web server (i.e Apache, IIS) which receives the
request from the browser and passes it to a request handler to read and
generate a response.
7. The server sends out an HTTP response.
The server response contains the web page you requested as well as the status code, compression type (Content-Encoding), how to cache the page (Cache-Control), any cookies to set, privacy information, etc.
8. The browser displays the HTML content (for HTML responses which is the most common).
The browser displays the HTML content in phases. First, it will render
the bare bone HTML skeleton. Then it will check the HTML tags and sends
out GET requests for additional elements on the web page, such as
images, CSS stylesheets, JavaScript files etc. These static files are
cached by the browser so it doesn’t have to fetch them again the next
time you visit the page. At the end, you’ll see maps.google.com
appearing on your browser.

No comments:
Post a Comment