While all you have to do is click one to visit a website, the actual journey required to load it is several thousand miles and may involve several millions of devices.
Till date, you must have opened hundreds or thousands of websites in PCs or mobiles, read them or done many things like banking in them. If you are new or you are a little unsure about what a website is, don't worry. What is your last post - web page? What is the structure of a web page? You can get a lot of information about this by mere reading.
But if you know what the web site is, what the internet is, then it does not mean that you will know the story behind visiting the websites.
When you open a web site, it takes only a few seconds to travel to hundreds or thousands of kilometers - the time it takes for the website to load on your device - but in these few seconds, a distance of several thousand miles may have to be decided. Yes, really several thousand miles in a few seconds! Now, let us slow down the time and know what exactly happens when we want to visit a website.
When you visit a website, there are many things behind the scenes that you may not know about. Let's go through a list of things that happen in that order:
You enter a URL
Of course, navigation on a website starts when a user starts it. Usually, you will click on the address bar of your browser and enter an address like google.com or steemit.com. We call this a URL, which is the Uniform Resource Locator. A URL is a human-friendly name for a website's address.
You should know that the Internet basically works according to the client-server model. Imagine that you are ordering tea at the hotel. You ask the person behind the counter for tea and he gives it to you. The same is true for websites, which are actually devices called servers.
These servers can be anywhere in the world. Whenever you want to visit a website, your device creates a request that will be sent to the server.
The web is a bunch of different technologies, but it has two concepts, whose original work is still unresolved. Web browser, and web server. These operate on the "old" client / server model which is as follows: A client connects to the server using an address (an IP or a name), and makes some requests. The server then responds to the client and proceeds the way.
Clients connect to the server, but not the other way around. Although, today's web technology has made significant changes to this model, we will use it to explain this process in a simple way.
So, you enter a web address in your favorite browser and go to a webpage. When you press the enter key from your keyboard and finally see the page being displayed, in between, the following things happen:
Your browser uses DNS to find the website's IP address.
The line above may contain some abbreviated forms that are unfamiliar to you - don't worry! They are explained in below.
Once you press enter after typing the address in your browser, you will need to see the IP address of the site you want to see. An Internet Protocol address is simply a unique, computer-friendly address used to search websites. Typically, they are separated by four sets of digits, like 18.104.22.168.
However, there is a step in the middle of it. Remember when you first entered steemit.com? But this language is not understood by the computer and cannot do anything with it; It needs to be translated to an IP address. This is accomplished by something called DNS, or the Domain Name System.
In simple words, DNS translates human-friendly URLs (such as busy.org) to a computer-friendly IP address (22.214.171.124). Depending on whether you have recently opened this website, your browser can access this DNS information from many sources, including your computer or Internet Service Provider (ISP).
Without DNS, you have to remember the list of IP addresses instead of website names, which are not possible for you! Not even for any individual!
For steemit.com, first, the DNS recursor will contact the root name server. The root name server will redirect it to the .com domain name server. The .com name server will redirect it to the steemit.com name server. The steemit.com name server will find the matching IP address for steemit.com in its 'DNS' records and return it to its DNS recursor which will send it back to your browser.
These requests are sent using small data packets, which contain the contents of the request and the IP address that is assigned to it (the IP address of the DNS recursor). These packets travel through multiple networking devices between the client and the server before reaching the correct DNS server. These devices use a routing table to find this address, to determine which is the fastest possible way for the packet to reach its destination. If these packets are lost, your request will fail. Otherwise, they will reach the correct DNS server, grab the correct IP address, and return to their browser.
Do you know how the packet travels from one country to another? There is a huge network of wires connecting Internet hubs all over the world. These wires traverse the expanse of land, sea and even entire oceans! All these wires are fiber optic cables, which can transfer data at the speed of light! Yes, they are very fast.
The browser initiates a TCP connection with the server.
Once the browser acquires the correct IP address, it will create a connection with the server that matches the IP address to transfer the information. Browsers use the Internet protocol to make such connections. There are many different Internet protocols that can be used, but TCP is the most common protocol for any type of HTTP request.
In order to transfer data packets between your computer (client) and the server, it is important to establish a TCP connection. This connection is established using a process called TCP / IP three-way handshake. It is a three-stage process where clients and servers exchange SYN (synchronize) and ACK (acknowledge) messages to establish a relationship.
The browser sends an HTTP request to the web server.
After the TCP connection is established, it's time to start the data transfer! The browser will send a GET request to the facebook.com web page. If you are entering credentials or submitting a form, it can be a POST request. This request will also contain additional information such as browser identity (User-Agent header), types of requests it will accept (Accept header), and the connection header will ask it to keep the TCP connection alive for additional requests. It will also pass information taken from the cookies that are in store for this domain.
The server handles the request and sends a response.
The server consists of a web server (ie Apache, IIS) that receives a request from the browser and passes it to a response handler to read and generate a response. The request handler is a program (written in ASP.NET, PHP, Ruby, etc.) that reads the request, its headers, and cookies, to check whether the request is being made and also update information on the server when needed. Does. It will then assemble a response in a special format (JSON, XML, HTML).
The server sends an HTTP response.
Server response includes your requested web page as well as status code, compression time (Content-Encoding), how to cache the page (Cache-Control), any cookies to set, privacy information and more.
The browser displays HTML content (which is most common for HTML responses).
The cycle continues
After downloading the webpage, the journey to your browser is not over. If you click on a new link, all these steps start again. And if you send some information (like a search query to Google) to the page, it uses that query to take some action.
Depending on the page, your browser may also interact with the server in the background before you send more information. For example, when you sign up for a website and you have to type your password twice, many pages will tell you that they have not matched before you press Enter.
You clicked on the website you wanted to visit! The process behind the scenes to access your website within those few seconds is simply staggering. Regardless of where you are in the world, an average internet speed will load and deliver your website in a few seconds. It is a miracle of modern science.
So next time you click on the website link remember this remarkable journey!