System Architecture: 1, 2 & 3 Tiers
Client-server architecture, tiers, and why 3-tier solves the problems of 2-tier.
Client-Server Architecture
| Client tasks | Server tasks |
|---|---|
|
Provide a way for users to submit queries Run applications that use the results of queries Display results of queries |
Implement a data manipulation language that can directly access and update the database |
A two-tier system has clients that are connected directly to the server.
Tiers
- 1-tier — client computers and a file server.
- 2-tier — client tier + database tier (clients connect directly to the server).
- 3-tier — client tier + business logic (middle) tier + database (information) tier.
Problems with a Two-Tier System
- Performance degrades as the number of users increases.
- Scalability — supports only a limited number of users; simultaneous client requests require separate connections and CPU/memory, so performance degrades rapidly.
- Lack of security — clients have direct access to the database.
- Reusability — clients are mostly monolithic, so reuse is not possible.
Solutions with a 3-Tier Implementation
- Improved scalability — distributed application servers mean a separate connection from each client is not required; connections from a few application servers are sufficient.
- Improved security — the client does not access the database directly.
- Reusability — greater with service implementation.
Conclusion: the problems in a two-tier architecture can be handled using a three-tier implementation.
The Three Tiers
| Tier | Role |
|---|---|
| Client tier | The top tier. The application's user interface; users interact with the application through it, it makes requests to and retrieves data from the information tier, and displays data to the user. |
| Information tier | The data (bottom) tier. Maintains data for the application, stored in a relational database management system. |
| Middle tier | Implements business logic and presentation logic; acts as intermediary between application clients and application data. |
Middle tier responsibilities
- Controller logic — processes client requests from the top tier and retrieves data from the database.
- Presentation logic — processes data from the information tier and presents content to the client.
- Business logic — enforces business rules, dictates how clients can access application data and how applications process data, and ensures data validity before updating the database.