Learning Objectives

By the end of this chapter, you will be able to:

  • Define client-server architecture.
  • Describe the role of a client.
  • Describe the role of a server.
  • Explain the request-response model.
  • Compare client-server and peer-to-peer networks.
  • Explain two-tier and three-tier architectures.

The Client-Server Architecture

Client-server architecture is the fundamental design model of the internet. It is a computing model in which a server hosts, delivers, and manages most of the resources and services to be consumed by one or more clients.

The Client

The client is a computer or program that requests services or resources from a server. The client is the device that the end-user interacts with.

  • Examples: Your web browser is a client. When you type in a web address, your browser (the client) sends a request to a web server.

The Server

The server is a powerful computer or program that is dedicated to providing services to clients. Servers wait for requests from clients and then respond to them.

  • Examples: A web server stores website files and serves them to web browsers. A mail server stores and delivers email.

Types of servers

Server type What it provides Example
Web server Web pages and files Apache, Nginx
Mail server Sending and storing email Gmail’s servers
File server Shared files and folders on a network Office shared drive
Database server Storing and querying data MySQL, Oracle, SQL Server
Application server Business logic for apps Core banking application
DNS server Translating domain names to IP addresses ISP or Google DNS
Print server Managing shared printers Office printer queue

The Request-Response Model

Client-server architecture works on a request-response model:

  1. The client sends a request to the server (e.g., “get me the homepage for google.com”).
  2. The server receives the request, processes it, and sends a response back to the client (e.g., the HTML code for the Google homepage).
  3. The client receives the response and displays it to the user.
sequenceDiagram
  participant C as Client (browser)
  participant S as Web server
  C->>S: Request (GET homepage)
  S-->>C: Response (HTML page)
  C->>C: Display page to user

Two-Tier and Three-Tier Architecture

  • Two-tier: the client talks directly to the database server. Simple, but harder to secure and scale. Example: a desktop accounting program connected to a shared database in the office.
  • Three-tier: a presentation tier (browser or app), an application tier (business logic on an application server), and a data tier (database). Most web and banking systems use this model because each layer can be secured and scaled separately.

Client-Server vs Peer-to-Peer (P2P)

Aspect Client-server Peer-to-peer
Control Centralized on the server Each computer is equal (both client and server)
Security Easier to manage centrally Harder; each peer manages its own security
Backup Done centrally on the server Each computer must be backed up
Cost Servers and administrators are costly Cheap; no dedicated server
Scalability Scales well with stronger servers Suited to small networks
Example Websites, online banking, email Sharing files between home PCs, BitTorrent

Advantages and Disadvantages

Advantages

  • Centralized data, security, and backup.
  • Easy to update services in one place.
  • Many clients can share powerful server resources.

Disadvantages

  • The server is a single point of failure if not backed up or duplicated.
  • Too many requests can overload the server and slow responses.
  • Servers and skilled administrators are costly.

Business Scenario

When a customer in Biratnagar opens a bank’s mobile app to check her balance, the app is the client. It sends a request over the internet to the bank’s application server, which checks her login and asks the database server for her balance. The response travels back and appears on her phone in a second. Thousands of customers do the same at once, which is why banks invest in powerful, backed-up servers in data centers.

Summary

The client-server architecture is the foundation of how the internet works. In this model, a client (like your web browser) sends a request to a server (like a web server). The server then processes the request and sends a response back to the client. Servers come in many types, such as web, mail, file, and database servers, and large systems use a three-tier design. Compared with peer-to-peer networks, client-server offers central control and security at a higher cost. This simple but powerful request-response model enables all of the services we use on the internet today.

Key Takeaways

  • Client-server is the fundamental architecture of the internet.
  • The client requests services; the server provides them.
  • The model works on a request-response cycle.
  • Three-tier architecture separates presentation, application logic, and data.
  • Peer-to-peer networks have no dedicated server; every computer is equal.

Discussion Questions

  1. When you use a mobile app like Instagram, which part is the client and which part is the server?
  2. What are some of the advantages of the client-server model?
  3. Can a computer be both a client and a server? Explain.

Exam-Style Questions

Short answer

  1. Define client and server with one example each.
  2. What is the request-response model?
  3. List any four types of servers.

Long answer

  1. Explain client-server architecture with a diagram. Compare it with peer-to-peer networks.
  2. Describe three-tier architecture using an example of online banking.