Difference Between Two-Tier And Three-Tier Database Architecture

What Is Two-Tier Database Architecture?

Two-tier architecture is a software architecture in which a presentation layer (application interface) runs on a client (PC, Mobile, Tablet etc) and a data layer or data structure gets stored on a server.  Separating these two components represents two-tier architecture rather than single-tier architecture.  There is direct communication takes place between client and server and there is no intermediate between client and server.  

Two-tier architecture is generally divided into two parts: Client application and Database. The client in a Two-tier architecture application has the code written for saving data in the database. The client sends a request to the server where it then processes the request and sends back the data. Meaning the client handles both the presentation layer (application interface) and application layer (logical operations), while the server system handles the database. Example of two-tier architecture is a contact management system created using MS-Acess. More importantly, two-tier architecture provides added security to the DBMS as it is not exposed to the end user directly.

What You Need To Know About Two-Tier Architecture

  • In 2-tier, the application logic is either buried inside the user interface on the client or within the database on the server (or both).
  • 2-tier architecture is client server application.
  • Two-tier architecture is divided into two layers: Client Application (Client Tier) and Database (Data Tier).
  • Direct communication takes place between client and server.
  • 2-tier systems are less scalable and robust.
  • 2-tier is less secured as client can engage the database directly.
  • One server handles both application and database duties.
  • In two tier architecture, application performance will be degraded upon increasing the users.
  • Deployment costs are high as no granularity exits.
  • No extra infrastructure is required due to tight-coupling.
  • Most clients are monolithic and thereby reusability not possible.
  • Hardware flexibility is very limited as only one client and one server exist.
  • Support for internet is poor as bandwidth limitations may take more time for downloading big client programs.
  • Can use backup servers in case of one sever failure.
  • For communication, client sends request to server and server directly responses to that client request.
  • Only connection-oriented methods calls are permitted.
  • 2-tier architecture runs slow.
  • Easy to maintain and modification is a bit easy and won’t affect other modules.
  • Less flexible because it is tightly coupled.
  • The main problem of two tier architecture is the server cannot respond multiple request same time, as a result it causes a data integrity issue.  

What Is Three-Tier Database Architecture?

A three-tier architecture is a type of software architecture which is composed of three ‘’tiers’’ or ‘’layers’’ of logical computing. They are often used in application as a specific type of client-server system. In three-tier architecture, the functional process logic, data access, computer data storage and user interface are developed and maintained as independent modules on separate platforms.  Doing so gives greater flexibility to development teams by allowing them to update a specific part of an application independently of the other parts.  This added flexibility can improve overall time-to-market and decrease development cycle times by giving development teams the ability to replace or upgrade independent tiers without affecting the other parts of the system.

The goal of three-tier architecture is:

  • To separate the user applications and physical database
  • Proposed to support DBMS characteristics
  • Program-data independence
  • Support of multiple views of the data.

Three-tier architecture is generally divided into three:

  • Presentation Layer (Client tier): This is the topmost layer of an application whose main function is to communicate with the application layer.  This layer passes information which is given by the user in terms of keyboard actions and mouse clicks to the application layer.
  • Application Layer (Business tier):  This layer consists of logic controls and functionality that processes data received from the presentation layer and database layer. It acts as an intermediary between the presentation and database layer.
  • Database Layer (Data tier):  This layer stores data and contains methods that connect to the database and performs the required actions, which include: UPDATE, DELETE or INSERT.

What You Need To Know About Three-Tier Architecture

  • In 3-tier, the application logic or process resides in the middle-tier, it is separated from the data and the user interface.
  • 3-tier architecture is web based application.
  • Three layers in three tier architecture are: Client layer, Business layer and Data layer.
  • There is an intermediate between client and server known as application server.
  • 3-tier systems are more scalable and robust, as requests can be load balanced between servers.
  • Highly secured as client is not allowed to engage the database directly.
  • There are two separate servers available to handle applications and database separately.
  • In three tier architecture application performance is good.  
  • Deployment costs are less due to builder tools.  
  • Infrastructure of middleware services can be used.
  • Reusability more with services implementation.
  • Hardware flexibility is very robust with component-based environments to distribute services between 2nd and 3rd tiers.
  • Support for internet is good as services supporting downloading are distributed.
  • If one server fails, the services can be executed on other services.
  • For communication in this model, client establishes connection with application server first and then application server initiates second connection to the database server and vice-versa response sent back to client.
  • Can support connectionless messaging, publish-subscribe and broadcast messaging.
  • Three-tier architecture runs faster.
  • Complex to build and maintain.
  • More flexible because it is loosely coupled.

Also Read: Difference Between View And Materialized View In Database

Difference Between Two-Tier And Three-Tier Database Architecture In Tabular Form

BASIS OF COMPARISON TWO-TIER ARCHITECTURE THREE-TIER ARCHITECTURE
Description In 2-tier, the application logic is either buried inside the user interface on the client or within the database on the server (or both).   In 3-tier, the application logic or process resides in the middle-tier, it is separated from the data and the user interface.  
Nature 2-tier architecture is client server application.   3-tier architecture is web based application.  
Layers Two-tier architecture is divided into two layers: Client Application (Client Tier) and Database (Data Tier).   Three layers in three tier architecture are: Client layer, Business layer and Data layer.  
Intermediate Direct communication takes place between client and server.   There is an intermediate between client and server known as application server.  
Scalability 2-tier systems are less scalable and robust.   3-tier systems are more scalable and robust, as requests can be load balanced between servers.  
Security 2-tier is less secured as client can engage the database directly.   Highly secured as client is not allowed to engage the database directly.  
Number Of Servers One server handles both application and database duties.   There are two separate servers available to handle applications and database separately.  
Application Performance In two tier architecture, application performance will be degraded upon increasing the users.   In three tier architecture application performance is good.   
Deployment Costs Deployment costs are high as no granularity exits.   Deployment costs are less due to builder tools.   
Infrastructure No extra infrastructure is required due to tight-coupling.   Infrastructure of middleware services can be used.  
Reusability Most clients are monolithic and thereby reusability not possible.   Reusability more with services implementation.  
Hardware Flexibility Hardware flexibility is very limited as only one client and one server exist.   Hardware flexibility is very robust with component-based environments to distribute services between 2nd and 3rd tiers.  
Support For Internet Support for internet is poor as bandwidth limitations may take more time for downloading big client programs.   Support for internet is good as services supporting downloading are distributed.  
Server Failure Can use backup servers in case of one server failure.   If one server fails, the services can be executed on other services.  
Communication Process For communication, client sends request to server and server directly responses to that client request.   For communication in this model, client establishes connection with application server first and then application server initiates second connection to the database server and vice-versa response sent back to client.  
Communication Methods Only connection-oriented methods calls are permitted.   Can support connectionless messaging, publish-subscribe and broadcast messaging.  
Speed 2-tier architecture runs slow.   Three-tier architecture runs faster.  
Maintenance Complex to build and maintain.   Complex to build and maintain.
Flexibility More flexible because it is loosely coupled.   More flexible because it is loosely coupled.  

Also Read: Difference Between ODBC And JDBC