What happens when you type google.com in your browser and press Enter?
You must have wondered what really happens when you type "www.google.com" into your web browser, haven't you? That curiosity about the seemingly magical display that appears in milliseconds every time you enter "www.google.com" into your browser, am I right?
This article will unveil the mysteries behind these operations.
As a prelude, starting from the moment you:
The following outline will serve as a guide to explaining all the operations that have occurred behind the scenes:
But wait, there are so many technical terms here, right? What about the non-technical folks?
Alright, before we dive deeper, let’s decode some basic terms and jargon that will be used to explain the majority of points here, ensuring that everyone can follow along smoothly.
Communication:
Just as we can define communication as the process of exchanging information between people through a common system of symbols, signs, or behaviors, etc., this same scenario applies to computer systems.
Computers also communicate with each other to perform the diverse instructions given to them by their users.
For most communications, especially those that occur over the web and internet, the process and forms of communication between computers happen among two main parties or entities classified as CLIENTS AND SERVERS.
Taking a cue from the definition above:?
Hmm, getting interesting right? Now let’s look out some of the key terms mentioned above:
IP Addresses are typically expressed as a set of four numbers separated by periods, e.g: 192.158.1.38 (this type is the version 4 IP).
Each number in the set can range from 0 to 255. However, there are two types of IP Address Versions: Version 4 (IPV4) and version 6 (IPV6), for this article, we’d be focusing on the IPV4.
Another key point is that IP Addresses are unique to every computer connected over the internet, this means no two computers can have the same IP address.
So, connecting all dots, CLIENT(s) (A particular Computer with its own unique IP Address) REQUESTS for services or resources from a SERVER(s) (Another computer with their own unique IP address) over/through the INTERNET.
Still you may be wondering how does this relate with all that happens when I type: www.google.com on my browser and hit enter? Don’t be in a rush, all will be crystal clear just in a moment.
Now that we have done a quick crash course on how communication works between computers over the internet. Let’s quickly rollback to our outlines above and as well as dissect what happens when we type www.google.com? in our browser and hit the enter key.
Before we begin dissecting each points above, let’s quickly have a sneak peak at the image below, this would help articulate our points and as well create a clearer picture and understanding on the following points to explain:
1. DNS REQUEST - DNS stands for - Domain Name System, it is a system/technology that translates human readable domain names (for example, www.amazon.com) to machine readable IP addresses (for example, 192.0.2.44).
Since computers communicate through IP, each server has a unique IP, and so if we are to request a data or resource from a server, we cannot always cram the IP address, therefore through DNS, the IP addresses are translated into human readable form called domain names, example like: wikipedia.com, google.com, bing.com etc. This way it is easier to remember and use.
What is a DNS REQUEST? A DNS request, also known as a DNS query, is a request for information from a Domain Name System (DNS) server. For example, when you enter a domain name into your browser, your browser makes a DNS query to find the IP address for that domain name.
What does this mean? What is this all about? This implies that the immediate minute we typed the Google URL (uniform resource location): www.google.com,? into the browser, a DNS REQUEST happened within those milliseconds.
That is to say, there is an IP Address associated with the Google URL and this request (to get the IP address) was made and fetched to the browser.
The diagram below (image credit: @AWS) summarize all that happened during the DNS request and resolution when you typed www.google.com in your browser:
2. TCP/IP: TCP stands for Transmission Control Protocol, and IP stands for Internet Protocol. Before delving into the function of this protocol, let’s revisit an essential point in our definition of communication – the exchange of information.
As we've already introduced the concept of IP addresses and discussed how DNS requests help fetch the IP address associated with a particular domain name/URL, it's crucial to understand that for communication between IPs (or computers) to be clear and correct, they must adhere to a specific standard and control, which is where TCP (Transmission Control Protocol) comes in.
Transmission Control Protocol (TCP) is a communications standard that enables computing devices and application programs to exchange messages over a network. TCP is a part of the Transmission Control Protocol/Internet Protocol (TCP/IP) model, which is the default method for communicating data on the internet.
领英推荐
Therefore, when you type "www.google.com" into your browser, a DNS request is made to fetch the IP address associated with the domain name. Once the IP address is known, your browser establishes a connection with the server using the Transmission Control Protocol (TCP) over the Internet Protocol (IP). This connection process is known as a "handshake."
3. FIREWALL: Now that we’ve known the IP address associated with this domain name or web address (google.com), the TCP/IP connection/handshake has been established. The next soldier in line is the Firewall.
Picture the firewall like checkpoints with Police officers who checkmate what is going out and coming into the system. A firewall is a network security device that protects a computer or network from unnecessary or malicious network traffic.
Firewalls monitor incoming and outgoing network traffic and decide whether to allow or block specific traffic based on a defined set of security rules. They sit at the junction point or gateway between two networks, usually a private network and a public network such as the Internet.
For example, office networks often use a firewall to protect their network from online threats. Firewalls can be hardware, software, software-as-a-service (SaaS), public cloud, or private cloud (virtual).
They can produce logs, including traffic logs, threat prevention logs, audit logs, and session logs. So this implies that as much as the communication or request is being established (between clients and servers), security checks and concerns are vital too.
4. HTTPS/SSL: Once the Firewalls have finished checking the request (what is going out), the browser sends a request to fetch or receive the webpage, data, or resource being requested by using an encryption protocol (e.g., Secure Sockets Layer (SSL) or Transport Layer Security (TLS)) to encrypt (protect and secure) the data shared between your computer and the server. This encryption is what makes the connection secure.
This feature is very important, not only for www.google.com but for everyone who accesses different websites, especially those that involve the collection of highly sensitive data like credit cards and other personal information.
Websites without HTTPS encryption are prone to cyber attacks and penetration. Do not drop sensitive data on these websites. How do you know? See these two images below:
HTTPS (Hypertext Transfer Protocol Secure) is an extension of HTTP (Hypertext Transfer Protocol) that encrypts the data being transmitted between a user's browser and a website, ensuring that sensitive information such as login credentials, credit card details, and personal information remain secure. SSL (Secure Sockets Layer) is the technology that enables this encryption. Yet another security concern.
5. LOAD BALANCER: Have you ever wondered how many billions of people are making use of Google? Imagine thousands to millions of requests that are being sent to Google's servers, requesting for data.
With such high volume, it is evident that aside from the fact that Google would be using high-performing Machines/PCs as their servers, some forms of balancing among them are surely implemented in order to maintain reliability and continuous running of each server.
A load balancer is a device or software application that distributes incoming network traffic across multiple servers. This helps to ensure that no single server is overwhelmed with requests, leading to improved performance, scalability, and reliability of the system.
Load balancers are actually configured using different algorithms such as round-robin, least connections, or IP hashing. They can also perform additional functions such as SSL termination, caching, and application layer routing.
So with a load balancer, those millions to billions of queries are handled gracefully.
6. WEB SERVER: Now that we’ve come this far, the moment you typed "www.google.com" into your web browser, if all the steps above (from 1 - 5) execute successfully, then the next line of action is the web server.
As soon as the load balancer receives the request from the user (all the way from step 1 to 5), the web server is the actual entity that processes the request and responds as requested.
The server processes your request (to access "www.google.com") and sends back a response, typically HTML, CSS, and JavaScript files that make up the Google homepage. The HTML files instruct the browser on how to render the content, the CSS files style the content, and the JavaScript files add interactivity.
Therefore, what is a web server? A web server is a computer program that runs on a physical (hardware) or virtual server and is responsible for serving web content to clients over the internet. It processes incoming requests from clients (such as web browsers) and responds with the appropriate content, which may include HTML pages, images, scripts, or other resources.
The mode by which it processes these requests is by using HTTP (Hypertext Transfer Protocol) and other protocols to respond to client requests made over the World Wide Web.
Some popular web server software includes Apache, Nginx, Microsoft Internet Information Services (IIS), and LiteSpeed. These servers can be configured to serve static content, dynamic content generated by server-side scripts (such as PHP or Python), or a combination of both.
6. APPLICATION SERVER: In a nutshell, an application server extends a web server's capabilities by supporting application logic, dynamic content generation, and integration with various resources. It acts as an intermediary between the web server and the application, handling tasks such as managing user sessions, security, and database connections.
A QUICK SCENARIO
Let’s say you’ve opened the website www.google.com, and you are on the page about to search for something, like “How to cook fried rice.”The moment you hit the enter key to generate search results, behind the scenes, the application server is invoked, running the logic provided by Google developers to give you the output.
This is called dynamic content generation (content that is generated at the go as instructed). The generation of dynamic content, such as search results and populating websites or blogs that match data in Google’s database, is all carried out by the application server.
7. DATABASE: Every single piece of data or information displayed for every search we make on www.google.com, every output or result displayed, is stored in a database.
A database is a structured collection of data that is stored and accessed electronically. It is used to store, manage, and retrieve information for websites and web applications.
Most dynamic requests (handled by the application server) are retrieved from the database and then sent back (as a response) to the user. So, when you search for anything on the Google search engine, the database is being accessed, and results are being displayed accordingly.
And that’s it! ??????
Now you know what happens when you type "www.google.com" into your web browser!
Thank you for reading.
Have some thoughts? drop them in the comment section!
Cheers!
Junior Software Engineer
12 个月It is a beautiful summary that a non-technical mind can also understand. Thank you