Multitier Architecture
Learning objectives
- Knows what the multitier architecture is and how it relates to the client-server model.
The Client-server model (or client-server architecture) discussed previously is one instance of the Multitier architecture (N-tier architecture).
Multitier architecture refers to how functionality of the application is divided over a number of logical entities (servers). The simplest form of the multitier architecture is 1-tier architecture, where the whole application runs on a single computer, not relying on external servers. Desktop applications that do not connect to a separate server and work as stand-alone software fall to this category.

In applications that have more than one tier, there is communication between the logical entities (again, servers), to achieve the desired outcome. Client-server model is an example of the 2-tier architecture. In the client-server model, the client makes requests to the server, which then responds to the requests from the client.

In the context of web applications, web applications that follow the 2-tier architecture rely only on a client and a server. This means that the server does not connect to external services such as a database. In practice, all of our web applications that do not use a database have followed the 2-tier architecture.
On the other hand, web applications that rely on a database in addition to the existence of a client and a (web) server, follow a 3-tier architecture. The image below shows the high-level structure of a web application that uses a database.

In practice, in such an application, a request from the client could flow as follows. First, the client requests information from the web server, which then requests information from the database server. The database server processes the request from the web server, and responds to the request. The web server receives the response, and processes the request -- perhaps adding data received from the database to a view. This is done to build a response to the request from the client, which is then sent as the response to the client.

While the 3-tier architecture is commonly used in web applications, other possibilities also exist. As an example, when scaling a web application where the bottleneck is the web server, a possible architecture would be a 4-tier architecture, where a load balancer would be responsible for distributing incoming connections to different web servers. This would look as follows.

Scaling applications is visited in detail in the course Designing and Building Scalable Web Applications (CS-E4770).