What Happens When You Type ‘google.com’ In Your Browser and Press Enter

What Happens When You Type ‘google.com’ In Your Browser and Press Enter

This is my attempt to answer the age-old question, what happens when you type 'google.com' into your browser and hit enter? Now, of course, on the surface, Google’s homepage simply appears on your screen, but under the hood a lot is happening. Let’s dive into just how much.

PS: There’s a TL; DR at the end for the busy folks.

I’ll be using a few technical terms in this article I think are worthy of definition:

1.????? Server: A computer or system that provides resources, data, services, or programs to other computers, known as clients, over a network. Think of it as a computer that houses the internet’s data such as documents, photos and videos.

2.????? Client: The receiver of data from a server.

3.????? Firewall: A firewall acts as a security barrier that monitors and controls incoming and outgoing network traffic based on predetermined security rules. A firewall plays a crucial role in protecting the network and systems involved in the loading of a web page.

4.????? DNS (Domain Name System): Acts as an internet phonebook, mapping names (like google.com) to IP addresses, enabling DNS clients to reach the origin server.

5.????? IP (Internet Protocol) address: A series of numbers that identifies any device on a network.

6.????? TCP (Transmission Control Protocol): A network protocol that allows computers to communicate on a network such as the internet. TCP is responsible for data delivery once the IP address has been found. Because they're so often used together, “TCP/IP” and the “TCP/IP model” are now recognized terminology.

7.????? HTTP (Hyper Text Transfer Protocol): HTTP is a network protocol for transmitting hypermedia documents, such as HTML. It was originally designed for communication between web browsers and web servers.

8.????? ISP (Internet Service Provider): A company that provides Internet access to consumers and businesses. Most large telecommunication companies, such as mobile and cable companies, are ISPs.

9.????? Database and DataBase Management System (DBMS): A database is an organized collection of structured information or data, typically stored electronically in a computer system. A DBMS is a software system used to store, retrieve, and run queries on data. A DBMS serves as an interface between an end-user and a database, allowing users to create, read, update, and delete data.

10.?? Load balancer: A?device or service that dynamically distributes network traffic across servers. They are used to distribute capacity during peak traffic times, thereby increasing the reliability of applications. Load balancers can use various algorithms based on server performance and response times to determine the server to route traffic to.

Here is a schema to explain the whole process:

Step 1 – DNS Resolution (finding the address): Your browser first checks its cache to see if it has the IP address for 'google.com'. If it doesn’t, it sends a request to a DNS server to convert the human-friendly 'google.com' into the IP address of Google’s server. If your computer has a firewall (such as Windows firewall), it will inspect the outgoing request to ensure it adheres to security policies. Since all servers are labelled with an IP address, your browser (which is the client) sends a request to the DNS server, asking it to fetch Google’s server IP address and the DNS server responds with the address for 'google.com'.

Step 2 – TCP/IP Connection: With the obtained IP address, the browser initiates a TCP connection to the server. This involves the browser sending a synchronization (SYN) packet to the server, the server responding with a synchronization-acknowledgement (SYN-ACK) packet, and finally, the browser sending an acknowledgement (ACK) packet back to the server, establishing the connection. This is known as a ‘three-way handshake’. When the browser initiates a TCP connection to the server's IP address, it also specifies a port number. In this case, port 443 will be used since we are sending traffic over HTTPS. The IP address returned by the DNS may point to a load balancer rather than a specific web server, which then decides which web server should handle the connection based on its load-balancing algorithm. For future reference, we’ll assume the IP returned from the DNS server is that of a load balancer, as this will most likely be the case considering Google is the most viewed website in the world and as such has huge traffic to handle. During the TCP handshake, local and ISP firewalls monitor these packets to ensure they are part of a legitimate connection.

Step 3 – SSL/TLS Handshake: Because we are connecting to a secure webpage (HTTPS), a TLS handshake (lots of handshakes I know) is performed to establish a secure connection. This includes exchanging encryption keys and verifying the server's SSL certificate to ensure a secure and trusted connection. This process is also monitored by firewalls. They ensure that the encryption negotiation is not tampered with and that certificates are valid.

Step 4 – HTTP Request (The main order): Now that the connection is established and secure, your browser sends an HTTP GET request to the load balancer, requesting the homepage of 'google.com'. The load balancer forwards it to one of Google’s web servers on port 443, the default port for HTTPS connections to handle based on the current load, server health, and other criteria. As the request reaches Google's servers, it encounters multiple layers of firewalls that Google has in place to protect its infrastructure. They inspect incoming traffic to ensure it doesn't pose a threat.

As the request is being processed by Google’s web server and application server, internal firewalls protect the communication between different server components (e.g, web server to application server, application server to database). They ensure that only authorized traffic reaches the application server and database, blocking unauthorized access attempts.

Step 5 – Web Server Reception (The waiter takes it away): A server that specializes in rendering (showing) web pages receives our request to view 'google.com'. If it's a static webpage, the server directly serves the content but if it's a dynamic request (as in this case), the server passes it to the appropriate application server.

Step 6 – Application Server Processing (The chef prepares your order): The application server examines the request (checks the URL path, query parameters, request headers, etc.) to determine the appropriate action to take, similar to how a chef reviews an order to determine how exactly a client wants their meal cooked. This might involve rendering a template, fetching data from a database or performing some other logic.

Step 7 – Interacting with the Database: To fulfil the request, the application server often needs to fetch or store data, requiring interaction with a database. In line with our analogy, consider a chef needing extra ingredients for a meal so he goes to the store to get them to make the meal as complete as it needs to be. The trip to the store is a query which the application server constructs and sends to the database management system (DBMS). The DBMS receives said query, optimizes and executes it, and then returns the results to the application server. These results may include user information, product details or in our case, whether or not we are signed in.

Step 8 – Processing query results: Back to the application server, it receives and processes the query results, formats the data for the response, and renders a template with the fetched data to generate HTML content. It then constructs an HTTP response, setting appropriate HTTP headers, and including the HTML, JSON, XML or other data formats in the response body.

Step 9 – Sending the Response: Now that the response is ready, the application server sends it back to the web server, which forwards it to the load balancer. The load balancer then sends it to your browser over the network. The response passes through the same layers of firewalls on the way back to ensure that the outgoing traffic is safe and hasn’t been compromised.

Step 10 – Rendering the Page (Your meal is ready): Et voilà, the HTML content is parsed by the browser and the webpage is displayed on your screen.

TL; DR:

  1. DNS Resolution: The browser checks its cache for google.com's IP address. If not found, it requests the IP from a DNS server.
  2. TCP/IP Connection: The browser initiates a TCP connection to the server's IP, likely a load balancer, using a three-way handshake.
  3. SSL/TLS Handshake: For HTTPS, a secure connection is established via a TLS handshake, exchanging encryption keys and verifying certificates.
  4. HTTP Request: The browser sends an HTTP GET request to the load balancer, which forwards it to a web server.
  5. Web Server Reception: The web server receives the request and either serves static content or passes it to an application server for dynamic processing.
  6. Application Server Processing: The application server processes the request, potentially querying a database for data.
  7. Database Interaction: The database processes the query and returns results to the application server.
  8. Processing Results: The application server formats the data, generates the response, and sends it back to the web server.
  9. Sending the Response: The response travels back through the load balancer and various firewalls to your browser.
  10. Rendering the Page: The browser receives the response and renders the webpage.

I want to say thank you to alx_africa for making us do this project as it made me do quite a bit of research and I learnt a bunch of new things.

Please leave a like and connect with me if you found this educative or informative.

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

Samuel Odumu的更多文章

社区洞察

其他会员也浏览了