Type google.com in your browser, press Enter, and let the magic happen.
Source: https://fractaliasystems.com/wp-content/uploads/2016/06/Internet-de-los-servicios-04.png

Type google.com in your browser, press Enter, and let the magic happen.

What happens when you type google.com in your browser and press Enter? If you don't know the basics about how the internet works, it can seem like magic happened when the main page of Google appears in front of your eyes by doing something that simple. Well, it's not magic, but it can feel quite magical when you realize that the information in front of your eyes just traveled across continents from one computer to another in less than a second.

One can say that this action is compared to a journey, where the traveler is your google's main page request (called HTTP or HTTPS request), so let's analyze it as a journey. This journey has basically 3 steps, but there are a lot of components and concepts in between.

TCP/IP

tcp-ip

Before talking about the 3 steps, you need to know TCP/IP. Computers and devices on the internet have identification, so they can be recognized and not be confused with another computer/device. For this, there is a sort of id for each device known as IP (Internet Protocol) address. This Protocol assigns a number to each device. In IPv4 (IP version 4), is a number of 32 bits is assigned, in IPv6 (IP version 6) is a number of 128 bits (4 times bigger than IPv4, this is because of the exponential increase in the number of devices connected to the internet).

On the other hand, the TCP (Transmission Control Protocol) is the protocol that gives instructions on how to assemble and disassemble the packets of information that the client (you) requested. TCP/IP is the combination of these two protocols. Together they make it possible to transfer information through the internet.

HTTP/HTTPS

http

Another important concept to have clear is HTTP/HTTPS. Stands for HyperText Transfer Protocol (HTTPS is HyperText Transfer Protocol Secure), and is the protocol that allows web browsers and web servers to communicate, thus making possible the transfer of web pages and other types of information.

The difference between HTTP and HTTPS is that the latter includes the use of an SSL certificate, which allows encrypted communication between the web server and the web browser so that any packet of information traveling between these two is encrypted, making it impossible for a third to intercept and understand the information.

With this clear, now is time to talk about the 3 steps that an HTTP (or HTTPS) request makes.

First step: DNS

dns

The first step when you send the request from your browser is the DNS, which stands for Domain Name System. As you now know, computers and devices have an IP address that identifies each other. This address is a long number that for humans could be difficult to remember. So the DNS was created to link an IP address with words that are easier to remember, so for example you don't have to remember the IP address of Google's servers, you just search for google.com.

This relation between an IP address and a domain name is saved in records, specifically in "A records". There are many different types of records, but for now, you need to know 2 of them: A records (a domain name that refers to an IP address) and CNAME records (a domain name that refers to another domain name, for example, www.google.com refers to google.com).

When you make an HTTP/HTTPS request, your web browser and the OS (Operating System) first searches in the cache for the IP of google.com. If it's not there, the OS makes a request that travels to different machines that can have the IP stored, or can have the reference of where to find it. These machines are the Resolver, the root, the TLD (Top Level Domain), and the authoritative name server. This chain of references is designed so it's almost certain to find any web page you're looking for.

Now with the IP obtained, it's time to move to the server itself.

Second step: Web server

Having the IP of google.com, the next step is to send the HTTP (most likely it'll be an HTTPS request because google and every trustworthy web page nowadays have an SSL certificate) to its web server. First, the request will arrive at one of google's load balancers.

Load Balancer

No alt text provided for this image

A load balancer is a program (usually installed in a server apart from the web servers) that is responsible for distributing the incoming request between the available servers in the data center. This prevents a particular server gets overloaded with requests while other servers are available.

There are different algorithms used to do this distribution. One of the most popular is round-robin, which consists of sending each incoming request to each server in turns, so when the last server receives a request, the next request is assigned to the first server again.

But before the request gets to the respective server, it first is supervised by the load balancer firewall.

Firewall

No alt text provided for this image

A firewall's main purpose is to filter incoming traffic of information and protect a computer/device from unauthorized access by outsiders. This prevents attacks from hackers, viruses, and other threats present on the internet.

After the firewall filters your request, it arrives at the web server.

Web server

No alt text provided for this image

The basic purpose of the web server is to respond to HTTP/HTTPS requests with the content that is being requested, that is, a web page (an HTML document with its corresponding components). If the request is for static (non-dynamic, it doesn't need access to a database) content, the web server alone can respond to the request. But if the request needs information from a database, the application server needs to intervene.

Application server and Database

No alt text provided for this image

The Application server possesses applications that allow access to the database of the website. This is important when your request needs you to provide information to be stored, or if you need information you stored before to be retrieved, this interactivity is possible thanks to the application server connected to the database, where all the information is organized and stored.

Third step: Back to the client

With the information ready in packets, the web server sends an HTTP response with the information requested. This response has instructions to the web browsers on how to unpack the packets in order, so the client can open the web page as intended.

And with this, the journey is completed, now you have in front of you google.com as you requested.

要查看或添加评论,请登录

Juan Sebastian Perea Bescos的更多文章

  • IoT: Connectivity to another level.

    IoT: Connectivity to another level.

    Since the beginning of humanity as a civilization, communication has been essential for communities to survive…

  • Python: Everything is an object

    Python: Everything is an object

    In Python, everything is an object, which means that compared to C the data types now are classes, the variables are…

  • Static vs Dynamic libraries

    Static vs Dynamic libraries

    Libraries are a very important tool in programming because they let the programmer re-use the code he/she created, so…

  • What is a Static library in C?

    What is a Static library in C?

    A library in C language is a tool that is responsible for containing object files of C programs (programs that…

  • How compilation works

    How compilation works

    In computing, compiling is the process where the source code, written in a programming language (or high-level language…

  • What is the difference between a hard link and a symbolic link?

    What is the difference between a hard link and a symbolic link?

    A link is a pointer that shows us where is some file that we need to know its location inside the computer. There are…

社区洞察

其他会员也浏览了