The internet is so closely woven into our lives today that I hate to think of a world without one. Yet, we know so little of how the internet operates. We also have no clue of how the web works, don’t we?
💡The "Internet" and the "Web" are not the same!
The internet more so refers to the mind-boggling infrastructure or hardware that helps millions of computers all over the world connect, network, and talk to each other.
An overview of the Internet
Let me briefly explain what the internet is.
- The local network of devices in your home is connected to the hardware (network of computers) outside with the help of the modem and the wireless router.
- Your modem is connected to your Internet Service Provider (ISP) through underground copper cables that eventually connect to fiber optic cables.
- The ISP may either have single or multiple regional and national networks that connect and supply to different cities in the country. These networks apart from connecting within a country also connect to other countries.
- The infrastructure is also an inter-continental connection of networks made possible by underwater fiber optic cables provided by many different cable companies across the world.
This infrastructure that makes up the internet is what makes sharing information possible. Staggering isn’t it?
Cutting to the chase - The World Wide Web
The web that is built on top of the internet allows users to access information. All of it boils down to a “Client and Server” interaction.
A client is your desktop, laptop, or mobile device that you use to connect to the web. Also, the web browser (Chrome, Firefox, Brave, etc) in your device that you make use of to access the web, could be considered a client.
The client is responsible for making “requests” for resources on a server. This is usually accomplished by typing in a URL or clicking on links within your browser. A resource could be any file like a web/HTML page, an image, a video, or any file type.
A server is a computer that hosts the resources (web pages, videos, images, etc) of a website. It “responds” to “requests” made by the client and delivers the resource to the client.
Take this example URL,
Here, google.com is the “domain name” of the website. A domain name has a few parts to it, each separated by a period.
- The “google” portion of “google.com” refers to the name of the website. It is called the Secondary Level Domain(SLD)
- The “.com” portion of “google.com” is called the Top Level Domain (TLD) and it gives you an idea of what sort of an entity the organization behind the website is. Entities could be commercial (.com), government organizations (.gov), educational institutions (.edu) etc. There are also Country code TLDs - “.in” for India, “.fr” for France, “.hk” for Hong Kong and so on.
Domain Name System
All devices, be it the client or the server is tied to an IP (Internet Protocol) address. The IP address serves to be an identifier for a device or a computer, so it can identify and talk with another device on the internet. An IP address is a set of four numbers each separated by a period. An example would be 184.108.40.206. Each number in the set can have a maximum value of “255”. That means an IP address could range from 0.0.0.0 to 255.255.255.255. This version of IP addressing is called “IPv4”. It allows for a combination of 4 billion IP addresses.
Every website or application (server hosting the website) we visit would have an IP address tied to it. Imagine having to type out an IP address on the address bar of your browser for every website rather than having to type its name, like facebook.com or google.com. It would be humanly impossible to remember IP addresses for all websites.
This is where the Domain Name System or DNS comes as such a boon. The DNS allows for assigning human readable “names” to an IP address. This makes our lives easy. So what actually happens is that, once a request for a website is fired on your browser, the Domain Name System works behind the scenes to resolve the name of the website to its corresponding IP address.
Connecting to the website (name resolution by DNS)
- Let’s say, you either type the name of the website or click the link https://www.google.com on your browser .
- Your browser looks into its cache to check if the IP address for the typed domain name exists. If it doesn’t it asks the DNS resolver, a software in your operating system, for the same. If the answer is no again, your browser communicates with the “local DNS server”, this being commonly your Internet Service Provider (ISP), for requesting the address for www.google.com.
- If the local DNS server does not have the IP address for the domain name in its cache, it requests a server called the “root name server” for the same. The root name server stores information of all “Top Level Domain (TLD) name servers”. Since the TLD in your case is “.com”, it returns the IP address of the “.com” TLD name server to your local DNS server.
- The local DNS server requests the “.com” TLD name server for the address of the domain name and the TLD name server responds with the address for the “name server” of the domain requested.
- After reaching out to the name server of the domain requested, it responds with the IP address of the “web server” of the domain www.google.com.
- The local DNS server finally responds to your browser with the IP address of the domain requested.
- Once the IP address of www.google.com is resolved, your browser establishes a socket connection with the server of www.google.com.
- Your browser shoots a request to the corresponding IP address (www.google.com).
The google server receives the request and responds with the web page.
A note on types of servers
If you have come this far, you may want to believe that there is a single web server that does all the heavy lifting behind the scenes. This may be true for a small website. However, in the real world, popular websites get millions of requests per second and would find it difficult to handle several million requests per second. Servers apart from handling requests, also have to run web application software and handle tons of data.
Servers are split into different types based on functionality in order to making handling of requests easier. Some of these types may include,
- Web server - This server machine only handles the incoming HTTP requests. Eg- Apache.
- Application server - An application server is responsible for running the software of the web application written with back-end programming languages like PHP, Ruby on Rails or Python.
- Database server - This runs the Database Management system such as SQL, MySQL or MongoDB. This is where the data resides.
The ease of handling requests on scale is further enhanced by server farms. The idea here is to replicate many servers based on functionality and evenly distribute incoming requests with the help of another computer called a “load balancer”. This prevents any server from being overloaded.