What Happens When You Type "google.com" and Press Enter

Tk CodesTk Codes
4 min read

You might think that its all magic when you type "google.com" in your browser and press enter. Well, you may call it magic but there is a whole lot that happens under the hood. It's a complex dance of technologies, protocols, and servers working in harmony to deliver the information you seek.

Let's delve into this seemingly simple action and unveil what really happens.

The First Step: DNS Lookup

Computer uses some unique numbers called IP addresses short for Internet Protocol address, to ensure that information is sent and received to the correct destination. An IP address is typically written as a set of four numbers separated by periods, like 172.217.170.174 Each number can range from 0 to 255.

As humans we can't possibly remember each IP address for the websites we want to search and that's where Domain Name System (DNS) comes to the rescue.

Your innocent act of typing "google.com" first encounters the Domain Name System (DNS). Think of it as the internet's phonebook, translating human-friendly URLs into numerical IP addresses computers understand. Your browser checks its cache for a recent record, but if not found, it sends a request to a DNS server. This server then contacts authoritative servers for "google.com" and retrieves the corresponding IP address.

Handshake and Delivery: TCP/IP and Firewalls

With the IP address in hand, your browser initiates communication using the TCP/IP protocol suite. Imagine a three-way handshake like securing a connection before a conversation. This ensures reliable data transmission across the network. However, before reaching its destination, the data might encounter a firewall, a security guard inspecting incoming traffic. The firewall protects different points of this journey from the load balancer to the web servers, ensuring that your data is protected. If everything passes and their is no malicious activity going on, the data flows freely.

Securing the Connection: HTTPS and SSL

In today's world, security is paramount. When you see "https://" before "google.com", it means the communication is encrypted using Hypertext Transfer Protocol Secure (HTTPS) and Secure Sockets Layer (SSL). This encrypts data using complex algorithms, ensuring only the intended recipient can decipher it, protecting your privacy and sensitive information. This would be like you and your best friend having a secrete language that only you two can understand.

Distributing the Load: Load Balancers

Have you ever been to a supermarket during peek times? For example when people have left work and need to stop by and buy a few things, which really isn't a few things? The ques are always long especially when there is one or two cashiers working. Sometimes I get frustrated waiting in the long ques and just leave.

Now imagine having four, five or even six cashiers working, the lines become smaller and the wait time less thus no frustration for me and you!

Think of the customers in the lines as data request for a certain website, in our case Google. The cashiers here are servers and the supermarket is the website you are visiting.

What a load balancer would do is distribute the customers to the different cashiers making sure that one cashier is not overwhelmed and the customers are not frustrated.

Load balancers are intelligent systems that act as traffic directors, distributing requests across multiple servers, preventing any single server from being overloaded and ensuring a smooth user experience.

One example of a load balancer frequently uses is HAproxy.

Serving Up the Content: Web Server and Application Server

One of the servers chosen by the load balancer now takes center stage. The web server receives the HTTP request, identifies the specific resource requested (the Google homepage in this case), and retrieves the necessary files. However, for dynamic content like search results, it might hand over the task to an application server. This specialized server processes complex logic and interacts with databases to generate the personalized content you see.

An example of a webserver is Nginx.

The Databases

Databases are the hidden powerhouses storing vast amounts of information. When you search for something on Google, the application server sends your query to a database, which searches for relevant results, retrieves them, and formats them for the web server. This data could be anything from website content to user profiles to search indices.

An example of a database used is MySQL database.

Show me what you got: The Browser's Final Act

Finally, the web server sends the retrieved files (HTML, CSS, JavaScript) back to your browser. The browser interprets these files, renders them into a visually appealing webpage, and displays it on your screen. And voila! You're greeted by the familiar Google homepage.

Here is a visual representation of this journey.

It's More Than What Meets the Eye

This seemingly simple act of typing a URL involves a network of technologies working in together. From DNS lookups to secure connections, load balancing, and dynamic content generation, understanding this journey provides a deeper appreciation for the complex yet seamless experience we take for granted every day. And the mind blowing part is ALL THIS HAPPEN IN A COUPLE OF SECONDS!

Did you find this explanation helpful? Let me know in the comments!

0
Subscribe to my newsletter

Read articles from Tk Codes directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Tk Codes
Tk Codes

Hey there, I'm Tracey – a passionate learner who's diving headfirst into the world of programming. As a recent enthusiast in this captivating realm, I've embarked on a thrilling journey of discovery and growth. Why do I write? Well, it's simple: I believe in the power of sharing. By putting my learning experiences into words, I not only solidify my understanding but also aim to provide a helping hand to fellow learners. Join me as I navigate the exciting seas of programming, one keystroke at a time. Let's learn out loud together!