Understanding How the Web Works

Understanding How the Web Works

Introduction

Understanding the web is crucial for anyone venturing into web development. These fundamentals serve as foundational knowledge for excelling in this field.

Have you ever wondered what happens when you type a website uniform resource locator (URL) on your browser? What goes on behind the scenes? How do you see the content you requested? What is the infrastructure behind it?

This article will provide insight into how the web works and the relationship between the infrastructures that handle the activities behind the scenes.

Terms associated with the Web

The Web works on a client-server model. Before diving deeper, let's define some basic terms associated with the Web that you should understand.

  1. Network: A network consists of interconnected computers or devices that share resources and communicate with each other. These devices can connect through various means, such as wired(ethernet cables) or wireless(wi-fi) technologies.

  2. Internet: The Internet is a global network of interconnected computer networks(phones, servers, etc.) that enables the exchange of data and communication through standardized protocols between devices and users worldwide.

  3. Client: In the web context, a client is a web browser that makes a request to a server. Examples of web browsers are Chrome, Safari, Firefox, etc. In other words, a client can be referred to as a person using the service(web browser) or hardware like a phone or computer.

  4. Server: A server is a computer or system that provides resources, data, services, or programs to other computers, known as clients, over a network. In the web context, a server stores web pages, sites, or applications. Servers can be categorized into software and hardware. More focus will be on software servers.

  5. Internet Service Provider(ISP): For example, Glo and MTN provide users with internet services. Without your ISP, you can't access a global network.

The Main components

The web is a combination of different infrastructures that serve various purposes. The main components are the infrastructure that works together to facilitate communication on the web. These include web servers, domain names, domain name systems (DNS), communication protocols, load balancing, hosting, and databases.

Web servers: A web server is software that serves and delivers web content to clients (web browsers) over the Internet. It does this by listening to requests from clients' devices using the HTTP protocol.

Software web servers include Nginx, Microsoft IIS, Apache, and more. Web browsers communicate with web servers through a standardised protocol.

Domain name: A domain name is a unique address or combination of text used to access web pages, making it easier for users to recall website names and addresses without needing to remember the IP address. For example, google.com and facebook.com are domain names. An IP address is represented in a format like 192.0.2.1, which consists of four numerical figures separated by periods.

Domain name registration services are provided by domain registrars such as Cloudflare, Namecheap, GoDaddy, and more. These registrars act as intermediaries between the registrant (the developer or organization buying the domain) and the registry (the organization managing the top-level domain).

For instance, registries like VeriSign are responsible for managing top-level domains like .com and .net.

💡
All domains are managed and owned by organizations known as registries, such as VeriSign. When you register a domain, you pay for the right to use it for a specified period. After this period, you renew your registration to continue using the domain.

DNS: A domain name system is a contact list of the internet that maps domain IP addresses. It is a distributed naming system that translates human-readable domain names, such as facebook.com, into numerical IP addresses, like 192.0.2.1, for browsers to load resources.

There are four types of DNS servers responsible for loading a webpage: DNS resolver, Root name server, TLD server, and Authoritative server. Each of these servers plays a specific role in the DNS process.

How DNS works

Here is what happens when a user types a domain name(facebook.com) in their browser.

  • The query travels through the internet and reaches your internet service provider (ISP) using a DNS Resolver.

  • The DNS Resolver first checks with the Root name server. The server points the resolver to the right top-level domain (TLD) server, which manages the ".com" extension because it doesn't know the exact address of Facebook

  • Then, the DNS resolver goes to the Authoritative server, which has all the IP addresses, and returns the IP address for facebook.com. This address is then sent back through the Internet to your browser.

  • Your browser uses the IP address to connect directly with the Facebook server. Facebook then sends the actual webpage back to your browser.

💡
Browsers and ISPs usually cache the DNS results. In this case, when the same user searches for the same domain, the browser has cached the DNS record for that address. 

Web Hosting: This is a service that allows individuals and organizations to publish their websites on the Internet. It requires renting digital space on a powerful computer (called a server) to store your website's files. It allows your website to be accessible to anyone. For example, you can host your website on a virtual private server like AWS Elastic Compute Cloud(EC2).

Web hosting allows you to store website files, manage website content, and make your website accessible to users. Various types of web hosting service exist , serving multiple needs.

Load Balancing: Using the common traffic jam as an analogy, a traffic jam happens when vehicles try to reach the same destination simultaneously using a single road.

To reduce the jam, cities provide multiple lanes on busy streets.These additional lanes help distribute the number of vehicles on the road to avoid congestion, allowing vehicles to reach the same destination faster and smoother. Load balancing serves the same purpose as the additional lanes.

Millions of people access one website almost at the same time, leading to congestion and increased workload on the server powering the website. Load balancing helps distribute traffic to different servers to reduce the workload of servers and enhance efficiency.

Load balancing is handled by a tool called a load balancer. The load balancer determines which server is best suited to handle the request based on various algorithms(static and dynamic).

With load balancing, the extra traffic is split into multiple servers. This prevents your website from crashing. Load balancing offers the following benefits:

  • Better traffic Flow

  • Improved response times

  • Reduced downtime during network outages and server maintenance

  • An additional layer of security

  • Early failure detection

Communication Protocols: They are rules and standards that govern how data is transmitted on the Internet over networks. Two protocols, Transmission Control Protocol (TCP) and IP(Internet Protocol), establish the foundation of communication on the Internet.

  • TCP is a connection-oriented protocol that ensures reliable and ordered delivery of data packets. It includes features such as error detection, flow control, and congestion control, making it crucial for applications where data integrity is vital, such as web browsing and email.

  • IP is also a connection-oriented protocol used to connect devices to the internet. An IP address contains a unique numerical label assigned to each device connected to a network allowing it to communicate with other devices. There are two main types of IP addresses: IPv4 and IPv6. IP addresses are managed by the Internet-assigned Numbers Authority(IANA)

  • HTTP stands for hypertext transfer protocol. It defines a language for clients and servers to speak with each other and is used for transmitting web pages and resources over the Internet.

  • HTTPS stands for hypertext transfer protocol secure. It is the secure version of HTTP, which encrypts data exchanged between the web server and the client’s browser, ensuring confidentiality and integrity during online transactions.

Database: A database is an organized collection of information stored in a computer system. Its purpose is to facilitate easy access, modification, protection, and analysis of data. Databases store data in tables and can handle various data types, including images, videos, and text. They are crucial for extracting business intelligence to aid decision-making.

Using a database on your website depends on the website's requirements. For example, a learning management system will utilize a database to store user information and other necessary data. Various types of databases are available, each suited to different project needs. For more information, see link.

What happens when a user types a URL?

What happens when a user types the URL www.amazon.com/home. Assuming the browser has already cached the IP address of the website as explained in the DNS process:

  1. Your browser establishes a connection to the server using TCP. This ensures reliable communication between the browser and the server.

  2. The browser sends an HTTP request to the server at the obtained IP address. The request includes the specific resources needed, such as the site's homepage.

  3. The Amazon server processes the request and prepares the content for the homepage.

  4. The server sends an HTTP response that includes the homepage's HTML content, along with the CSS and JS files needed to render the page properly.

What Next?

Congratulations!!. You have taken the first steps toward understanding the fundamental concepts underlying the web and its infrastructure. This article has established foundational knowledge.

As you continue your web development, consider exploring more on these topics, experiment with projects, and seek additional resources.

Further Reference

What is a Database- Oracle

What is TCP/IP-Cloudfare

How Load Balancing Work- Cloudfare

Load balancing Algorithm- Amazon Web Services

Webservers-Techtarget

How DNS works-Cloudfare

What is a Domain name Registrar?-Cloudfare

Connect with me on LinkedIn and Twitter