Two-Tier Architecture
The 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.
- Can use backup servers in case of one severe failure.
- 2-tier architecture runs slow.
- The main problem of two-tier architecture is the server cannot respond to multiple requests same time, as a result, it causes a data integrity issue.
Three-Tier Architecture
Three-tier architecture is generally divided into three: Presentation Layer (Client tier), Application Layer (Business tier), Database Layer (Data tier)
- 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 that 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 perform the required actions, which include: UPDATE, DELETE or INSERT.
There is an intermediate between client and server known as an application server.
- For communication in this model, the client establishes a connection with the application server first and then the application server initiates a second connection to the database
- Can support connectionless messaging, publish-subscribe, and broadcast messaging.
- Three-tier architecture runs faster.