What happens when you type google.com in your browser and press Enter

AKRAM BOUTZOUGA
6 min readMay 11, 2024

--

Ever wonder what goes on behind the scenes when you hit enter in your browser and input www.google.com The process is very cool, and a lot happens in the split second that lets you visit it!

Let’s start by investigating the infrastructure (network, servers, security) of the question.

When you put “https://www.google.com" into your browser and press Enter, you are taken on a fascinating journey through the levels of the web stack. From the initial DNS request to the final display of the Google search page, numerous components work together to provide a consistent user experience. we’ll try to go over each stage of the trip, explaining DNS resolution, TCP/IP connection, security measures like HTTPS/SSL, load balancing, and the responsibilities of web servers, application servers, and databases

DNS Request:

The journey begins with the Domain Name System (DNS) resolution. Your browser sends a DNS request to a DNS server to translate the human-readable domain name “google.com” into its corresponding IP address. This step involves a series of queries starting from the root DNS servers, then to the top-level domain (TLD) servers, and finally to authoritative DNS servers responsible for the domain “google.com”.

Now, that DNS resolution translates the domain name into its corresponding IP address, what’s next?

TCP/IP Connection:

Now, that we have the IP address in hand, your browser initiates a Transmission Control Protocol(TCP) connection with the server hosting Google’s websites. TCP ensures reliable data transmission by establishing a connection-oriented communication channel between your browser and the server. How’s that?

TCP initiates a carefully controlled handshake as soon as your browser makes a request to the server. In order to create a connection-oriented communication channel, your browser and the server exchange a series of messages during this handshake(Three-Way Handshake), which is similar to a digital hello.

TCP is a beautiful protocol because it is connection-oriented. TCP puts dependability first, as opposed to UDP (User Datagram Protocol), which puts speed and efficiency first. Through the creation of a virtual circuit between your browser and the server, TCP carefully monitors the data packet delivery process, making sure the packets arrive undamaged and in the right order.

Internet Protocol (IP) takes care of routing these packets across the Internet.

Firewall:

The system that regulates incoming and outgoing traffic to the server is called a firewall. The server’s owner can arrange it such that connections are only accepted on specific ports on the server by using a tool like UFW. This will stop sensitive data from leaving the system and stop hackers from injecting malicious material into the system. Usually, only connections on ports 22 (SSH), 80 (HTTP), and 443 (HTTPS) are permitted.

During the TCP handshake, data packets traverse through various network devices, including firewalls. Firewalls act as a barrier between your computer and potentially malicious external entities, enforcing security policies and filtering incoming and outgoing network traffic.

Based on pre-established rules that can be determined by a network administrator, firewalls analyze incoming and outgoing data packets to decide whether to allow or reject them. These rules can define a number of parameters, such as the protocol type (TCP, UDP, etc.), port numbers, and source and destination IP addresses.

Firewall rules example

HTTPS/SSL:

Security is crucial when accessing the web nowadays. Secure connection between your browser and the web server is ensured via the Hypertext Transfer Protocol Secure (HTTPS) protocol, which is secured using SSL (Secure Sockets Layer) or its successor TLS (Transport Layer Security). Sensitive information is shielded from interception and manipulation while in transit by this encryption. The client and server negotiate cryptographic parameters, trade digital certificates to confirm identities, and establish a secure channel for data transmission when they establish an HTTPS connection. By preventing hackers from reading or altering data sent back and forth between the client and server, SSL/TLS encryption protects against a range of security risks, including data interception, man-in-the-middle attacks, and identity theft.

for further details, you can check this article:

Load Balancer:

Google uses load balancers to effectively manage the billions of requests it receives every day. A load balancer is used to split traffic across several servers and effectively handle the surge of user requests. As a traffic management, load balancers divide incoming requests among a pool of servers in an even-handed manner to maximize efficiency, improve scalability, and preserve high availability.

Illustration for load balancer’s role

Web Server:

Upon receiving the HTTPS request, a web server, such as Apache, Nginx, or Microsoft IIS, processes the request, retrieves the requested web page or resources, and generates an HTTP response. Web servers host static content and execute server-side scripts to generate dynamic content.

Application Server:

For dynamic web applications, an application server executes server-side code, processes business logic, interacts with databases, and generates dynamic content to be served to the client. Popular application servers include Apache Tomcat, Microsoft IIS, Node.js, and Java EE application servers like JBoss and WildFly. Application servers provide a runtime environment for executing application code written in programming languages such as Java, Python, Ruby, or PHP. They handle tasks such as request routing, session management, transaction processing, and resource pooling to support the execution of complex business logic and the delivery of dynamic content to clients. Application servers often integrate with databases, messaging systems, and other external services to provide a comprehensive platform for building and deploying web applications.

Database:

Behind the scenes, databases store and retrieve data required to fulfill user requests. Whether it’s storing user preferences, search queries, or indexing web pages, databases play a crucial role in the functionality of web applications. Common databases include MySQL, PostgreSQL, MongoDB, and Redis. Databases provide persistent storage for application data, ensuring data integrity, reliability, and scalability. They support various data models, including relational, document-oriented, key-value, and columnar, to accommodate diverse application requirements. Databases offer features such as data indexing, querying, transaction management, and replication to optimize performance, maintain consistency, and ensure high availability. Application servers interact with databases through database drivers and query languages such as SQL or NoSQL, enabling data retrieval, manipulation, and storage operations to support the dynamic behavior of web applications.

Conclusion:

The journey from typing “https://www.google.com" to experiencing the Google search page epitomizes the marvels of the web stack. From DNS resolution to secure communication, load balancing, server-side processing, and database interactions, each component plays a crucial role in delivering a seamless user experience. Understanding this intricate interplay not only illuminates the inner workings of the internet but also underscores the importance of a robust and scalable infrastructure in today’s digital landscape.

Diagram

References:

--

--

AKRAM BOUTZOUGA
AKRAM BOUTZOUGA

Written by AKRAM BOUTZOUGA

Junior Calisthenics Engineer, Ai Enthusiast. Coding and Flexing! 💻💪

No responses yet