Most of us have used the internet at some point, browsing websites like Google. But have you ever wondered what's happening behind the scenes when you enter a URL into your browser and hit enter? It's a question that might pop up in tech interviews, and while some may know the answer, explaining it without getting too technical can be a challenge.
This article aims to answer that question by highlighting the key components of how the internet works when you enter a URL in your browser. So, let's dive right in.
DNS Resolution
When you type "google.com" into your browser and hit enter, a series of events unfolds. The first one is DNS resolution. To retrieve information from Google's servers, your computer must identify which server to communicate with. Servers are identified by IP addresses, which are sequences of numbers used to identify computers. Your computer first checks locally for the IP address associated with the domain name, and if none is found, it sends a request to the DNS (Domain Name System) server to translate the URL into a valid IP address pointing to Google's server.
TCP/IP Connection
After the browser gets the IP address of the requested domain name through DNS resolution, it then performs a TCP (Transmission Control Protocol) connection to the IP address to establish a connection with the server.
The TCP/IP protocol is the main layer that enables effective communication and transfer of data between your computer and Google server. It ensures that each bit of data transmitted or received is as it should be and when a packet of data transmitted is damaged, it resends it thereby ensuring that all data are complete and well delivered.
TCP/IP connection isn't the only way of transporting data from a server there are others such as UDP. This is used in streaming live videos or playing online video games where a loss in the data packet doesn't matter because it has to be in real time.
Firewall
Based on certain rules set on your computer, your computer firewall ensures that the data packets arriving and going out through your TCP/IP from and to Google servers are safe. This step is required to keep the computer safe.
HTTPS/SSL
HTTPS (HyperText Transfer Protocol Secure) is a web protocol for transmitting text-based documents across the web using a secure way of transmitting the documents.
When you connect to a Google server, your computer performs an SSL handshake with the Google server, which is commonly referred to as a TLS handshake (Transport Layer Security). This involves your computer agreeing with the server on how to effectively perform the encryption and decryption of the data sent or received using a private and public key system.
The handshake is responsible for several key security aspects, including encryption, authentication, and data integrity.
Load-Balancers
When your computer performs a TSL handshake and an HTTP request is sent to the server, it first arrives at the load balancers. The load balancers only have a major primary task which is to help lessen the load on the actual web servers.
Load balancers help reduce the workload on a server by making use of more web servers that serve thesame content or each having a segment of content that needs to be served.
They make use of several load-balancing algorithms that help ensure that when there are lots of hits on the web servers, they can handle the requests.
With the large number of users that Google serves per day, Google web servers must be able to respond to its users hence the need for a load balancing mechanism to eliminate or reduce the possibility of the servers experiencing downtimes.
Web Servers
The web servers are the computers that house the web content that needs to be served. these computers provide the static content that is being requested over HTTPS by the client. They may contain HTML pages, text information, or a binary file and in the case of Google, they serve the Google homepage and search page.
Any computer can run a basic lightweight web server. On UNIX-like systems servers such as Apache and Nginx are quite common. these two different web servers power more than 60% of the total web servers worldwide.
Hope I did a good job of making this not too technical 🙂. There are lots of things going on all at thesame time within a fraction of a second when you press that enter key on your keyboard after typing in a domain name in your browser.
A Quick Bonus For Curious Readers 🙂 who uses Linux
Do you know you can get the IP address of your favorite website? Try opening your Linux and type these Linux commands
ping -c 1 url_of_choice | grep -m 1 "url_of_choice"
Example:
ping -c 1 google.com | grep -m 1 "google.come"
PING google.com (216.58.223.206) 56(84) bytes of data.
In the example above, the curl command returns the IP address of google.com "216.58.223.206".
That's all for now. See you later! If you learned something, please leave a like or comment.
Top comments (2)
In Linux, you can get the IP address(es) of a website using the
host
command, eghost google.com
. I believe the equivalent for Windows isnslookup
. The difference against theping
command is you will get all IP address(es) for a given domain, not just a single one.Yes. Thanks a lot for adding such detail. 🙂