Learning Objectives

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

  • Understand the concept of Database System Architecture.
  • Differentiate between 1-tier, 2-tier, and 3-tier database architectures.
  • Explain the advantages of a 3-tier architecture.
  • Distinguish centralized and distributed database systems.
  • Choose a suitable architecture for a given business situation.

What is Database Architecture?

Database architecture describes the design, structure, and operation of a Database Management System (DBMS). It defines how users, software applications, and the database itself interact with one another. The most common way to classify database architectures is by the number of “tiers” or layers between the user and the database.

1-Tier Architecture

In a 1-tier architecture, the database and the application both exist on the same machine. The user interacts directly with the database.

  • Use Case: Local application development, single-user desktop applications.
  • Pros: Extremely fast and simple to set up.
  • Cons: Not scalable, poor security, and no network access.

Example: a shopkeeper keeps stock records in Microsoft Access on a single laptop.

2-Tier Architecture (Client-Server)

In a 2-tier architecture, the user interface (client) runs on the user’s machine, while the database runs on a separate server. The client application connects directly to the database server.

  • Use Case: Internal company networks (LAN), simple desktop applications connecting to a central database.
  • Pros: Faster development, direct communication.
  • Cons: Hard to scale to thousands of users, less secure (direct database access), and heavy burden on the client application.

Example: five billing counters in a department store run a desktop billing program that connects over the office LAN to one database server in the back office.

3-Tier Architecture

In a 3-tier architecture, an intermediate layer—the application server—is placed between the client and the database server.

  1. Presentation Tier (Client): The user interface (e.g., a web browser).
  2. Application Tier (Business Logic): The server-side code (e.g., PHP, Node.js) that processes rules and data requests.
  3. Database Tier: The DBMS (e.g., MySQL) where the data is stored.
  • Use Case: Almost all modern web applications.
  • Pros: High security (clients never touch the database), highly scalable, and easy to maintain.
  • Cons: More complex to design and implement.

Example: when you order on an e-commerce site such as Daraz, your browser or app (presentation tier) sends the order to application servers (business logic: check stock, calculate price and delivery), which then read and update the database (database tier).

flowchart TB
  subgraph T1[1-Tier]
    U1[User] --> A1[App and DB on Same Machine]
  end
  subgraph T2[2-Tier Client-Server]
    C2[Client UI] --> DB2[(Database Server)]
  end
  subgraph T3[3-Tier]
    C3[Presentation Tier] --> APP[Application Tier]
    APP --> DB3[(Database Tier)]
  end

Figure 1: One-Tier, Two-Tier, and Three-Tier Architectures

Comparison

Aspect 1-Tier 2-Tier 3-Tier
Layers App and DB together Client + database server Client + application server + database
Users Single user Tens of users on a LAN Thousands to millions over the internet
Security Low Medium (clients reach DB) High (DB hidden behind app server)
Scalability Very low Limited High
Complexity Very simple Moderate Most complex
Example Access on one laptop LAN billing system E-commerce, mobile banking

Centralized vs Distributed Databases

Architectures can also be classified by where the data is located.

  • Centralized database — all data is stored at one site (one server or data center). Users at other locations access it over the network.
    • Pros: easier to manage, secure, and keep consistent.
    • Cons: a single point of failure; remote users may face slower access.
  • Distributed database — data is stored across several sites connected by a network, but appears to users as one database.
    • Pros: faster local access, continues working if one site fails, scales well.
    • Cons: more complex to manage and keep consistent; higher cost.

Example: a national bank may run a central core banking database in its data center with a backup disaster recovery site in another city; global companies often distribute data across regions so each region reads from a nearby copy.

Choosing an Architecture

Situation Suitable choice
A freelancer tracking clients on one computer 1-tier
A small office with a few staff on one LAN 2-tier
An online store or mobile app used by the public 3-tier
A business with branches in many cities needing high availability Centralized with DR site, or distributed

Summary

The evolution from 1-tier to 3-tier architectures reflects the growing need for security, scalability, and distributed access in modern business computing. 1-tier suits single users, 2-tier suits small networks, and 3-tier powers modern web and mobile applications. Databases can also be centralized at one site or distributed across many. Understanding these layers is crucial for designing robust enterprise applications.

Key Takeaways

  • Database architecture describes how users, applications, and the database interact.
  • 1-tier: app and database on one machine; 2-tier: client talks directly to the database server; 3-tier: an application server sits in between.
  • 3-tier is the standard for web applications because it is secure and scalable.
  • Centralized databases are simpler; distributed databases are more resilient and scalable but complex.

Review Questions

  1. What is database system architecture?
  2. Differentiate between 2-tier and 3-tier architecture with examples.
  3. Why is 3-tier architecture preferred for e-commerce and mobile banking?
  4. Compare centralized and distributed databases.