N-Tiered Software Architecture
1. What is an N-Tier Architecture?
A software architecture in which the application is split into logical layers (tiers) that run on one or more physical machines. Each tier:
- provides services to the tier above,
- consumes services of the tier below,
- can be developed, deployed, scaled and maintained independently.
= any number of tiers; typical values are 1, 2, 3 and multi-tier (4+).
2. Single-Tier (Monolithic)
All three concerns — presentation, business logic, data management — in one program on one machine (e.g. a standalone desktop app with an embedded DB). Simple, but no sharing, no scaling, tight coupling.
3. Two-Tier Client/Server
CLIENT (UI + business logic) <-- TCP/IP, SQL --> DATABASE SERVER (data)
- Form A: fat client — logic in client, server only stores data.
- Form B: thin client — client only displays; logic in server (stored procedures).
- Simple and fast on a LAN, but: business logic scattered on clients (or tangled in the DB), poor scalability, hard to maintain.
4. Three-Tier Architecture (the standard)
TIER 1 PRESENTATION browser / GUI client (HTML, CSS, JS, forms)
| HTTP / RPC
TIER 2 APPLICATION (MIDDLE) business logic: web server + app server
| JDBC / ODBC / connectors (PHP, JSP, Servlet, .NET)
TIER 3 DATA database server (Oracle, MySQL, MongoDB)
| Tier | Responsibility | Examples |
|---|---|---|
| 1 — Presentation | User interaction, input validation, display | Browser, mobile app, desktop GUI |
| 2 — Application/Business | Business rules, transactions, session management, workflow | JSP/Servlets, EJB, PHP, ASP.NET, Node.js |
| 3 — Data | Storage, indexing, integrity, backup | RDBMS, NoSQL, file stores |
Advantages: separation of concerns, reusability of the middle tier by many clients, security (DB hidden behind middle tier), scalability (replicate/app-tier load-balance), maintainability.
Disadvantages: more complex deployment, network latency between tiers, higher initial cost.
5. Multi-Tier (N-Tier, 4+ tiers)
Add specialised layers for scalability and integration:
TIER 1 Presentation (browser / mobile / kiosk)
TIER 2 WEB SERVER (static + gateway, load balancer)
TIER 3 APPLICATION SERVER (business components: EJB, microservices)
TIER 4 INTEGRATION (messaging, ESB, legacy adapters)
TIER 5 DATABASE (possibly replicated, sharded, plus data warehouse)
Rules of a clean n-tier design: a layer may talk only to the layer directly below it (or publish services upward), interfaces are well-defined contracts, state is kept where it belongs (sessions in tier 2, data in tier 3/5).
6. Comparing the Models
| Criterion | 1-tier | 2-tier | 3-tier | Multi-tier |
|---|---|---|---|---|
| Deployment | One machine | Client + server | Client + 2 servers | Many machines |
| Maintainability | Easy (small apps) | Poor | Good | Best |
| Scalability | None | Limited | Good | Excellent |
| Security | N/A | Weak | Good | Best (firewalls between tiers) |
| Latency | None | Low | Medium | Higher |
| Cost/complexity | Low | Low | Medium | High |
7. Exam Points
- Explain the three-tier architecture with a diagram and responsibilities of each tier — 10 marks (very frequent).
- Compare single-tier, two-tier, three-tier and n-tier architectures — 7 marks.
- Advantages and limitations of multi-tier architectures — 5 marks.
- What rules govern communication between tiers? — 3-5 marks.