What Happens When You Type google.com and Press Enter
Published: 2022-10-08 02:12:21

![Web Infrastructure. Credit: Mildred Makori](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pkw9yg5tgyt41jpehjgd.jpeg)_image credits: Mildred Makori_

The wonder of technology is its ability to simplify our lives. As a student, and many students will agree, the internet is an asset because I get to Google my way out of tight spots. But what exactly happens when you type _https://google.com_ and press Enter? The process is quite exciting, made even more beautiful by the speed and efficiency by which it happens.

## <u>**The Address**</u>
The _https://google.com_ page is a regular HTML and CSS file that is stored on another computer (a server) somewhere far away(depending on your location). The browser’s (_client_) job is to then communicate with this server (_host_), request the file and display it to us- much like a waiter at your favorite restaurant.

Although worded addresses like _wikipedia.com_ or _spotify.com_ are distinct and make sense to human beings, they mean nothing to a computer (hello Rick and Morty fans). It is, therefore, important to note that servers, and all computers on a network by extension, identify each other by a sequence of digits called IP addresses. There are currently two classes of IP addresses, **IPv4** and **IPv6**. We will not get into their finer details for today. The IPv4 system is the most widely used and may look something like this _192.0. 231.146_.

## <u>**The Domain Name System**</u>

![Domain Name System. Credit: GeeksforGeeks](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vl9izwlffvnjmp2vxgkd.png)_image credits: GeeksforGeeks_

After pressing **Enter**, the browser needs to figure out the address on which the **https://google.com** file is kept. It does this by sending a request to the Domain Name Server (DNS). This is a special server tasked with keeping a registry of IP addresses to servers on the internet. Think of it as a the Yellow Pages. If you are from Generation Z then a simple address book will do.

The DNS checks the worded address we typed against its registry and, once it finds a match, returns the corresponding IPv4 address for the server on which the _https://google.com_ file to the client.

_Browser: Hello good friend. I am looking for this guy https://google.com. Could you point me to where he lives?
DNS: Sure thing! Just a moment. Here you go. He lives at 192.0. 231.146._

Since the internet is a number of interconnected machines, your computer will now send out a request to the address 192.0. 231.146 telling it that it would like a copy of the file _https://google.com_.

## <u>**TCP/IP and HTTP**</u>
Since computers on a network send information back and forth between each other, they need a universal system for sending and receiving said data. The **Transmission Control Protocol/ Internet Protocol** is therefore the set of standardized rules that govern how this happens. They simply specify formats and procedures to be used so that one computer can easily make sense of data from another computer.

**HyperText Transfer Protocol (HTTP)** falls under this family and defines how text information is sent over a network. Since websites are coded using HTML text, it forms the basis of all internet communication. Our request for _https://google.com_ is but a request for the HTML file describing the layout of the page.

## <u>**Web Servers**</u>

![Client-Server Model. Credit: Wikipedia](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xfyazwpy09eauin3ocuf.png)_image credits: Wikipedia_

A server is a computer software or hardware that provides some functionality for a computer or system of computers. A web server is therefore tasked handling HTTP/HTTPS requests i.e. sending static HTML, CSS and other files to provide functionality for the internet. An application server usually has the same functionality but with the added capability of carrying out business logic including complex operations (to be delivered to the web server), resource management and APIs. We also have web servers, which we'll get to shortly.

As you would imagine, the internet is a very busy place. There are possibly millions of pages being opened every second. If this was to be handled by a single server, the repercussions would be disastrous. The best case scenario would have the server fulfilling requests one at a time. This would result in an extremely slow and undesirable experience for the user (wave if you used dial up internet).

To remedy this, companies like Google have multiple servers set up around the world in server farms. These servers  can handle a certain amount of traffic efficiently. Each hosts the exact same files so that the information is consistent across the board. In addition, they have backup servers that quickly fire up in case of failure so that we are blessed with a seamless and smooth experience.

What happens when one server is busy and cannot handle an incoming request yet there is an idle one enjoying the Saturday afternoon nearby? Surely there must be a system that dictates such rules, right? Well, luckily, we have **load balancers** that do exactly that and a little more!

## <u>**Load Balancer and SSL**</u>
I like to think of load balancers as traffic cops. This is a piece of software that sits just outside the servers and dictates how requests are distributed.

So now our browser has done a bit of looking up and finally located the public IP address _192.0. 231.146_. However, there are two severs, say, currently hosting the same file. To maintain high efficiency, the load balancer will use a predetermined algorithm that calculates how to distribute requests according to server availability, server capability or some other criteria.

Now we can finally access the files on the server, right? Well, not quite yet. The load balancer is after all, still a cop. And we primarily associate cops with security.

We do not want to allow just anyone into our servers. Some people scour the internet with the intent of stealing valuable information or jeopardizing systems- I’m looking at you hackers. Therefore, there is need to have a form of security system between the client and server. This is conveniently done by installing an **Secure Sockets Layer certificate (SSL)** certificate. Consequently, websites with SSL enabled will use an improved version of HTTP known as **HTTPS** (the ‘S’ stands for secure) and will instead start with https://... while those without do not have it i.e. http://...

The SSL certificate establishes an encrypted link between the server and client for communication purposes. The link lasts for the duration of the session. This also has the added advantage that, if by any chance, a hacker manages to intercept communications anywhere in the network (for example by hacking your home router), they cannot make any sense of the information sent or received. Alas, your credit card information remains safe and secure.

A website with SSL installed shows a **lock** icon on the address bar of your browser as you browse the site. This is an vital check for distinguishing genuine organisations from fake ones. To obtain said certification, companies undergo a rigorous verification process to authenticate their legitimacy.

Therefore, next time before you enter any personal information on a website, especially the one Karen from work forwarded to you about a sale, check if the lock is present in the address bar.

## <u>**The Response**</u>
Finally, we can now access the server!

The HTTP request we sent is now forwarded to the appropriate server  which looks up the file we specified and sends it back to us as an HTTP response. The file is usually an HTML file but if it has been styled and has images, the corresponding CSS and image files will also be sent back the client. 

The browser will then apply the structure and styling rules and display the page in a polished manner. Pretty cool, right?

Sometimes we may need to log in and/or access our information. These are kept in a special database server that maintains records of user data in an organized manner. Such requests will, thus, be forwarded to the database server and the necessary data fetched and served back to the client.

Each server is equipped with a firewall that monitors incoming and outgoing traffic on the server, giving us a sense of server performance. It is important to monitor server performance if we are to maintain high levels of efficiency and client satisfaction. We can also use the data to diagnose and fix failures and other server issues. Remember, in a dopamine-ridden age, slow response on your website will get you canceled.

<u>**

## Conclusion
**</u>
The marvel that is the internet is carefully structured and calibrated to server a highly digital world. We have looked at what happens at every step of the way from when you enter a website to visit, to viewing it on your screen at the comfort of our home.

There are multiple moving parts under the hood that should, in reality probably take a good chunk of time to execute. On the contrary, all these happen at lightning-fast speed in ways I choose to call _scientific-magic_. To me, this is the true wonder of the internet.