What_happens_when_your_type_google_com_in_your_browser_and_press_enter

What_happens_when_your_type_google_com_in_your_browser_and_press_enter

EXPLAINING WHAT HAPPENS WHEN YOU TYPE www.google.com IN YOUR BROWSER AND PRESS ENTER

?

Have you ever wondered what happens behind the scenes when you type "https://www.google.com" in your browser and hit Enter? The seemingly simple act of accessing a website involves a series of intricate processes working together seamlessly. Now, let us take you on a fascinating journey through the various stages a web request undergoes, shedding light on the roles played by DNS, TCP/IP, firewalls, HTTPS/SSL, load-balancers, web servers, application servers, and databases.

?

Background concept:

https://www.google.com?is called Uniform Resource Locator (URL) and can be broken down into 4 parts??

Protocol: "https://" indicates the protocol used for communication between your browser and the web server. "https" stands for Hypertext Transfer Protocol Secure, which ensures a secure and encrypted connection for data transmission. We also have https:// which is not secured.

?Subdomain: "www" is a subdomain that is commonly used to identify the specific server or resource within a domain. It is not mandatory and can be omitted in some cases. Other possible subdomains are FTP, mail, blog, shop, support, news,

Domain: "google.com" is the main domain name of the website. It uniquely identifies the website and is registered with a domain registrar. In this example, "google" is a placeholder and would typically be replaced with an actual domain name.

Ideally to locate the server “www.google.com”, the Transport layer of the OSI model just needs the ip address (which is not human-friendly or readable) to be able to locate the website (network layer of the OSI model). Since the IP address is not easy to remember, the Domain Name System(DNS) plays the role of storing the domain names against their IP addresses. Hence DNS server saves the domain name google.com and all is subdomain names to link it with the IP address.?

So when When you enter "https://www.google.com" in your browser:

1.?DNS Request:?The first step is to resolve the domain name into an IP address. The browser sends a DNS (Domain Name System) request to a DNS server, which looks up the IP address associated with "www.google.com." This translation enables your browser to locate the server hosting the Google website.?

2.?TCP/IP:?With the IP address obtained from the DNS server, the browser initiates a TCP/IP (Transmission Control Protocol/Internet Protocol) connection. TCP/IP is a set of protocols governing the transmission of data over the internet?on the OSI model. This connection establishes a reliable channel for data exchange between your browser and the web server.?On the OSI model, this sits on the transport layer.

3.?Firewall:?As the TCP/IP connection is established, the request passes through various network devices, including firewalls. Firewalls act as a security barrier, inspecting incoming and outgoing traffic to enforce security policies. They verify if the request meets the defined criteria and decide whether to allow or block it.?You can define rules to allow specific services or protocols or ports ( eg

sudo ufw [default] [alow| deny] [https | http] [incoming | outgoing] [ip address | ip address range] [port]

sudo=super user do,?allows you to run the command as admin/super user

ufw=uncomplicated firewall

some of the bash commands used to set thee rule are

sudo ufw allow http?# allows incoming http(port 80) connection on firewall

sudo ufw deny https # allows incoming https(port 443) through firewall

sudo ufw allow 8080 # allows incoming port 8080 connection on firewall

sudo ufw allow ssh # allows ssh port 22 to pass through firewall

sudo ufw allow 123/udp # allows?UDP traffic on port 123 to connect

sudo ufw allow from 192.168.0.0/24?# allows specified IP addr range (from the subnet 192.168.0.0/24).

sudo ufw default deny incoming # Denying all incoming connections.

sudo ufw default allow outgoing # Allowing outgoing connections.


sudo ufw status # will display all the rules set

?4.?HTTPS/SSL:?In the modern web, security is paramount. HTTPS (Hypertext Transfer Protocol Secure) is employed to encrypt the data exchanged between your browser and the server. It ensures confidentiality, integrity, and authenticity. As part of the HTTPS handshake, your browser and the web server establish a secure SSL (Secure Sockets Layer) or TLS (Transport Layer Security) connection, which encrypts the data transmitted during the session.

5.?Load-Balancer:?google is a big company with high traffic. You can imagine the high traffic it generates every second. Such a company will have many servers configured to ease the traffic.?In July 2016, it was reported that Google has 2.5 million servers, each with its own IP address. It is the work of load-balancers?to?optimize resource utilization and improve scalability and availability. We have hardware load balancers and software load balancers which are regarded as servers with their own IP address.

Ideally, you can configure your domain name to point to the load balancer IP address. So that,?when a user sends their request (https://www.google.com) the IP address of the load balancer is fetched from DNS, and the load-balancer uses the configured algorithm to distribute the load across these 2.5 million servers which are all google.com servers. Common algorithm configurations of load balancers are layer 4 load balancing, layer 7 load balancing, active-passive load balancing, active-active load balancing, round-robin load balancing, least connections load balancing, and weighted load balancing. These will be explained in another write-up.

The choice of configuration depends on factors such as the network architecture, application requirements, scalability needs, and desired levels of redundancy and performance.

Each of these >2.5Million servers of google, for instance, will be configured to have similar services(web server, application server, and database).

HAProxy, which stands for High Availability Proxy, is an open-source software solution that provides high availability, load balancing, and proxying for TCP and HTTP-based applications. It is commonly used as a reverse proxy and load balancer to distribute incoming network traffic across multiple servers to ensure high availability and scalability.

?

6.?Web Server:?The web server is responsible for processing the request and generating an appropriate response. In the case of Google, the web server receives the request for the specific page or resource requested, such as the search page. It retrieves the relevant files and data, including HTML, CSS, JavaScript, and media files, and constructs a response to be sent back to the browser. Nginx (pronounced "engine-x") is a popular open-source web server and reverse proxy server. It is known for its high performance, stability, and scalability, making it a widely used solution for serving web content and handling HTTP requests.

?

7.?Application Server:?An application server may be involved in more complex web applications. The application server executes business logic and interacts with databases and other backend systems. In Google's case, it may handle additional functionality like search algorithms, user authentication, personalized content, and much more.

Nginx: Although primarily known as a high-performance web server, Nginx can also function as an application server. It supports various programming languages and frameworks and is often used as a reverse proxy or load balancer in front of application servers to improve performance and scalability.

Others include Apache Tomcat, Microsoft Internet Information Services (IIS), IBM WebSphere, JBoss/WildFly, Oracle WebLogic Server, and GlassFish.?

8.?Database:?For dynamic websites or applications, databases store and retrieve data needed to generate the requested page. The application server communicates with the database server to fetch or update information. In Google's case, databases hold a vast amount of indexed web pages and help provide search results tailored to the user's query.

There are several popular database server options available. Here are some examples:MySQL, PostgreSQL, Oracle Database, Microsoft SQL Server, MongoDB, Redis, SQLite, Cassandra.

Conclusion:

As we have seen the simple web request?from typing "https://www.google.com" and?pressing Enter?goes through a complex process involving multiple interconnected components?all happens within seconds. DNS resolves the domain, TCP/IP establishes a connection, firewalls protect against threats, HTTPS/SSL encrypts the data, load-balancers distribute the traffic, web servers process the requests, application servers handle business logic, and databases store and retrieve information. Understanding this process gives us a deeper appreciation for the incredible technology that powers our everyday web browsing experiences.

?

We will explain the different load balancer algorithms in another blog

?

?

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

社区洞察

其他会员也浏览了